Results 1 to 5 of 5

Thread: SWING: whats the difference between panels and panes? [resolved]

Hybrid View

  1. #1
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    What is the difference between a panel and a pane? They are both used often, but why is it JTabbedPane and JPanel and not the other wayaround? Any reason?...
    JTabbedPane is an actual component. JPanel is a component also but it really offers no additional functionality other then to group components.

    Why do you sometimes use .add (eg. JPanel) and sometimes .getContentPane().add (eg. JInternalDialog)?
    I used to be confused with this also. And i would often forget to add components to the content pane instead of say a JFrame which causes a compilation error.

    .getContentPane().add (eg. JInternalDialog) that you are refering to is a short hand alternative. You can code it like this if you wanted to(as i often do)
    Code:
    JFrame jf = new JFrame("Hello"); 
    Container c = jf.getContentPane();
    c.add(jc);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width