| |
|
| java.lang.Object javax.swing.plaf.ComponentUI javax.swing.plaf.OptionPaneUI javax.swing.plaf.basic.BasicOptionPaneUI
All known Subclasses: javax.swing.plaf.synth.SynthOptionPaneUI,
BasicOptionPaneUI | public class BasicOptionPaneUI extends OptionPaneUI (Code) | | 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.
version: 1.67 05/05/07 author: James Gosling author: Scott Violet author: Amy Fowler |
Inner Class :public static class ButtonAreaLayout implements LayoutManager | |
Inner Class :public class ButtonActionListener implements ActionListener | |
Method Summary | |
protected void | addButtonComponents(Container container, Object[] buttons, int initialIndex) Creates the appropriate object to represent each of the objects in
buttons and adds it to container . | protected void | addIcon(Container top) Creates and adds a JLabel representing the icon returned from
getIcon to top . | protected void | addMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated) Creates the appropriate object to represent msg and
places it into container . | protected void | burstStringInto(Container c, String d, int maxll) Recursively creates new JLabel instances to represent d . | public boolean | containsCustomComponents(JOptionPane op) Returns true if in the last call to validateComponent the message
or buttons contained a subclass of Component. | protected ActionListener | createButtonActionListener(int buttonIndex) | protected Container | createButtonArea() Creates and returns a Container containing the buttons. | protected LayoutManager | createLayoutManager() | protected Container | createMessageArea() Messaged from installComponents to create a Container containing the
body of the message. | protected PropertyChangeListener | createPropertyChangeListener() | protected Container | createSeparator() | public static ComponentUI | createUI(JComponent x) Creates a new BasicOptionPaneUI instance. | protected Object[] | getButtons() Returns the buttons to display from the JOptionPane the receiver is
providing the look and feel for. | protected Icon | getIcon() Returns the icon from the JOptionPane the receiver is providing
the look and feel for, or the default icon as returned from
getDefaultIcon . | protected Icon | getIconForType(int messageType) Returns the icon to use for the passed in type. | protected int | getInitialValueIndex() Returns the initial index into the buttons to select. | InputMap | getInputMap(int condition) | protected int | getMaxCharactersPerLineCount() Returns the maximum number of characters to place on a line. | protected Object | getMessage() Returns the message to display from the JOptionPane the receiver is
providing the look and feel for. | public Dimension | getMinimumOptionPaneSize() Returns the minimum size the option pane should be. | public Dimension | getPreferredSize(JComponent c) 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 . | protected boolean | getSizeButtonsToSameWidth() Returns true, basic L&F wants all the buttons to have the same
width. | protected void | installComponents() | protected void | installDefaults() | protected void | installKeyboardActions() | protected void | installListeners() | public void | installUI(JComponent c) Installs the receiver as the L&F for the passed in
JOptionPane . | static void | loadActionMap(LazyActionMap map) | protected void | resetInputValue() Sets the input value in the option pane the receiver is providing
the look and feel for based on the value in the inputComponent. | public void | selectInitialValue(JOptionPane op) | protected void | uninstallComponents() | protected void | uninstallDefaults() | protected void | uninstallKeyboardActions() | protected void | uninstallListeners() | public void | uninstallUI(JComponent c) Removes the receiver from the L&F controller of the passed in split
pane. |
MinimumHeight | final public static int MinimumHeight(Code) | | |
MinimumWidth | final public static int MinimumWidth(Code) | | |
hasCustomComponents | protected boolean hasCustomComponents(Code) | | This is set to true in validateComponent if a Component is contained
in either the message or the buttons.
|
initialFocusComponent | protected Component initialFocusComponent(Code) | | Component to receive focus when messaged with selectInitialValue.
|
inputComponent | protected JComponent inputComponent(Code) | | JComponent provide for input if optionPane.getWantsInput() returns
true.
|
optionPane | protected JOptionPane optionPane(Code) | | JOptionPane that the receiver is providing the
look and feel for.
|
addButtonComponents | protected void addButtonComponents(Container container, Object[] buttons, int initialIndex)(Code) | | 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.
|
addIcon | protected void addIcon(Container top)(Code) | | Creates and adds a JLabel representing the icon returned from
getIcon to top . This is messaged from
createMessageArea
|
addMessageComponents | protected void addMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)(Code) | | 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).
|
burstStringInto | protected void burstStringInto(Container c, String d, int maxll)(Code) | | Recursively creates new JLabel instances to represent d .
Each JLabel instance is added to c .
|
containsCustomComponents | public boolean containsCustomComponents(JOptionPane op)(Code) | | Returns true if in the last call to validateComponent the message
or buttons contained a subclass of Component.
|
createButtonActionListener | protected ActionListener createButtonActionListener(int buttonIndex)(Code) | | |
createButtonArea | protected Container createButtonArea()(Code) | | Creates and returns a Container containing the buttons. The buttons
are created by calling getButtons .
|
createMessageArea | protected Container createMessageArea()(Code) | | Messaged from installComponents to create a Container containing the
body of the message. The icon is the created by calling
addIcon .
|
getButtons | protected Object[] getButtons()(Code) | | 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.
|
getIcon | protected Icon getIcon()(Code) | | Returns the icon from the JOptionPane the receiver is providing
the look and feel for, or the default icon as returned from
getDefaultIcon .
|
getIconForType | protected Icon getIconForType(int messageType)(Code) | | Returns the icon to use for the passed in type.
|
getInitialValueIndex | protected int getInitialValueIndex()(Code) | | 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.
|
getMaxCharactersPerLineCount | protected int getMaxCharactersPerLineCount()(Code) | | Returns the maximum number of characters to place on a line.
|
getMessage | protected Object getMessage()(Code) | | Returns the message to display from the JOptionPane the receiver is
providing the look and feel for.
|
getMinimumOptionPaneSize | public Dimension getMinimumOptionPaneSize()(Code) | | Returns the minimum size the option pane should be. Primarily
provided for subclassers wishing to offer a different minimum size.
|
getPreferredSize | public Dimension getPreferredSize(JComponent c)(Code) | | 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 .
|
getSizeButtonsToSameWidth | protected boolean getSizeButtonsToSameWidth()(Code) | | Returns true, basic L&F wants all the buttons to have the same
width.
|
installComponents | protected void installComponents()(Code) | | |
installDefaults | protected void installDefaults()(Code) | | |
installKeyboardActions | protected void installKeyboardActions()(Code) | | |
installListeners | protected void installListeners()(Code) | | |
installUI | public void installUI(JComponent c)(Code) | | Installs the receiver as the L&F for the passed in
JOptionPane .
|
resetInputValue | protected void resetInputValue()(Code) | | Sets the input value in the option pane the receiver is providing
the look and feel for based on the value in the inputComponent.
|
selectInitialValue | public void selectInitialValue(JOptionPane op)(Code) | | If inputComponent is non-null, the focus is requested on that,
otherwise request focus on the default value
|
uninstallComponents | protected void uninstallComponents()(Code) | | |
uninstallDefaults | protected void uninstallDefaults()(Code) | | |
uninstallKeyboardActions | protected void uninstallKeyboardActions()(Code) | | |
uninstallListeners | protected void uninstallListeners()(Code) | | |
uninstallUI | public void uninstallUI(JComponent c)(Code) | | Removes the receiver from the L&F controller of the passed in split
pane.
|
|
|
|