Controlling Which Item JComboBox Displays
Hi,
I am using 12 JComboBoxes to organize the information I want to display in a GUI I am creating on programming languages.
JComboBox variableCB;
JComboBox operatorsCB;
JComboBox mathCB;
JComboBox stringCB;
JComboBox arrayCB;
JComboBox IOCB;
JComboBox classCB;
JComboBox linkedCB;
JComboBox stacksCB;
JComboBox queuesCB;
JComboBox quickRefCB;
JComboBox librariesCB;
I have set each JComboBox so the first item in the box displays the topic it covers:
VARIABLES / IDENTIFIERS
MATH
STACKS
QUEUES
etc.
Items in 1 JComboBox are: (I will put this in an array later but for now)
variableCB=new JComboBox();
variableCB.addItem("VARIABLES / IDENTIFIERS");
variableCB.addItem("Data Types");
variableCB.addItem("Naming");
variableCB.addItem("Declaring");
variableCB.addItem("Initializing");
variableCB.addItem("Changing Data Types");
variableCB.addItem("Boolean");
variableCB.addItem("Constants");
variableCB.addItem("Global");
variableCB.addItem("Examples");
Once I select an item to display information on the subject in my JTextArea that subcategory stays in the JComboBox display which reduces the efficiency of the tool because in this case VARIABLE / IDENTIFIER is no longer displayed.
Is there a way to reset the JComboBox to display the item I want? I was trying the selectItem but it wouldn't accept the int value of 0 or -1 which I saw posted as options. Does it have to be in an array to do this? I will be trying that next.
Thanks

