Results 1 to 5 of 5
  1. #1
    temyong is offline Member
    Join Date
    Nov 2010
    Posts
    20
    Rep Power
    0

    Talking don't know the right layout

    hey guys, just asking if what layout manager should i do to make this happen.
    I am making a simple game and I want to put the red panel into the middle of the yellow panel regardless of the size of the red panel.
    I use different combinations of layout managers and techniques that i know but can't seem to work.
    hope you guys can help me with this. and advance thanks. :)
    Attached Thumbnails Attached Thumbnails don't know the right layout-layoutq.jpg  

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

    Default

    Quote Originally Posted by temyong View Post
    hey guys, just asking if what layout manager should i do to make this happen.
    I am making a simple game and I want to put the red panel into the middle of the yellow panel regardless of the size of the red panel.
    I use different combinations of layout managers and techniques that i know but can't seem to work.
    hope you guys can help me with this. and advance thanks. :)
    If you can do that 'window' like panel, store that panel in another panel with a thick yellow bordered panel (see the BorderFactory class, it can make LineBorders for you).

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    temyong is offline Member
    Join Date
    Nov 2010
    Posts
    20
    Rep Power
    0

    Default

    Quote Originally Posted by JosAH View Post
    If you can do that 'window'
    like panel, store that panel in another panel with a thick yellow bordered panel (see the BorderFactory class, it can make LineBorders for you).
    Hello JosAH, I do not really want to make that panel yellow,i just taught that it would be much understandable if i put some color to it.
    Here is the thing, I just want to put the red one in the middle of the other one which is the yellow panel regardless of the size or dimension of the yellow panel.
    So when you resize the yellow panel, the red panel inside it should always be in the middle of it.. btw thanks for the rep.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default

    I just want to put the red one in the middle of the other one which is the yellow panel regardless of the size or dimension of the yellow panel.
    So when you resize the yellow panel, the red panel inside it should always be in the middle of it.
    -- Give the yellow panel a GridBagLayout
    -- Add the red panel without any GridBagConstraint
    Java Code:
    yellowPanel.setLayout(new GridBagLayout());
    yellowPanel.add(redPanel);
    db

  5. #5
    temyong is offline Member
    Join Date
    Nov 2010
    Posts
    20
    Rep Power
    0

Similar Threads

  1. Please help me in this layout :(
    By orionorion in forum Java Applets
    Replies: 1
    Last Post: 02-09-2011, 02:47 PM
  2. Please Help me to do a layout
    By neway003 in forum AWT / Swing
    Replies: 3
    Last Post: 11-03-2010, 06:28 PM
  3. looking for a layout
    By imorio in forum AWT / Swing
    Replies: 3
    Last Post: 08-13-2010, 05:02 PM
  4. Edit layout Layout please help me
    By manhtungtnk28@gmail.com in forum New To Java
    Replies: 4
    Last Post: 11-23-2009, 08:41 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
  •