title: Firefox option pane UX design in Java Swing?
body: <p>I need to design a window similar to <code>Firefox &gt; tools &gt; options</code> (shown below) using Java Swing. I have to create two top headers. On click of each I have to open tabbedpanes (Same as <code>Firefox &gt; tools &gt; options &gt; advanced</code>. I am pretty much new to Swing.</p>
  
  <p><img src="https://i.stack.imgur.com/sAdTq.png" alt="enter image description here"></p>
  
  <p>Thanks for the quick reply.I have tried implementing the same.
  The base window is JDialog. Whithin which I ahve created the top panel.The toolbar(at the BorderLayout-North of topPanel) and the content panel (at the BorderLayout-Center of topPanel) are added into this top panel.
  Two toolbar buttons-"general" and "advanced" are created which are the headers i was talking to in my last post."contentPanel" is the placeholder panel.
   where I want to dynamically add the tabbed panels whenever the toolbar butons gets clicked.And default is general.</p>
  
  <p>Whenevr the advanced toolbar button is clicked ,I want to remove the _generalTabbedPane and show the _advanceTabbedPane and vice versa.</p>
  
  <p>But it is not happening properly.Adding and removing/hiding the panels when toolbar button is clicked is what I need to fix.I have attached the code below.</p>
  
  <p>Kindly help.</p>
  
  <pre><code> @Override
     public JComponent createContentPanel()
    {        
     topPanel  = new JPanel();
     topPanel.setLayout(new BorderLayout());     
     JToolBar toolBar = new JToolBar();
     toolBar.add(new tabButton("general",GENERAL));
     toolBar.add(new tabButton("advanced",ADVANCED));
  
     contentPanel = new JPanel();       
     contentPanel.add(getGeneralTabs());
  
     topPanel.add(toolBar, BorderLayout.NORTH);
     topPanel.add(contentPanel, BorderLayout.CENTER);        
     return topPanel;
  
  
  }  
  private  final class JCenterLabel extends JLabel
  {       
      public JCenterLabel(final String s)
      {
          super(s);
          setAlignmentX(Component.CENTER_ALIGNMENT);
      }
  
      public JCenterLabel(final Icon i)
      {
          super(i);
          setAlignmentX(Component.CENTER_ALIGNMENT);
      }
  }
  
  private  class tabButton extends JButton
  {   
      public tabButton (  String tabId,String actionCommand)
      {
          super();
          setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));      
          add(new JCenterLabel(UIManager.getIcon("OptionPane.informationIcon"))); 
          add(new JCenterLabel(tabId)); 
          this.setActionCommand(actionCommand);
          this.setName(tabId);
          this.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) { 
              String cmd = e.getActionCommand();
              if (GENERAL.equals(cmd)) { 
                  if(contentPanel != null){
                  contentPanel.remove(_advanceTabbedPane);     
                  contentPanel.add(getGeneralTabs());
                  contentPanel.revalidate();
                  contentPanel.repaint();
  
  
                  }
  
              } else if (ADVANCED.equals(cmd)) { 
                  if(contentPanel != null){
                  contentPanel.remove(_generalTabbedPane);               
                  contentPanel.add(getAdvancedTabs());
                  contentPanel.revalidate();
                  contentPanel.repaint();
  
  
                  }
              } 
  
          }
          });
  }
  }
  
    private JideTabbedPane  getGeneralTabs(){
      _generalTabbedPane = new JideTabbedPane();
      _generalTabbedPane.setModel(new TabbedPaneWithValidationModel());
      //adding the tabs to the _generalTabbedPane
      //-----
      //---
  
      return _generalTabbedPane;
  
  
  }
    private   JideTabbedPane getAdvancedTabs(){
        _advanceTabbedPane = new JideTabbedPane();
        _advanceTabbedPane.setModel(new TabbedPaneWithValidationModel());
        //adding the tabs to the _advanceTabbedPane
      //-----
      //---
        return _advanceTabbedPane;
  
    }
  </code></pre>