Link to home
Start Free TrialLog in
Avatar of chenwei
chenwei

asked on

JSplitPane

I've written a program which will generate a split window:

public class AVIS extends JSplitPane
{
  static      JFrame frame;
  private      JTextField      tf=new JTextField(19);

  public AVIS()
  {
    super(HORIZONTAL_SPLIT);
   
    JScrollPane listScrollPane = new JScrollPane();

           JTabbedPane      tabbedPane=new JTabbedPane();
            tabbedPane.addTab("Nr.1", tf);
            tabbedPane.addTab("Nr.2", tf);         setLeftComponent(listScrollPane);                  setRightComponent(tabbedPane);
   setDividerLocation(150);
   setDividerSize(10);
   setPreferredSize(new Dimension(400, 200));
  }

  public static void main(String s[])
  {
    WindowListener l = new WindowAdapter()
    {
      public void windowClosing(WindowEvent e)       {System.exit(0);
    }
  };
  frame = new JFrame("AVIS");
  frame.addWindowListener(l);          frame.getContentPane().add("Center", new AVIS());          frame.pack();
  frame.setVisible(true);
  }
};

But as I start the program, one can just see a tab "Nr.1", not two tabs "Nr.1" and "Nr.2".
 Why?
ASKER CERTIFIED SOLUTION
Avatar of msmolyak
msmolyak

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial