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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user