Results 1 to 5 of 5

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

  1. #1

    Thread Starter
    Hyperactive Member CaptainPinko's Avatar
    Join Date
    Jan 2001
    Location
    London, Ontario, Canada
    Posts
    332

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

    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?...

    Why do you sometimes use .add (eg. JPanel) and sometimes .getContentPane().add (eg. JInternalDialog)?

    Is there and way to, by code, maximize a JFrame or JInternalFrame?
    Last edited by CaptainPinko; Jan 10th, 2002 at 04:38 PM.
    "There are only two things that are infinite. The universe and human stupidity... and the universe I'm not sure about." - Einstein

    If you are programming in Java use www.NetBeans.org

  2. #2
    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);

  3. #3
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    a panel (be it awt or swing) is a container, as was said before. a pane is part of the view port (sort of like the z axis/order). go to http://java.sun.com/docs/books/tutorial/search.html and type in pane - it should bring up quite a bit about panes

  4. #4

  5. #5
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    mainly just put it there for any other newbie who may be a tad confused bout it, sowy

    must admit, it is a bit hard to grasp the concept of java at times (especially if one has programmed in another language e.g vb - went through that hell myself: cobol, basic, vb, pascal)

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