alignment problem in JPanel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stmfc
    New Member
    • May 2007
    • 65

    alignment problem in JPanel

    i add a panel (P1) to a frame ,
    then i add three panels(panA,pan B,panC) to this panel (P1) using BoxLayout.
    then i add two buttons to the panel panC which is at the bottom of P1 .
    but i cannot align this buttons as i want.
    they stay as TOP_ALIGNMENT although i want them to be located BOTTOM_ALIGNED

    what can be done to solve this porblem?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by stmfc
    i add a panel (P1) to a frame ,
    then i add three panels(panA,pan B,panC) to this panel (P1) using BoxLayout.
    then i add two buttons to the panel panC which is at the bottom of P1 .
    but i cannot align this buttons as i want.
    they stay as TOP_ALIGNMENT although i want them to be located BOTTOM_ALIGNED

    what can be done to solve this porblem?
    Maybe the Box class can be of help; that class has a couple of static
    methods available that can create rigid areas for invisible components of a
    fixed width/heigth, or glue (or antiglue) or struts that keep other components
    apart. Read the API docs and add one of those between the panels.

    kind regards,

    Jos

    Comment

    • praveen2gupta
      New Member
      • May 2007
      • 200

      #3
      Originally posted by stmfc
      i add a panel (P1) to a frame ,
      then i add three panels(panA,pan B,panC) to this panel (P1) using BoxLayout.
      then i add two buttons to the panel panC which is at the bottom of P1 .
      but i cannot align this buttons as i want.
      they stay as TOP_ALIGNMENT although i want them to be located BOTTOM_ALIGNED

      what can be done to solve this porblem?
      Hi
      It would be better to see code and problem. You can also use BorderLayout
      for it.Better post your code.

      Comment

      Working...