1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
setTitle("Configuration du tableau");
setModal(true);
setResizable(true);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new BorderLayout());
// subdivision of the window :
// - top part <=> column number text field
// - bottom part <=> columns caracteristics combo
splitPaneVertical = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
getContentPane().add(splitPaneVertical, BorderLayout.CENTER);
// top part : column number text field
JPanel colNumberPanel = new JPanel();
splitPaneVertical.add(colNumberPanel, JSplitPane.LEFT);
colNumberPanel.setSize(260, 35);
colNumberPanel.setPreferredSize(new Dimension(260, 35));
colNumberPanel.setLayout(new FlowLayout());
JLabel label = new JLabel("Nombre de colonnes :");
nbColumn = new JTextField();
nbColumn.setSize(30, 20);
nbColumn.setPreferredSize(new Dimension(30, 20));
nbColumn.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent arg0) {
if (arg0.getKeyChar() == KeyEvent.VK_ENTER) {
createCaracteristics();
splitPaneVertical.add(colCaracteristicsPanel, JSplitPane.RIGHT);
splitPaneVertical.repaint();
}
}
public void keyReleased(KeyEvent arg0) {
}
public void keyTyped(KeyEvent arg0) {
}
});
colNumberPanel.add(label);
colNumberPanel.add(nbColumn);
// bottom part : columns caracteristics combo
colCaracteristicsPanel = new JPanel();
// buttons
JPanel buttonsPanel = new JPanel();
getContentPane().add(buttonsPanel, BorderLayout.SOUTH);
buttonsPanel.setSize(300, 35);
buttonsPanel.setPreferredSize(new Dimension(300, 35));
buttonsPanel.setMaximumSize(new Dimension(300, 35));
buttonsPanel.setLayout(new FlowLayout());
JButton bOk = new JButton("OK");
[...]
JButton bCancel = new JButton("Cancel");
[...]
JButton bSave = new JButton("Save");
[...]
buttonsPanel.add(bSave);
buttonsPanel.add(bOk);
buttonsPanel.add(bCancel);
setLocation(CreateDefectTableDialog.getCenterPosition(this));
this.pack(); |
Partager