diff --git a/projects/samskivert/src/java/com/samskivert/swing/GroupLayoutTest.java b/projects/samskivert/src/java/com/samskivert/swing/GroupLayoutTest.java index 06da0bd8..aa137e0a 100644 --- a/projects/samskivert/src/java/com/samskivert/swing/GroupLayoutTest.java +++ b/projects/samskivert/src/java/com/samskivert/swing/GroupLayoutTest.java @@ -1,5 +1,5 @@ // -// $Id: GroupLayoutTest.java,v 1.2 2001/08/11 22:43:28 mdb Exp $ +// $Id: GroupLayoutTest.java,v 1.3 2001/10/09 19:46:31 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -33,9 +33,12 @@ public class GroupLayoutTest GroupLayout layout = new HGroupLayout(); layout.setJustification(GroupLayout.CENTER); layout.setPolicy(GroupLayout.STRETCH); + layout.setJustification(GroupLayout.RIGHT); layout.setGap(15); panel.setLayout(layout); + panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + JButton butone = new JButton("One"); panel.add(butone, GroupLayout.FIXED); JButton buttwo = new JButton("Two"); diff --git a/projects/samskivert/src/java/com/samskivert/swing/HGroupLayout.java b/projects/samskivert/src/java/com/samskivert/swing/HGroupLayout.java index 9d3fda5b..14c1457f 100644 --- a/projects/samskivert/src/java/com/samskivert/swing/HGroupLayout.java +++ b/projects/samskivert/src/java/com/samskivert/swing/HGroupLayout.java @@ -1,5 +1,5 @@ // -// $Id: HGroupLayout.java,v 1.7 2001/10/09 19:21:37 mdb Exp $ +// $Id: HGroupLayout.java,v 1.8 2001/10/09 19:46:31 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -95,7 +95,7 @@ public class HGroupLayout extends GroupLayout b.height -= (insets.top + insets.bottom); int nk = parent.getComponentCount(); - int sx = insets.left, sy = insets.top; + int sx, sy; int totwid, totgap = _gap * (info.count-1); int freecount = info.count - info.numfix; @@ -135,11 +135,9 @@ public class HGroupLayout extends GroupLayout case STRETCH: defhei = b.height; break; - case EQUALIZE: defhei = info.maxhei; break; - default: case NONE: break; @@ -147,12 +145,17 @@ public class HGroupLayout extends GroupLayout // do the justification-related calculations switch (_justification) { + default: + case LEFT: + case TOP: + sx = insets.left; + break; case CENTER: - sx += (b.width - totwid)/2; + sx = insets.left + (b.width - totwid)/2; break; case RIGHT: case BOTTOM: - sx += b.width - totwid - insets.right; + sx = insets.left + b.width - totwid; break; } @@ -186,12 +189,10 @@ public class HGroupLayout extends GroupLayout case TOP: sy = insets.top; break; - case RIGHT: case BOTTOM: - sy = b.height - newhei - insets.bottom; + sy = insets.top + b.height - newhei; break; - default: case CENTER: sy = insets.top + (b.height - newhei)/2; diff --git a/projects/samskivert/src/java/com/samskivert/swing/VGroupLayout.java b/projects/samskivert/src/java/com/samskivert/swing/VGroupLayout.java index 6d16bb78..2e8ba67e 100644 --- a/projects/samskivert/src/java/com/samskivert/swing/VGroupLayout.java +++ b/projects/samskivert/src/java/com/samskivert/swing/VGroupLayout.java @@ -1,5 +1,5 @@ // -// $Id: VGroupLayout.java,v 1.7 2001/10/09 19:21:37 mdb Exp $ +// $Id: VGroupLayout.java,v 1.8 2001/10/09 19:46:31 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -95,7 +95,7 @@ public class VGroupLayout extends GroupLayout b.height -= (insets.top + insets.bottom); int nk = parent.getComponentCount(); - int sx = insets.left, sy = insets.top; + int sx, sy; int tothei, totgap = _gap * (info.count-1); int freecount = info.count - info.numfix; @@ -135,11 +135,9 @@ public class VGroupLayout extends GroupLayout case STRETCH: defwid = b.width; break; - case EQUALIZE: defwid = info.maxwid; break; - default: case NONE: break; @@ -147,12 +145,16 @@ public class VGroupLayout extends GroupLayout // do the justification-related calculations switch (_justification) { + default: + case LEFT: + case TOP: + sy = insets.top; case CENTER: - sy += (b.height - tothei)/2; + sy = insets.top + (b.height - tothei)/2; break; case RIGHT: case BOTTOM: - sy += b.height - tothei - insets.bottom; + sy = insets.top + b.height - tothei; break; } @@ -186,12 +188,10 @@ public class VGroupLayout extends GroupLayout case TOP: sx = insets.left; break; - case RIGHT: case BOTTOM: - sx = b.width - newwid - insets.right; + sx = insets.left + b.width - newwid; break; - default: case CENTER: sx = insets.left + (b.width - newwid)/2;