final JComboBox departure = new JComboBox();
departure.setModel(new DefaultComboBoxModel(new String[] {"city1", "city2", "city3"}));
departure.setBounds(413, 11, 147, 20);
int selectedIndex1=departure.getSelectedIndex();
contentPane.add(departure);
I am coding a bus reservation system for my homework, I use JComboBox
to choose destination and departure city. I want to call selected item from another class. In this class the user will choose his seat.
How can I call selected item from another class? Please help me.. thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…