Java Doc for BasicOptionPaneUI.java in  » 6.0-JDK-Core » swing » javax » swing » plaf » basic » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » swing » javax.swing.plaf.basic 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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 PropertyChangeHandler implements PropertyChangeListener
Inner Class :public class ButtonActionListener implements ActionListener

Field Summary
final public static  intMinimumHeight
    
final public static  intMinimumWidth
    
protected  booleanhasCustomComponents
     This is set to true in validateComponent if a Component is contained in either the message or the buttons.
protected  ComponentinitialFocusComponent
     Component to receive focus when messaged with selectInitialValue.
protected  JComponentinputComponent
     JComponent provide for input if optionPane.getWantsInput() returns true.
protected  DimensionminimumSize
    
protected  JOptionPaneoptionPane
     JOptionPane that the receiver is providing the look and feel for.
protected  PropertyChangeListenerpropertyChangeListener
    


Method Summary
protected  voidaddButtonComponents(Container container, Object[] buttons, int initialIndex)
     Creates the appropriate object to represent each of the objects in buttons and adds it to container.
protected  voidaddIcon(Container top)
     Creates and adds a JLabel representing the icon returned from getIcon to top.
protected  voidaddMessageComponents(Container container, GridBagConstraints cons, Object msg, int maxll, boolean internallyCreated)
     Creates the appropriate object to represent msg and places it into container.
protected  voidburstStringInto(Container c, String d, int maxll)
     Recursively creates new JLabel instances to represent d.
public  booleancontainsCustomComponents(JOptionPane op)
     Returns true if in the last call to validateComponent the message or buttons contained a subclass of Component.
protected  ActionListenercreateButtonActionListener(int buttonIndex)
    
protected  ContainercreateButtonArea()
     Creates and returns a Container containing the buttons.
protected  LayoutManagercreateLayoutManager()
    
protected  ContainercreateMessageArea()
     Messaged from installComponents to create a Container containing the body of the message.
protected  PropertyChangeListenercreatePropertyChangeListener()
    
protected  ContainercreateSeparator()
    
public static  ComponentUIcreateUI(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  IcongetIcon()
     Returns the icon from the JOptionPane the receiver is providing the look and feel for, or the default icon as returned from getDefaultIcon.
protected  IcongetIconForType(int messageType)
     Returns the icon to use for the passed in type.
protected  intgetInitialValueIndex()
     Returns the initial index into the buttons to select.
 InputMapgetInputMap(int condition)
    
protected  intgetMaxCharactersPerLineCount()
     Returns the maximum number of characters to place on a line.
protected  ObjectgetMessage()
     Returns the message to display from the JOptionPane the receiver is providing the look and feel for.
public  DimensiongetMinimumOptionPaneSize()
     Returns the minimum size the option pane should be.
public  DimensiongetPreferredSize(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  booleangetSizeButtonsToSameWidth()
     Returns true, basic L&F wants all the buttons to have the same width.
protected  voidinstallComponents()
    
protected  voidinstallDefaults()
    
protected  voidinstallKeyboardActions()
    
protected  voidinstallListeners()
    
public  voidinstallUI(JComponent c)
     Installs the receiver as the L&F for the passed in JOptionPane.
static  voidloadActionMap(LazyActionMap map)
    
protected  voidresetInputValue()
     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  voidselectInitialValue(JOptionPane op)
    
protected  voiduninstallComponents()
    
protected  voiduninstallDefaults()
    
protected  voiduninstallKeyboardActions()
    
protected  voiduninstallListeners()
    
public  voiduninstallUI(JComponent c)
     Removes the receiver from the L&F controller of the passed in split pane.

Field Detail
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.



minimumSize
protected Dimension minimumSize(Code)



optionPane
protected JOptionPane optionPane(Code)
JOptionPane that the receiver is providing the look and feel for.



propertyChangeListener
protected PropertyChangeListener propertyChangeListener(Code)





Method Detail
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.



createLayoutManager
protected LayoutManager createLayoutManager()(Code)



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.



createPropertyChangeListener
protected PropertyChangeListener createPropertyChangeListener()(Code)



createSeparator
protected Container createSeparator()(Code)



createUI
public static ComponentUI createUI(JComponent x)(Code)
Creates a new BasicOptionPaneUI instance.



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.



getInputMap
InputMap getInputMap(int condition)(Code)



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.



loadActionMap
static void loadActionMap(LazyActionMap map)(Code)



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.



Methods inherited from javax.swing.plaf.OptionPaneUI
abstract public boolean containsCustomComponents(JOptionPane op)(Code)(Java Doc)
abstract public void selectInitialValue(JOptionPane op)(Code)(Java Doc)

Methods inherited from javax.swing.plaf.ComponentUI
public boolean contains(JComponent c, int x, int y)(Code)(Java Doc)
public static ComponentUI createUI(JComponent c)(Code)(Java Doc)
public Accessible getAccessibleChild(JComponent c, int i)(Code)(Java Doc)
public int getAccessibleChildrenCount(JComponent c)(Code)(Java Doc)
public int getBaseline(JComponent c, int width, int height)(Code)(Java Doc)
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)(Code)(Java Doc)
public Dimension getMaximumSize(JComponent c)(Code)(Java Doc)
public Dimension getMinimumSize(JComponent c)(Code)(Java Doc)
public Dimension getPreferredSize(JComponent c)(Code)(Java Doc)
public void installUI(JComponent c)(Code)(Java Doc)
public void paint(Graphics g, JComponent c)(Code)(Java Doc)
public void uninstallUI(JComponent c)(Code)(Java Doc)
public void update(Graphics g, JComponent c)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.