Results 1 to 3 of 3
  1. #1
    Nemus is offline Member
    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Default Jpanels with in Jpanels and no flow layout just postion

    so I have two class that has extend Jpanel

    MasterPanel Extends Jpanel()

    InsidePanelExends Jpanel()


    so if try to do InsidePAnel.setLocation()
    masterPanel.add(InsidePanel);

    it doesn't let me move the panel around inside the other panel.

    how do I add components with out using layouts
    Last edited by Nemus; 04-04-2011 at 05:46 AM.

  2. #2
    Join Date
    Aug 2011
    Location
    Pretoria, South Africa
    Posts
    27
    Blog Entries
    3
    Rep Power
    0

    Default Re: Jpannels with in Jpannels and no flow layout just postion

    o my... over 200 views and not a single reply???
    I hope this can help you.

    first set the masterPanel layout to null.
    Java Code:
    masterPanel.setLayout(null);
    when you set the containers layout to null remember to set every object within the container bounds. like so.

    Java Code:
    masterPanel mP = new masterPanel();
    mP .setLayout(null);
    insidePanel iP = new insidePanel();
    iP.setBounds(0, 0, 20, 20);
    mP.add(iP);

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,000
    Blog Entries
    7
    Rep Power
    20

    Default Re: Jpanels with in Jpanels and no flow layout just postion

    Quote Originally Posted by Nemus View Post
    it doesn't let me move the panel around inside the other panel.
    A JPanel has no reason to move unless you use its setLocation( ... ) method to set it to a different location.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Custom JButton with flow layout
    By phil128 in forum AWT / Swing
    Replies: 1
    Last Post: 01-17-2011, 10:44 PM
  2. How to generate Data Flow Diagram(Work Flow Diagram)
    By stsivaraj in forum AWT / Swing
    Replies: 1
    Last Post: 12-22-2010, 11:21 PM
  3. request flow across the page
    By Riyaz.hk77 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 12-07-2010, 08:20 PM
  4. stack over flow error
    By sara12345 in forum New To Java
    Replies: 3
    Last Post: 04-14-2010, 09:50 PM
  5. program flow
    By loktamu in forum AWT / Swing
    Replies: 1
    Last Post: 09-17-2008, 04:52 PM

Tags for this Thread

Posting Permissions

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