From 30ae1be3c8b128822977ea520c2a981101d954b2 Mon Sep 17 00:00:00 2001 From: ray Date: Fri, 18 Jul 2008 18:30:04 +0000 Subject: [PATCH] Patch from Charlie Groves: - Makes the button arg on GroupLayout.makeButtonBox a vararg so multiple buttons can be passed in at creation time. It also adds a version using center justification as the default since that's what we do about 80% of the time in yohoho. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2337 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../com/samskivert/swing/GroupLayout.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/java/com/samskivert/swing/GroupLayout.java b/src/java/com/samskivert/swing/GroupLayout.java index cf84ea54..91fef5eb 100644 --- a/src/java/com/samskivert/swing/GroupLayout.java +++ b/src/java/com/samskivert/swing/GroupLayout.java @@ -346,25 +346,24 @@ public abstract class GroupLayout } /** - * Creates a {@link JPanel} that is configured with an {@link - * HGroupLayout} with a configuration conducive to containing a row of - * buttons. + * Creates a {@link JPanel} that is configured with a center-justified {@link HGroupLayout} + * with a configuration conducive to containing a row of buttons. Any supplied buttons are + * added to the box. */ - public static JPanel makeButtonBox (Justification justification) + public static JPanel makeButtonBox (JComponent... buttons) { - return makeButtonBox(justification, null); + return makeButtonBox(GroupLayout.CENTER, buttons); } /** - * Creates a {@link JPanel} that is configured with an {@link - * HGroupLayout} with a configuration conducive to containing a row of - * buttons. The supplied button is added to the box. + * Creates a {@link JPanel} that is configured with an {@link HGroupLayout} with a + * configuration conducive to containing a row of buttons. Any supplied buttons are added to + * the box. */ - public static JPanel makeButtonBox ( - Justification justification, JComponent button) + public static JPanel makeButtonBox (Justification justification, JComponent... buttons) { JPanel box = new JPanel(new HGroupLayout(NONE, justification)); - if (button != null) { + for (JComponent button : buttons) { box.add(button); box.setOpaque(false); }