My Program will allow the user to navigate between three forms. Main Menu, Customer information and a database.
I need the main menu objects to be usable with the Customer forms submit button. For example:
There is a selection of comboboxes and I want to:
String variable = jComboMainMenu1.getSelectedItem().toString;
How do I import the objects into the customer form in order to use the values selected?
Edit:
**The error I get is that combox is private to the jframe. There is no way of changing that, as netbeans won't allow me to?
Says //variable declarations - do not modify.
**I tried:
public String car = jComboBox1.getSelectedItem().toString(); (This will store the value from the combobox in a variable as you already know).
However swing seems to be SUPER restrictive, because even my jbutton for the frame is restricted to private and this means that the variable cannot be made public to be used with buttons on other frames.
What is frustrating is that it is restricting me the programmer from changing the code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { <--Can not be changed to public.
new CustomerForm().setVisible(true);
setVisible(false);
String car = jComboBox1.getSelectedItem().toString();
}
// Variables declaration - do not modify <-- can't be changed either.
private javax.swing.JButton jButton1;
private javax.swing.JComboBox jComboBox1;
private javax.swing.JComboBox jComboBox2;
private javax.swing.JComboBox jComboBox3;
private javax.swing.JComboBox jComboBox4;
private javax.swing.JComboBox jComboBox5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JTextField jTextField1;
// End of variables declaration
** I have tried editing the template in the IDE itself, however the means to change the grayed area seems to be heavily encapsulated.
Something like this should be very simple surely? :P