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
This commit is contained in:
ray
2008-07-18 18:30:04 +00:00
parent 69930d1f76
commit 30ae1be3c8
+10 -11
View File
@@ -346,25 +346,24 @@ public abstract class GroupLayout
} }
/** /**
* Creates a {@link JPanel} that is configured with an {@link * Creates a {@link JPanel} that is configured with a center-justified {@link HGroupLayout}
* HGroupLayout} with a configuration conducive to containing a row of * with a configuration conducive to containing a row of buttons. Any supplied buttons are
* buttons. * 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 * Creates a {@link JPanel} that is configured with an {@link HGroupLayout} with a
* HGroupLayout} with a configuration conducive to containing a row of * configuration conducive to containing a row of buttons. Any supplied buttons are added to
* buttons. The supplied button is added to the box. * the box.
*/ */
public static JPanel makeButtonBox ( public static JPanel makeButtonBox (Justification justification, JComponent... buttons)
Justification justification, JComponent button)
{ {
JPanel box = new JPanel(new HGroupLayout(NONE, justification)); JPanel box = new JPanel(new HGroupLayout(NONE, justification));
if (button != null) { for (JComponent button : buttons) {
box.add(button); box.add(button);
box.setOpaque(false); box.setOpaque(false);
} }