0

So, my question is: When select the "Perimeter" from the JComboBox, how would I go about making so that tab(held within the JTabbedPane) comes to the front? and likewise with area or other Tabs.

    private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
    String selectedItem = jComboBox1.getSelectedItem().toString();

    if(selectedItem != null)
    {
        //if perimeter option selected, show the tab for it
        if(selectedItem.equals("Perimeter"))
        {
            //bring the permeter tab to the front, all contained within a tabbedPane
        }

        if(selectedItem.equals("Area"))
        {
            //bring the area tab to the front, all contained within a tabbedPane
        }
    }
} 
mKorbel
  • 109,525
  • 20
  • 134
  • 319
Wesnc
  • 27
  • 1
  • 5

2 Answers2

0

You could use it as a show and not show option, so that if they select perimeter it shows the perimeter information in the tabbed pane.

frame.setVisible(true);

or if you are looking to put this tabbed pane on top of the other you can try: Java Swing - how to show a panel on top of another panel?

Community
  • 1
  • 1
Jim
  • 3,236
  • 8
  • 33
  • 43
0

I think you might be looking for this: http://download.oracle.com/javase/6/docs/api/javax/swing/JTabbedPane.html#setSelectedIndex%28int%29

TabbedPane .setSelectedIndex(int)

Gunnar Hoffman
  • 1,226
  • 1
  • 11
  • 11