I have few JFrames. Using one of them (it contains textBox) I want to transfer inputed data to the variable in another class. This variable is used to build JComboBox choose list. I try to transfer inputed data via JButton, but in the end nothing is transferred and JComboBox stays empty. Do I need to somehow refresh JComboBox or something? My code:
...
DataBase toTable = new DataBase();
...
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent click) {
toTable.data[0] = textField.getText();
}
});
Variable from DataBase class:
....
String data[] = {"","","","",""};
....
And the Main Class (it contains JComboBox):
...
DataBase data0 = new DataBase();
final JComboBox list0 = new JComboBox(data0.data);
list0.setBounds(10, 61, 110, 22);
contentPane.add(list0);