All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.swing.basic.AbstractOptionPaneUI
java.lang.Object
|
+----java.awt.swing.plaf.ComponentUI
|
+----java.awt.swing.plaf.OptionPaneUI
|
+----java.awt.swing.basic.AbstractOptionPaneUI
- public abstract class AbstractOptionPaneUI
- extends OptionPaneUI
- implements Serializable
AbstractMessagePaneUI provides a means to place an icon, message and
buttons into a Container. The layout will look like:
------------------
| i | message |
| c | message |
| o | message |
| n | message |
------------------
| buttons |
|________________|
icon is an instance of Icon that is wraped inside a JLabel.
The message is an opaque object and is tested for the following:
if the message is a Component it is added to the Container, if
it is an Icon it is wrapped inside a JLabel and added to the
Container otherwise it is wrapped inside a JLabel.
The Container, message, icon, and buttons are all determined from
abstract methods.
AbstractOptionPaneUI.SyncingLayoutManager- SyncingLayoutManager acts similiar to FlowLayout.
hasCustomComponents- This is set to true in validateComponent if a Component is contained
in either the message or the buttons.
initialFocusComponent- Component to receive focus when messaged with selectInitialValue.
AbstractOptionPaneUI()
-
addIcon(Container)
- Creates and adds a JLabel representing the icon returned from
getIcon
to top
.
appendButtons(Container, Object[], int)
- Creates the appropriate object to represent each of the objects in
buttons
and adds it to container
.
appendDescription(Container, GridBagConstraints, Object, int, boolean)
- Creates the appropriate object to represent
d
and
places it into container
.
burstStringInto(Container, String, int)
- Recursively creates new JLabel instances to represent
d
.
containsCustomComponents()
- Returns true if in the last call to validateComponent the message
or buttons contained a subclass of Component.
createBody()
- Messaged from validateComponent to create a Container containing the
body of the message.
createButtons()
- Creates and returns a Container containin the buttons.
createdButtonFired(int)
- Invoked when a button that was created in
appendButtons
has been pressed.
emptyContainer(Container)
- Messaged from
validateComponent
to remove all the
components from container
.
getBodyInsets()
- Returns the insets to be used for the body, the body contains both
the image and the actual message.
getButtonInsets()
- Returns the insets to be used in the Container housing the buttons.
getButtons()
- Returns the buttons to display.
getContainer()
- Returns the Container to place all the Components in.
getIcon()
- Icon to display, null implies no Icon.
getInitialIndex()
- Returns the initial index into buttons to select.
getMaxCharactersPerLineCount()
- Returns the maximum number of characters to place on a line.
getMessage()
- Returns the message to display.
getSizeButtonsToSameWidth()
- Returns false.
selectInitialValue()
- Requests focus on the initial value.
validateComponent()
- Removes all the components from the Container, adds the icon,
message and buttons.
initialFocusComponent
protected Component initialFocusComponent
- Component to receive focus when messaged with selectInitialValue.
hasCustomComponents
protected boolean hasCustomComponents
- This is set to true in validateComponent if a Component is contained
in either the message or the buttons.
AbstractOptionPaneUI
public AbstractOptionPaneUI()
getIcon
public abstract Icon getIcon()
- Icon to display, null implies no Icon.
getMessage
public abstract Object getMessage()
- Returns the message to display.
getButtons
public abstract Object[] getButtons()
- Returns the buttons to display.
getContainer
public abstract Container getContainer()
- Returns the Container to place all the Components in.
getInitialIndex
public abstract int getInitialIndex()
- Returns the initial index into buttons to select.
getSizeButtonsToSameWidth
public boolean getSizeButtonsToSameWidth()
- Returns false. This is queried to determine if the buttons should
be sized to the same width.
containsCustomComponents
public boolean containsCustomComponents()
- Returns true if in the last call to validateComponent the message
or buttons contained a subclass of Component.
- Overrides:
- containsCustomComponents in class OptionPaneUI
getMaxCharactersPerLineCount
public int getMaxCharactersPerLineCount()
- Returns the maximum number of characters to place on a line.
Default is to return Integer.MAX_VALUE. Concrete implementations
may want to return a value that means something.
selectInitialValue
public void selectInitialValue()
- Requests focus on the initial value.
- Overrides:
- selectInitialValue in class OptionPaneUI
burstStringInto
protected void burstStringInto(Container c,
String d,
int maxll)
- Recursively creates new JLabel instances to represent
d
.
Each JLabel instance is added to c
.
appendDescription
protected void appendDescription(Container container,
GridBagConstraints cons,
Object d,
int maxll,
boolean internallyCreated)
- Creates the appropriate object to represent
d
and
places it into container
. If d
is an
instance of Component, it is added directly, if it is an Icon,
a JLabel is created to represent it, otherwise a JLabel is
created for the string, if d
is an Object[], this
method will be recursively invoked for the children.
internallyCreated
is true if Objc is an instance
of Component and was created internally by this method (this is
used to correctly set hasCustomComponents only if !internallyCreated).
appendButtons
protected void appendButtons(Container container,
Object[] buttons,
int initialIndex)
- Creates the appropriate object to represent each of the objects in
buttons
and adds it to container
. This
differs from appendDescription in that it will recurse on
buttons
and that if button is not a Component
it will create an instance of JButton, that when pressed will
invoke createdButtonFired
with the appropriate
index.
createdButtonFired
protected void createdButtonFired(int buttonIndex)
- Invoked when a button that was created in
appendButtons
has been pressed. buttonIndex
identifies the index
of the button from the buttons
array that was passed
into appendButtons
.
emptyContainer
protected void emptyContainer(Container container)
- Messaged from
validateComponent
to remove all the
components from container
. This invokes removeAll
on container
, but is provided should subclasses wish
to not remove everything.
addIcon
protected void addIcon(Container top)
- Creates and adds a JLabel representing the icon returned from
getIcon
to top
. This is messaged from
createBody
createBody
protected Container createBody()
- Messaged from validateComponent to create a Container containing the
body of the message. The icon is the created by calling
addIcon
.
getButtonInsets
protected Insets getButtonInsets()
- Returns the insets to be used in the Container housing the buttons.
getBodyInsets
protected Insets getBodyInsets()
- Returns the insets to be used for the body, the body contains both
the image and the actual message.
createButtons
protected Container createButtons()
- Creates and returns a Container containin the buttons. The buttons
are created by calling
getButtons
.
validateComponent
protected void validateComponent()
- Removes all the components from the Container, adds the icon,
message and buttons.
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature