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
|
//Cette fonction c'est pour créer l'interface (boite de dialogue)
public Table() {
setBounds(100, 100, 450, 465);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BorderLayout(0, 0));
JPanel panel = new JPanel();
FlowLayout flowLayout = (FlowLayout) panel.getLayout();
flowLayout.setAlignment(FlowLayout.RIGHT);
contentPanel.add(panel, BorderLayout.NORTH);
JLabel lblNombreDeVarib = new JLabel("Nombre de varibles");
lblNombreDeVarib.setFont(UIManager.getFont("OptionPane.font"));
panel.add(lblNombreDeVarib);
//spinner.addChangeListener(this);
spinner.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent arg0) {
String comboBox = (String) table.getValueAt(0, 4);
System.out.println(comboBox);
}
});
spinner.setModel(new SpinnerNumberModel(2, 1, 8, 1));
panel.add(spinner);
updateTable();
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
getValues();
dispose();
}
});
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
JButton cancelButton = new JButton("Cancel");
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
dispose();
}
});
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
} |
Partager