Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: About layering JFrames JPanels and the whole deal with that?

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Location
    Birmingham
    Posts
    20
    My Mood
    Depressed
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default About layering JFrames JPanels and the whole deal with that?

    hey i been making a JFrame window with a JMenuBar a JList and some other stuff but i can never seem to remember or figure out
    what order they have to be layed can anyone tell me which windows or panels or what not can parent other windows
    ... I am sorry if what I ask don't make too much sense but I am trying my best to explain.

    I need hieracy (excuse the spelling ) of what windows can be added on top of others.

    like.

    JFrame, JPanel, JMenuBar.

    please if you can understand what i have said because I am not sure it makes sense the any help will be great.
    thanks.


    no ones replying ? is it a stupid question anything would help
    Last edited by .Swing; June 8th, 2012 at 09:57 PM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: About layering JFrames JPanels and the whole deal with that?

    I honestly don't know what you are asking. Are you looking for explanations like these?
    Using Top-Level Containers (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
    A Visual Guide to Layout Managers (The Java™ Tutorials > Creating a GUI With JFC/Swing > Laying Out Components Within a Container)

    Or are you looking for an explanation as to what can be added to what (Components are added to Containers - look at the inheritance of the classes you use)

    no ones replying ? is it a stupid question anything would help
    Please don't expect unpaid volunteers to be online waiting to answer each and every thread 24/7

  3. #3
    Junior Member
    Join Date
    Jun 2012
    Location
    Birmingham
    Posts
    20
    My Mood
    Depressed
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default Re: About layering JFrames JPanels and the whole deal with that?

    yes kind of so i was wondering if there was a specific order containers can be placed onto eachother. so like a jpanel cannot be placed on another jpanel. or is this still a stupid question?
    Just be nice.

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: About layering JFrames JPanels and the whole deal with that?

    My advice would be to try it and see...theory is one things, but getting it to work is another. Here's the theory:

    Take a look at the inheritance hierarchy of JPanel
    JPanel (Java Platform SE 6)
    Component->Container->JComponent->JPanel
    Now take a look at the add method in Container (which is what one uses to add things to a JPanel) - it is defined as accepting a Component ...in other words you can add anything that is a Component to a Container. JPanel extends both, so yes you can add one JPanel to another, just as you can add other JComponents to a JPanel. This nesting is powerful, as different JPanel's can have different LayoutManagers, allowing you a huge amount of flexibility in laying out a user interface.

    And a note on your signature and comments - getting answers has everything to do with asking the question. See the link in my signature entitled 'getting help' as well as http://www.catb.org/~esr/faqs/smart-questions.html

  5. #5
    Junior Member
    Join Date
    Jun 2012
    Location
    Birmingham
    Posts
    20
    My Mood
    Depressed
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default Re: About layering JFrames JPanels and the whole deal with that?

    thank you for your reply I will look into that.
    very much appreciated.
    Just be nice.

Similar Threads

  1. Not a big deal - Make me a GUI!
    By flashzero in forum Paid Java Projects
    Replies: 1
    Last Post: January 26th, 2012, 02:00 PM
  2. Game Image Layering Help
    By SkyAphid in forum Java Theory & Questions
    Replies: 3
    Last Post: December 31st, 2011, 11:01 PM
  3. Not sure how to deal with addActionListener! :3
    By Asteroid555 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: July 1st, 2011, 01:57 PM
  4. No Time To Deal With The Assigment
    By Vins25 in forum Java Theory & Questions
    Replies: 14
    Last Post: May 3rd, 2011, 07:39 AM
  5. Replies: 1
    Last Post: December 7th, 2009, 01:55 PM