public class BasicOptionPaneUI extends OptionPaneUI
Modifier and Type | Class and Description |
---|---|
class |
BasicOptionPaneUI.ButtonActionListener
This is a helper class that listens to the buttons located at the bottom
of the JOptionPane.
|
static class |
BasicOptionPaneUI.ButtonAreaLayout
This helper layout manager is responsible for the layout of the button
area.
|
class |
BasicOptionPaneUI.PropertyChangeHandler
This helper class handles property change events from the JOptionPane.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
hasCustomComponents
Whether the JOptionPane contains custom components.
|
protected Component |
initialFocusComponent
The button that will receive focus based on initialValue when no input
component is present.
|
protected JComponent |
inputComponent
The component that receives input when the JOptionPane needs it.
|
static int |
MinimumHeight
The minimum height for JOptionPanes.
|
protected Dimension |
minimumSize
The minimum dimensions of the JOptionPane.
|
static int |
MinimumWidth
The minimum width for JOptionPanes.
|
protected JOptionPane |
optionPane
The JOptionPane this UI delegate is used for.
|
protected PropertyChangeListener |
propertyChangeListener
The propertyChangeListener for the JOptionPane.
|
Constructor and Description |
---|
BasicOptionPaneUI()
Creates a new BasicOptionPaneUI object.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addButtonComponents(Container container,
Object[] buttons,
int initialIndex)
This method is messaged to add the buttons to the given container.
|
protected void |
addIcon(Container top)
This method adds the appropriate icon the given container.
|
protected void |
addMessageComponents(Container container,
GridBagConstraints cons,
Object msg,
int maxll,
boolean internallyCreated)
This method creates the proper object (if necessary) to represent msg.
|
protected void |
burstStringInto(Container c,
String d,
int maxll)
This method creates instances of d (recursively if necessary based on
maxll) and adds to c.
|
boolean |
containsCustomComponents(JOptionPane op)
This method returns true if the given JOptionPane contains custom
components.
|
protected ActionListener |
createButtonActionListener(int buttonIndex)
This method creates a button action listener for the given button index.
|
protected Container |
createButtonArea()
This method creates the button area.
|
protected LayoutManager |
createLayoutManager()
This method creates a new LayoutManager for the button area.
|
protected Container |
createMessageArea()
This method creates the message area.
|
protected PropertyChangeListener |
createPropertyChangeListener()
This method creates a new PropertyChangeListener for listening to the
JOptionPane.
|
protected Container |
createSeparator()
This method creates a Container that will separate the message and button
areas.
|
static ComponentUI |
createUI(JComponent x)
This method creates a new BasicOptionPaneUI for the given component.
|
protected Object[] |
getButtons()
This method returns the buttons for the JOptionPane.
|
protected Icon |
getIcon()
This method will return the icon the user has set or the icon that will
be used based on message type.
|
protected Icon |
getIconForType(int messageType)
This method returns the icon for the given messageType.
|
protected int |
getInitialValueIndex()
This method returns the index of the initialValue in the options array.
|
protected int |
getMaxCharactersPerLineCount()
This method returns the maximum number of characters that should be
placed on a line.
|
Dimension |
getMaximumSize(JComponent c)
This method returns the maximum size.
|
protected Object |
getMessage()
This method returns the message of the JOptionPane.
|
Dimension |
getMinimumOptionPaneSize()
This method returns the minimum size of the JOptionPane.
|
Dimension |
getMinimumSize(JComponent c)
This method returns the minimum size.
|
Dimension |
getPreferredSize(JComponent c)
This method returns the preferred size of the JOptionPane.
|
protected boolean |
getSizeButtonsToSameWidth()
This method returns whether all buttons should have the same width.
|
protected void |
installComponents()
This method installs components for the JOptionPane.
|
protected void |
installDefaults()
This method installs defaults for the JOptionPane.
|
protected void |
installKeyboardActions()
This method installs keyboard actions for the JOptionpane.
|
protected void |
installListeners()
This method installs listeners for the JOptionPane.
|
void |
installUI(JComponent c)
This method installs the UI for the JOptionPane.
|
protected void |
resetInputValue()
Changes the inputValue property in the JOptionPane based on the current
value of the inputComponent.
|
void |
selectInitialValue(JOptionPane op)
This method requests focus to the inputComponent (if one is present) and
the initialFocusComponent otherwise.
|
protected void |
uninstallComponents()
This method uninstalls all the components in the JOptionPane.
|
protected void |
uninstallDefaults()
This method uninstalls the defaults for the JOptionPane.
|
protected void |
uninstallKeyboardActions()
This method uninstalls keyboard actions for the JOptionPane.
|
protected void |
uninstallListeners()
This method uninstalls listeners for the JOptionPane.
|
void |
uninstallUI(JComponent c)
This method uninstalls the UI for the given JComponent.
|
contains, getAccessibleChild, getAccessibleChildrenCount, paint, update
public static final int MinimumWidth
public static final int MinimumHeight
protected boolean hasCustomComponents
protected Component initialFocusComponent
protected JComponent inputComponent
protected Dimension minimumSize
protected PropertyChangeListener propertyChangeListener
protected JOptionPane optionPane
public BasicOptionPaneUI()
protected void addButtonComponents(Container container, Object[] buttons, int initialIndex)
container
- The container to add components to.buttons
- The buttons to add. (If it is an instance of component,
the Object is added directly. If it is an instance of Icon, it is
packed into a label and added. For all other cases, the string
representation of the Object is retreived and packed into a
label.)initialIndex
- The index of the component that is the initialValue.protected void addIcon(Container top)
top
- The container to add an icon to.protected void addMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)
container
- The container to add to.cons
- The constraints when adding.msg
- The message to add.maxll
- The max line length.internallyCreated
- Whether the msg is internally created.protected void burstStringInto(Container c, String d, int maxll)
c
- The container to add to.d
- The string to burst.maxll
- The max line length.public boolean containsCustomComponents(JOptionPane op)
containsCustomComponents
in class OptionPaneUI
op
- The JOptionPane to check.protected ActionListener createButtonActionListener(int buttonIndex)
buttonIndex
- The index of the button in components.protected Container createButtonArea()
protected LayoutManager createLayoutManager()
protected Container createMessageArea()
protected PropertyChangeListener createPropertyChangeListener()
protected Container createSeparator()
public static ComponentUI createUI(JComponent x)
x
- The component to create a UI for.protected Object[] getButtons()
protected Icon getIcon()
protected Icon getIconForType(int messageType)
messageType
- The type of message.protected int getInitialValueIndex()
protected int getMaxCharactersPerLineCount()
public Dimension getMaximumSize(JComponent c)
getMaximumSize
in class ComponentUI
c
- The JComponent to measure.protected Object getMessage()
public Dimension getMinimumOptionPaneSize()
public Dimension getMinimumSize(JComponent c)
getMinimumSize
in class ComponentUI
c
- The JComponent to measure.public Dimension getPreferredSize(JComponent c)
getPreferredSize
in class ComponentUI
c
- The JComponent to measure.protected boolean getSizeButtonsToSameWidth()
protected void installComponents()
protected void installDefaults()
protected void installKeyboardActions()
protected void installListeners()
public void installUI(JComponent c)
installUI
in class ComponentUI
c
- The JComponent to install the UI for.ComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
protected void resetInputValue()
public void selectInitialValue(JOptionPane op)
selectInitialValue
in class OptionPaneUI
op
- The JOptionPane.protected void uninstallComponents()
protected void uninstallDefaults()
protected void uninstallKeyboardActions()
protected void uninstallListeners()
public void uninstallUI(JComponent c)
uninstallUI
in class ComponentUI
c
- The JComponent to uninstall for.ComponentUI.installUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()