java.lang.Object | |||
↳ | javax.swing.plaf.ComponentUI | ||
↳ | javax.swing.plaf.OptionPaneUI | ||
↳ | javax.swing.plaf.basic.BasicOptionPaneUI |
![]() |
Provides the basic look and feel for a JOptionPane
.
BasicMessagePaneUI
provides a means to place an icon,
message and buttons into a Container
.
Generally, the layout will look like:
------------------ | i | message | | c | message | | o | message | | n | message | ------------------ | buttons | |________________|icon is an instance of
Icon
that is wrapped 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 above layout is used when the option pane's
ComponentOrientation
property is horizontal, left-to-right.
The layout will be adjusted appropriately for other orientations.
The Container
, message, icon, and buttons are all
determined from abstract methods.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
BasicOptionPaneUI.ButtonActionListener | This inner class is marked "public" due to a compiler bug. | ||||||||||
BasicOptionPaneUI.ButtonAreaLayout | ButtonAreaLayout behaves in a similar manner to
FlowLayout . |
||||||||||
BasicOptionPaneUI.PropertyChangeHandler | This inner class is marked "public" due to a compiler bug. |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | MinimumHeight | ||||||||||
int | MinimumWidth |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
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. | ||||||||||
inputComponent | JComponent provide for input if optionPane.getWantsInput() returns true. | ||||||||||
minimumSize | |||||||||||
optionPane | JOptionPane that the receiver is providing the
look and feel for. |
||||||||||
propertyChangeListener |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns true if in the last call to validateComponent the message
or buttons contained a subclass of Component.
| |||||||||||
Creates a new BasicOptionPaneUI instance.
| |||||||||||
Returns the minimum size the option pane should be.
| |||||||||||
If
c is the JOptionPane the receiver
is contained in, the preferred
size that is returned is the maximum of the preferred size of
the LayoutManager for the JOptionPane , and
getMinimumOptionPaneSize . | |||||||||||
Installs the receiver as the L&F for the passed in
JOptionPane . | |||||||||||
If inputComponent is non-null, the focus is requested on that,
otherwise request focus on the default value
| |||||||||||
Removes the receiver from the L&F controller of the passed in split
pane.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates the appropriate object to represent each of the objects in
buttons and adds it to container . | |||||||||||
Creates and adds a JLabel representing the icon returned from
getIcon to top . | |||||||||||
Creates the appropriate object to represent
msg and
places it into container . | |||||||||||
Recursively creates new JLabel instances to represent
d . | |||||||||||
Creates and returns a Container containing the buttons.
| |||||||||||
Messaged from installComponents to create a Container containing the
body of the message.
| |||||||||||
Returns the buttons to display from the JOptionPane the receiver is
providing the look and feel for.
| |||||||||||
Returns the icon from the JOptionPane the receiver is providing
the look and feel for, or the default icon as returned from
getDefaultIcon . | |||||||||||
Returns the icon to use for the passed in type.
| |||||||||||
Returns the initial index into the buttons to select.
| |||||||||||
Returns the maximum number of characters to place on a line.
| |||||||||||
Returns the message to display from the JOptionPane the receiver is
providing the look and feel for.
| |||||||||||
Returns true, basic L&F wants all the buttons to have the same
width.
| |||||||||||
Sets the input value in the option pane the receiver is providing
the look and feel for based on the value in the inputComponent.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
This is set to true in validateComponent if a Component is contained in either the message or the buttons.
Component to receive focus when messaged with selectInitialValue.
JComponent provide for input if optionPane.getWantsInput() returns true.
Returns true if in the last call to validateComponent the message or buttons contained a subclass of Component.
Returns the minimum size the option pane should be. Primarily provided for subclassers wishing to offer a different minimum size.
If c
is the JOptionPane
the receiver
is contained in, the preferred
size that is returned is the maximum of the preferred size of
the LayoutManager
for the JOptionPane
, and
getMinimumOptionPaneSize
.
c | the component whose preferred size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
---|
Installs the receiver as the L&F for the passed in
JOptionPane
.
c | the component where this UI delegate is being installed |
---|
If inputComponent is non-null, the focus is requested on that, otherwise request focus on the default value
Removes the receiver from the L&F controller of the passed in split pane.
c | the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
---|
Creates the appropriate object to represent each of the objects in
buttons
and adds it to container
. This
differs from addMessageComponents in that it will recurse on
buttons
and that if button is not a Component
it will create an instance of JButton.
Creates and adds a JLabel representing the icon returned from
getIcon
to top
. This is messaged from
createMessageArea
Creates the appropriate object to represent msg
and
places it into container
. If msg
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).
Recursively creates new JLabel instances to represent d
.
Each JLabel instance is added to c
.
Creates and returns a Container containing the buttons. The buttons
are created by calling getButtons
.
Messaged from installComponents to create a Container containing the
body of the message. The icon is the created by calling
addIcon
.
Returns the buttons to display from the JOptionPane the receiver is providing the look and feel for. If the JOptionPane has options set, they will be provided, otherwise if the optionType is YES_NO_OPTION, yesNoOptions is returned, if the type is YES_NO_CANCEL_OPTION yesNoCancelOptions is returned, otherwise defaultButtons are returned.
Returns the icon from the JOptionPane the receiver is providing
the look and feel for, or the default icon as returned from
getDefaultIcon
.
Returns the initial index into the buttons to select. The index is calculated from the initial value from the JOptionPane and options of the JOptionPane or 0.
Returns the maximum number of characters to place on a line.
Returns the message to display from the JOptionPane the receiver is providing the look and feel for.
Returns true, basic L&F wants all the buttons to have the same width.
Sets the input value in the option pane the receiver is providing the look and feel for based on the value in the inputComponent.