Results 1 to 2 of 2
  1. #1
    Bestsanchez is offline Member
    Join Date
    Jan 2012
    Location
    The Coffee Pot
    Posts
    36
    Rep Power
    0

    Default Content pane vs. JPanel?

    I'll be honest I have limited knowledge of swing, but when I was looking at code snippets online to get me on the right track for my hangman game I saw a lot of 'frame.getContentPane()'. I never understood the point of it because I completed my game successfully by just making a JFrame and putting a bunch of JPanels in it. So out of curiosity, what is the point of it?

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Content pane vs. JPanel?

    See Using Top-Level Containers (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
    Also note the API for JFrame...
    As a conveniance add and its variants, remove and setLayout have been overridden to forward to the contentPane as necessary.

Similar Threads

  1. Can't change the background of my content pane
    By jiffi in forum AWT / Swing
    Replies: 29
    Last Post: 12-11-2011, 06:04 PM
  2. Centering things a content pane
    By RKhadder in forum New To Java
    Replies: 1
    Last Post: 09-28-2010, 02:43 AM
  3. Update the JFrame after change the Content Pane
    By alisonchan30 in forum AWT / Swing
    Replies: 1
    Last Post: 04-26-2010, 07:22 AM
  4. Changing content pane of a JFrame?
    By dunafrothint in forum AWT / Swing
    Replies: 1
    Last Post: 03-11-2010, 11:21 PM
  5. Replies: 3
    Last Post: 01-06-2008, 12:13 AM

Posting Permissions

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