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.


Class Index

 o AbstractOptionPaneUI.SyncingLayoutManager
SyncingLayoutManager acts similiar to FlowLayout.

Variable Index

 o hasCustomComponents
This is set to true in validateComponent if a Component is contained in either the message or the buttons.
 o initialFocusComponent
Component to receive focus when messaged with selectInitialValue.

Constructor Index

 o AbstractOptionPaneUI()

Method Index

 o addIcon(Container)
Creates and adds a JLabel representing the icon returned from getIcon to top.
 o appendButtons(Container, Object[], int)
Creates the appropriate object to represent each of the objects in buttons and adds it to container.
 o appendDescription(Container, GridBagConstraints, Object, int, boolean)
Creates the appropriate object to represent d and places it into container.
 o burstStringInto(Container, String, int)
Recursively creates new JLabel instances to represent d.
 o containsCustomComponents()
Returns true if in the last call to validateComponent the message or buttons contained a subclass of Component.
 o createBody()
Messaged from validateComponent to create a Container containing the body of the message.
 o createButtons()
Creates and returns a Container containin the buttons.
 o createdButtonFired(int)
Invoked when a button that was created in appendButtons has been pressed.
 o emptyContainer(Container)
Messaged from validateComponent to remove all the components from container.
 o getBodyInsets()
Returns the insets to be used for the body, the body contains both the image and the actual message.
 o getButtonInsets()
Returns the insets to be used in the Container housing the buttons.
 o getButtons()
Returns the buttons to display.
 o getContainer()
Returns the Container to place all the Components in.
 o getIcon()
Icon to display, null implies no Icon.
 o getInitialIndex()
Returns the initial index into buttons to select.
 o getMaxCharactersPerLineCount()
Returns the maximum number of characters to place on a line.
 o getMessage()
Returns the message to display.
 o getSizeButtonsToSameWidth()
Returns false.
 o selectInitialValue()
Requests focus on the initial value.
 o validateComponent()
Removes all the components from the Container, adds the icon, message and buttons.

Variables

 o initialFocusComponent
protected Component initialFocusComponent
Component to receive focus when messaged with selectInitialValue.

 o hasCustomComponents
protected boolean hasCustomComponents
This is set to true in validateComponent if a Component is contained in either the message or the buttons.

Constructors

 o AbstractOptionPaneUI
public AbstractOptionPaneUI()

Methods

 o getIcon
public abstract Icon getIcon()
Icon to display, null implies no Icon.

 o getMessage
public abstract Object getMessage()
Returns the message to display.

 o getButtons
public abstract Object[] getButtons()
Returns the buttons to display.

 o getContainer
public abstract Container getContainer()
Returns the Container to place all the Components in.

 o getInitialIndex
public abstract int getInitialIndex()
Returns the initial index into buttons to select.

 o getSizeButtonsToSameWidth
public boolean getSizeButtonsToSameWidth()
Returns false. This is queried to determine if the buttons should be sized to the same width.

 o 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
 o 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.

 o selectInitialValue
public void selectInitialValue()
Requests focus on the initial value.

Overrides:
selectInitialValue in class OptionPaneUI
 o 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.

 o 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).

 o 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.

 o 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 buttonsarray that was passed into appendButtons.

 o 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.

 o addIcon
protected void addIcon(Container top)
Creates and adds a JLabel representing the icon returned from getIcon to top. This is messaged from createBody

 o 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.

 o getButtonInsets
protected Insets getButtonInsets()
Returns the insets to be used in the Container housing the buttons.

 o getBodyInsets
protected Insets getBodyInsets()
Returns the insets to be used for the body, the body contains both the image and the actual message.

 o createButtons
protected Container createButtons()
Creates and returns a Container containin the buttons. The buttons are created by calling getButtons.

 o 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