|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.jidesoft.dialog.ButtonPanel
public class ButtonPanel
ButtonPanel
can help to layout buttons easily in any dialogs.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
AFFIRMATIVE_BUTTON
The button will produce an affirmative action. |
static String |
CANCEL_BUTTON
The button will produce a cancel action. |
static String |
HELP_BUTTON
The button will open some help windows. |
static String |
KEEP_PREFERRED_WIDTH
Client property key. |
static int |
NO_LESS_THAN
This option will make all buttons no less than a certain size. |
static String |
OTHER_BUTTON
The button will produce an alternative action different neither an affirmative or cancel action. |
static int |
SAME_SIZE
This option will make all buttons have the same size. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface com.jidesoft.dialog.ButtonNames |
---|
APPLY, BACK, BROWSE, CANCEL, CLEAR, CLOSE, DETAILS, EDIT, EXIT, FIND, FIND_NEXT, FINISH, FORWARD, HELP, NEW, NEXT, NO, OK, OPEN, PRINT, REPLACE, RESET, RETRY, RUN, SAVE, SAVE_AS, STOP, YES |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
ButtonPanel()
Constructs a new ButtonPanel with right alignment. |
|
ButtonPanel(int alignment)
Constructs a new ButtonPanel with the specified alignment. |
|
ButtonPanel(int alignment,
int sizeConstrains)
Constructs a new ButtonPanel with default horizontal spacing and the given alignment. |
Method Summary | |
---|---|
void |
addButton(AbstractButton button)
Adds button to ButtonPanel as AFFIRMATIVE_BUTTON. |
void |
addButton(AbstractButton button,
int index)
Adds button to ButtonPanel with specified type. |
void |
addButton(AbstractButton button,
Object constraint)
Adds button to ButtonPanel with specified constraint. |
void |
addButton(AbstractButton button,
Object constraint,
int index)
Adds button to ButtonPanel with specified type. |
protected void |
addImpl(Component comp,
Object constraints,
int index)
|
void |
addNotify()
|
void |
buttonEventFired(ButtonEvent e)
Invoked when the target of the listener request button to change state. |
int |
getAlignment()
Gets the alignment of the ButtonPanel. |
Component |
getButtonByName(String name)
Gets the button with the name. |
int |
getButtonGap()
Gets the gap between two buttons in the same group. |
String |
getButtonOrder()
Gets the button order. |
int |
getGroupGap()
Gets the gap between two button groups. |
int |
getMinButtonWidth()
Gets the minimum button width. |
String |
getOppositeButtonOrder()
Gets the opposite button order. |
int |
getSizeConstraint()
Gets the size constraint. |
protected void |
reinstallDefaults()
|
void |
removeButton(AbstractButton button)
Removes the button. |
void |
setAlignment(int alignment)
Sets the alignment. |
void |
setButtonGap(int buttonGap)
Sets the gap between two buttons in the same group. |
void |
setButtonOrder(String buttonOrder)
Sets the button order. |
void |
setGroupGap(int groupGap)
Sets the gap between two button groups. |
void |
setMinButtonWidth(int minButtonWidth)
Sets the minimum button width. |
void |
setOppositeButtonOrder(String oppositeButtonOrder)
Sets the opposite button order. |
void |
setSizeConstraint(int sizeConstrains)
Sets the size constraint. |
void |
updateUI()
|
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SAME_SIZE
public static final int NO_LESS_THAN
public static final String KEEP_PREFERRED_WIDTH
public static final String AFFIRMATIVE_BUTTON
addButton(javax.swing.AbstractButton, Object)
method.
public static final String CANCEL_BUTTON
addButton(javax.swing.AbstractButton, Object)
method.
public static final String HELP_BUTTON
addButton(javax.swing.AbstractButton, Object)
method.
public static final String OTHER_BUTTON
addButton(javax.swing.AbstractButton, Object)
method.
Constructor Detail |
---|
public ButtonPanel()
ButtonPanel
with right alignment.
public ButtonPanel(int alignment)
ButtonPanel
with the specified alignment.
alignment
- the alignment. The supported alignment are SwingConstants.RIGHT
, SwingConstants.LEFT
, SwingConstants.CENTER
, SwingConstants.TOP
or SwingConstants.BOTTOM
.public ButtonPanel(int alignment, int sizeConstrains)
ButtonPanel
with default horizontal spacing and the given alignment.
alignment
- the alignment of the buttons. It can be one of SwingConstants.LEFT
or
SwingConstants.RIGHT
or SwingConstants.TOP
or
SwingConstants.BOTTOM
or SwingConstants.CENTER
.sizeConstrains
- size constraint of the button. It can be either SAME_SIZE
or
NO_LESS_THAN
Method Detail |
---|
public void updateUI()
updateUI
in class JPanel
protected void reinstallDefaults()
public void setAlignment(int alignment)
alignment
- the alignment. The supported alignment are SwingConstants.RIGHT
, SwingConstants.LEFT
, SwingConstants.CENTER
, SwingConstants.TOP
or SwingConstants.BOTTOM
.public int getAlignment()
public void addButton(AbstractButton button)
button
- a buttonpublic void addButton(AbstractButton button, int index)
button
- a button.index
- the position in the button panel's list at which to insert the component; -1 means insert at the
end componentpublic void addButton(AbstractButton button, Object constraint)
AFFIRMATIVE_BUTTON
,
CANCEL_BUTTON
,OTHER_BUTTON
and HELP_BUTTON
. The main purpose of the constraints is to
determine how the buttons are laid out on different platforms according to the OS convention. For example, on
Windows, AFFIRMATIVE_BUTTON appears on the right hand side of CANCEL_BUTTON. On Mac OS X, AFFIRMATIVE_BUTTON will
appear on the left hand side of CANCEL_BUTTON.
button
- a button.constraint
- one of constraints.public void addButton(AbstractButton button, Object constraint, int index)
button
- a button.constraint
- String of one of types.index
- the position in the button panel's list at which to insert the component; -1 means insert at
the end componentprotected void addImpl(Component comp, Object constraints, int index)
addImpl
in class Container
public void removeButton(AbstractButton button)
Container.remove(java.awt.Component)
.
button
- a buttonpublic String getButtonOrder()
public void setButtonOrder(String buttonOrder)
buttonOrder
- the new button order.public String getOppositeButtonOrder()
public void setOppositeButtonOrder(String oppositeButtonOrder)
oppositeButtonOrder
- the new opposite button order.public int getSizeConstraint()
public void setSizeConstraint(int sizeConstrains)
NO_LESS_THAN
and SAME_SIZE
. The size constraint will
apply to all components except if the component client property KEEP_PREFERRED_WIDTH
is set
to Boolean.TRUE.
sizeConstrains
- the size constraint.public int getGroupGap()
public void setGroupGap(int groupGap)
groupGap
- the gap between button groups.public int getButtonGap()
public void setButtonGap(int buttonGap)
buttonGap
- the gap between buttons.public int getMinButtonWidth()
public void setMinButtonWidth(int minButtonWidth)
minButtonWidth
- the minimum button width.public void buttonEventFired(ButtonEvent e)
ButtonListener
buttonEventFired
in interface ButtonListener
e
- a ButtonEvent objectpublic void addNotify()
addNotify
in class JComponent
public Component getButtonByName(String name)
Component.setName(String)
method. Please note, the name is not the same as the constraint in the second
parameter of Container.add(java.awt.Component, Object)
.
name
- the button name.
IllegalArgumentException
- if the name is null or empty.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |