Results 1 to 5 of 5
  1. #1
    shwein is offline Member
    Join Date
    Sep 2008
    Posts
    38
    Rep Power
    0

    Default panel positioning

    hello all,
    how can you set the location and size of a panel in another panel?
    like if i had 2 panels and i would like to set the size of panel1 and the location of panel 1 in the container that is panel2

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,443
    Rep Power
    25

    Default

    Look at layout managers and the set... methods of the Component class. There some to locate and size a component in its container.
    There are probably examples on the forum if you Search.

  3. #3
    shwein is offline Member
    Join Date
    Sep 2008
    Posts
    38
    Rep Power
    0

    Default

    i can't find it on forum...

    lets say i have 3 classes, each representing a panel:

    PanelMain, Panel1, Panel2

    can i set the size of Panel1 in its constructor and the location(setBounds or setLocation?) in the constructor of PanelMain?

  4. #4
    shwein is offline Member
    Join Date
    Sep 2008
    Posts
    38
    Rep Power
    0

    Default

    okay, maybe i m a bit lazy...
    ill look it up, thx anyway

  5. #5
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,443
    Rep Power
    25

    Default

    If you are positioning a component in a container, you will need to remove the layout manager. That can be done by setting it to null.

Similar Threads

  1. How to add more components to main panel
    By aneesahamedaa in forum AWT / Swing
    Replies: 4
    Last Post: 08-21-2008, 06:31 PM
  2. add image on panel
    By samiksha.goel in forum AWT / Swing
    Replies: 4
    Last Post: 08-02-2008, 07:38 PM
  3. Undoable Drawing Panel
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 07:52 PM
  4. Problem in getting table on panel
    By adeeb in forum AWT / Swing
    Replies: 0
    Last Post: 06-09-2008, 08:23 PM
  5. Help with drag from panel
    By fernando in forum AWT / Swing
    Replies: 2
    Last Post: 08-07-2007, 10:19 PM

Posting Permissions

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