Generated by
JDiff

javax.swing Documentation Differences

This file contains all the changes in documentation in the package javax.swing as colored differences. Deletions are shown like this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.

Class AbstractAction

This class provides default implementations for the JFC Action interface. Standard behaviors like the get and set methods for Action object properties (icon text and enabled) are defined here. The developer need only subclass this abstract class and define the actionPerformed method.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.32 0441 02/2202/9900 @author Georges Saab @see Action

Class AbstractAction, constructor AbstractAction()

Defines an Action object with a default description string and default icon.
Class AbstractAction, constructor AbstractAction(String)

Defines an Action object with the specified description string and a default icon.
Class AbstractAction, constructor AbstractAction(String, Icon)

Defines an Action object with the specified description string and a the specified icon.
Class AbstractAction, void addPropertyChangeListener(PropertyChangeListener)

AddAdds a PropertyChangeListener to the listener list. The listener is registered for all properties.

A PropertyChangeEvent will get fired in response to setting a bound property e.g. setFont setBackground or setForeground. Note that if the current component is inheriting its foreground background or font from its container then no event will be fired in response to a change in the inherited property. @param listener The PropertyChangeListener to be added @see Action#addPropertyChangeListener

Class AbstractAction, Object clone()

CloneClones the abstract action. This gives the clone its own copy of the key/value list which is not handled for you by Object.clone().
Class AbstractAction, void firePropertyChange(String, Object, Object)

SupportSupports for reporting bound property changes. This method can be called when a bound property has changed and it will send the appropriate PropertyChangeEvent to any registered PropertyChangeListeners.
Class AbstractAction, Object getValue(String)

Gets the Object associated with the specified key. @param key a string containing the specified key @return the binding Object stored with this key; if there are no keys it will return null @see Action#getValue
Class AbstractAction, boolean isEnabled()

Returns true if the action is enabled. @return true if the action is enabled false otherwise @see Action#isEnabled
Class AbstractAction, void putValue(String, Object)

Sets the Value associated with the specified key. @param key the String that identifies the stored object @param newValue the Object to store using this key @see Action#putValue
Class AbstractAction, void removePropertyChangeListener(PropertyChangeListener)

RemoveRemoves a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. @param listener Thethe PropertyChangeListener to be removed @see Action#removePropertyChangeListener

Class AbstractButton

Defines the common behaviors for thebuttons and menu items. For further information JButtonsee JToggleButtonHow JCheckboxto Use Buttons Check Boxes and theRadio Buttons a section in The JRadioButtonJava classesTutorial.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.101 04130 03/2214/9900 @author Jeff Dinkins


Class AbstractButton.AccessibleAbstractButton

AccessiblityThis class implements accessibility support for the AbstractButton class. It provides an implementation of the Java Accessibility API appropriate to button and menu item user-interface elements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class AbstractButton.AccessibleAbstractButton, AccessibleAction getAccessibleAction()

Get the AccessibleAction associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleAction interface on behalf of itself. @return this object
Class AbstractButton.AccessibleAbstractButton, int getAccessibleActionCount()

Returns the number of Actions available in this object. If there is more than one the firstThe default behavior of a button is to have one is theaction - "default"toggle actionthe button. @return 1 the number of Actions in this object
Class AbstractButton.AccessibleAbstractButton, String getAccessibleName()

GetReturns the accessible name of this object. @return the localized name of the object -- can be null if this object does not have a name
Class AbstractButton.AccessibleAbstractButton, AccessibleValue getAccessibleValue()

Get the AccessibleValue associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object
Class AbstractButton.AccessibleAbstractButton, Number getMinimumAccessibleValue()

Get the minimum value of this object as a Number. @return Anan Integer of 0.

Class AbstractButton.ButtonChangeListener

ExtendExtends ChangeListener to be serializable.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class AbstractButton, void addActionListener(ActionListener)

addsAdds an ActionListener to the button. @param l the ActionListener to be added
Class AbstractButton, void addChangeListener(ChangeListener)

Adds a ChangeListener to the button. @param l the listener to be added
Class AbstractButton, void addItemListener(ItemListener)

addsAdds an ItemListener to the checkbox. @param l the ItemListener to be added
Class AbstractButton, int checkHorizontalKey(int, String)

Verify that key is a legal value for the horizontalAlignment properties. @param key the property value to check one of the following values: @param exception the IllegalArgumentException detail message @exception IllegalArgumentException if key isn'tis LEFT CENTER RIGHTnot one of LEADINGthe legal orvalues TRAILING.listed above @see #setHorizontalTextPosition @see #setHorizontalAlignment
Class AbstractButton, int checkVerticalKey(int, String)

Ensures that the key is a valid. Throws an IllegalArgumentIllegalArgumentException exception exception otherwise. @param key the value to check one of the following values: @param exception a string to be passed to the IllegalArgumentException call if key is not one of the valid values listed above @exception IllegalArgumentException if key is not one of the legal values listed above
Class AbstractButton, ChangeListener createChangeListener()

Subclasses that want to handle ChangeEvents differently can override this to return another ChangeListener implementation. @return the new ButtonChangeListener
Class AbstractButton, void doClick()

ProgramaticallyProgrammatically perform a "click". This does the same thing as if the user had pressed and released the button.
Class AbstractButton, void doClick(int)

ProgramaticallyProgrammatically perform a "click". This does the same thing as if the user had pressed and released the button. The button stays visually "pressed" for pressTime milliseconds. @param pressTime the time to "hold down" the button in milliseconds
Class AbstractButton, String getActionCommand()

Returns the action command for this button. @return the action command for this button
Class AbstractButton, Icon getDisabledIcon()

Returns the icon used by the button when it's disabled. If not no disabled icon has been set the button constructs one from the default icon. <-- PENDING(jeff): the disabled icon really should be created (if necesarynecessary) by the L&F.--> @return the disabledIcon property @see #getPressedIcon @see #setDisabledIcon
Class AbstractButton, Icon getDisabledSelectedIcon()

Returns the icon used by the button when it's disabled and selected. If not no disabled selection icon has been set the button constructs one from the selection icon. <-- PENDING(jeff): the disabled selection icon really should be created (if necesary) by the L&F. --> @return the disabledSelectedIcon property @see #getPressedIcon @see #setDisabledIcon
Class AbstractButton, int getHorizontalAlignment()

Returns the horizontal alignment of the icon and text. Valid@return keysthe horizontalAlignment property one of the following values: CENTER
Class AbstractButton, int getHorizontalTextPosition()

SetsReturns the horizontal position of the text relative to the icon. Valid@return keysthe horizontalTextPosition property one of the following values:
Class AbstractButton, Icon getIcon()

Returns the default icon. @return the default Icon @see #setIcon
Class AbstractButton, String getLabel()

Returns the label text. @return a String containing the label @deprecated - Replaced by getText()
Class AbstractButton, Insets getMargin()

Returns the margin between the button's border and the label. @return an Insets object specifying the margin between the botton's border and the label @see #setMargin
Class AbstractButton, int getMnemonic()

GetReturns the keyboard mnemonic from the the current model. @return the keyboard mnemonic from the model
Class AbstractButton, ButtonModel getModel()

GetReturns the model that this button represents. @return the model property @see #setModel
Class AbstractButton, Icon getPressedIcon()

Returns the pressed icon for the button. @return the pressedIcon property @see #setPressedIcon
Class AbstractButton, Icon getRolloverIcon()

Returns the rollover icon for the button. @return the rolloverIcon property @see #setRolloverIcon
Class AbstractButton, Icon getRolloverSelectedIcon()

Returns the rollover seletionselection icon for the button. @return the rolloverSelectedIcon property @see #setRolloverSelectedIcon
Class AbstractButton, Icon getSelectedIcon()

Returns the selected icon for the button. @return the selectedIcon property @see #setSelectedIcon
Class AbstractButton, Object[] getSelectedObjects()

Returns an array (length 1) containing the label or null if the button is not selected. @return an array containing 1 Object: -- the text of the button -- if the item is selected; otherwise null
Class AbstractButton, String getText()

Returns the button's text. @return the buttons text @see #setText
Class AbstractButton, ButtonUI getUI()

Returns the button'sL&F currentobject UIthat renders this component. @return the ButtonUI object @see #setUI
Class AbstractButton, int getVerticalAlignment()

Returns the vertical alignment of the text and icon. Valid@return keysthe verticalAlignment property one of the following values:
Class AbstractButton, int getVerticalTextPosition()

Returns the vertical position of the text relative to the icon. Valid@return keysthe verticalTextPosition property one of the following values:
Class AbstractButton, boolean imageUpdate(Image, int, int, int, int, int)

Repaints the component when the image has changed. This imageUpdate method of an ImageObserver is called when more informationoverridden about an image which had been previously requested using an asynchronousto routine such asreturn false if the drawImage method ofcurrent GraphicsIcon becomes available. See the definition's of imageUpdateImage for more information on thisis method and itsnot equal to arguments.the Thepassed in imageUpdateImage method of Componentimg incrementally draws an image on the component as more of the bits of the image are available. @param Ifimg the system property awt.image.incrementalDrawImage is missing or has theto valuebe truecompared the@param image is incrementally drawn Ifinfoflags flags used to repaint the system property has anybutton other value thenwhen the image is not drawn until it has been completely loaded. Also if incremental drawing is in effect the valueupdated of the system propertyand which determine how awt.image.redrawratemuch is interpreted as an integer to give the maximum redraw rate in milliseconds. If the system property is missing or cannot be interpreted as an integer the redraw rate is once every 100ms. The interpretation of the x y width and height arguments depends on the value of the infoflags argument. @param img the image being observed. @param infoflags see imageUpdate for more information.painted @param x the x coordinate. @param y the y coordinate. @param widthw the width. @param heighth the height. @return true if the flags indicate that the image is completely loaded; false otherwise. @see java.awt.image.ImageObserver @see java.awt.Graphics#drawImage(java.awt.Image int int java.awt.Color java.awt.image.ImageObserver) @see java.awt.Graphics#drawImage(java.awt.Image int int java.awt.image.ImageObserver) @see java.awt.Graphics#drawImage(java.awt.Image int int int int java.awt.Color java.awt.image.ImageObserver) @see java.awt.Graphics#drawImage(java.awt.Image int int int int java.awt.image.ImageObserver) @see java.awt.image.ImageObserverComponent#imageUpdate(java.awt.Image int int int int int) @since JDK1.0
Class AbstractButton, boolean isBorderPainted()

Returns whether the border should be painted. @return true if the border should be painted false otherwise @see #setBorderPainted
Class AbstractButton, boolean isContentAreaFilled()

Checks whether the "content area" of the button should be filled. @return the contentAreaFilled property @see #setFocusPainted
Class AbstractButton, boolean isFocusPainted()

Returns whether focus should be painted. @return the paintFocus property @see #setFocusPainted
Class AbstractButton, boolean isFocusTraversable()

Identifies whether or not this component can receive the focus. A disabled button for example would return false. @return true if this component can receive the focus
Class AbstractButton, boolean isRolloverEnabled()

Checks whether rollover effects are enabled. @return the rolloverEnabled property @see #setFocusPainted
Class AbstractButton, boolean isSelected()

Returns the state of the button. True if the toggle button is selected false if it's not. @return true if the toggle button is selected otherwise false
Class AbstractButton, void paintBorder(Graphics)

Paint the button's border if BorderPainted property is true. @param g the Graphics context in which to paint @see #paint @see #setBorder
Class AbstractButton, String paramString()

Returns a string representation of this AbstractButton. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overriding paramString() to provide information about the specific new aspects of the JFC components. @return a string representation of this AbstractButton.

Class AbstractButton, void removeActionListener(ActionListener)

removesRemoves an ActionListener from the button. If the listener is the currently set Action for the button then the Action is set to null. @param l the listener to be removed
Class AbstractButton, void removeChangeListener(ChangeListener)

Removes a ChangeListener from the button. @param l the listener to be removed
Class AbstractButton, void removeItemListener(ItemListener)

removesRemoves an ItemListener from the button. @param l the ItemListener to be removed
Class AbstractButton, void setActionCommand(String)

Sets the action command for this button. @param actionCommand the action command for this button
Class AbstractButton, void setBorderPainted(boolean)

Sets whether the border should be painted. @param b if true and border property is not null the border is painted. @see #isBorderPainted @beaninfo bound: true attribute: visualUpdate true description: Whether the border should be painted.
Class AbstractButton, void setContentAreaFilled(boolean)

Sets whether the button should paint the content area or leave it transparent. If you wish to have a transparent button for example and icon only button then you should set this to false. Do not call setOpaque(false). Whether the button follows the RepaintManager's concept of opacity is L&F depandant.

This function may cause the component's opaque property to change.

The exact behavior of calling this function varies on a component-by-component and L&F-by-L&F basis. @param b if true rollover effects should be painted. @see #isContentAreaFilled @see #setOpaque @beaninfo bound: true attribute: visualUpdate true description: Whether the button should paint the content area or leave it transparent.

Class AbstractButton, void setDisabledIcon(Icon)

Sets the disabled icon for the button. @param gdisabledIcon the icon used as the disabled image @see #getDisabledIcon @beaninfo bound: true attribute: visualUpdate true description: The disabled icon for the button.
Class AbstractButton, void setDisabledSelectedIcon(Icon)

Sets the disabled selection icon for the button. @param gdisabledSelectedIcon the icon used as the disabled selection image @see #getDisabledSelectedIcon @beaninfo bound: true attribute: visualUpdate true description: The disabled selection icon for the button.
Class AbstractButton, void setEnabled(boolean)

Enables (or disables) the button. @param b true to enable the button otherwise false
Class AbstractButton, void setFocusPainted(boolean)

Sets whether focus should be painted. @param b if true the focus state is painted. @see #isFocusPainted @beaninfo bound: true attribute: visualUpdate true description: Whether focus should be painted
Class AbstractButton, void setHorizontalAlignment(int)

Sets the horizontal alignment of the icon and text. Valid@param alignment one of the following keysvalues: CENTER @beaninfo bound: true enum: LEFT SwingConstants.LEFT CENTER SwingConstants.CENTER RIGHT SwingConstants.RIGHT LEADING SwingConstants.LEADING TRAILING SwingConstants.TRAILING attribute: visualUpdate true description: The horizontal alignment of the icon and text.
Class AbstractButton, void setHorizontalTextPosition(int)

Sets the horizontal position of the text relative to the icon. Valid keys: RIGHT (the default) LEFT CENTER LEADING TRAILING @exception IllegalArgumentExceptionparam textPosition @beaninfoone bound:of the true enumfollowing values: LEFT relative@exception to theIllegalArgumentException if icon.textPosition
Class AbstractButton, void setIcon(Icon)

Sets the button's default icon. This icon is also used as the "pressed" and "disabled" icon if there is no explicitly set pressed icon. @param gdefaultIcon the icon used as the default image @see #getIcon @see #setPressedIcon @beaninfo bound: true attribute: visualUpdate true description: The button's default icon
Class AbstractButton, void setLabel(String)

Sets the label text. @param label a String containing the text @deprecated - Replaced by setText(text) @beaninfo bound: true description: Replace by setText(text)
Class AbstractButton, void setMargin(Insets)

Sets space for margin between the button's border and the label. Setting to null will cause the button to use the default margin. The button's default Border object will use this value to create the proper margin. However if a non-default border is set on the button it is that Border object's responsibility to create the appropriate margin space (else this property will effectively be ignored). @param m the space between the border and the label @beaninfo bound: true attribute: visualUpdate true description: The space between the button's border and the label.
Class AbstractButton, void setMnemonic(char)

Specifies the mnemonic value. @param mnemonic a char specifying the mnemonic value @beaninfo bound: true attribute: visualUpdate true description: the keyboard character mnemonic
Class AbstractButton, void setMnemonic(int)

SetSets the keyboard mnemonic on the current model. @param mnemonic the key code which represents the mnemonic @beaninfo bound: true attribute: visualUpdate true description: the keyboard character mnemonic
Class AbstractButton, void setModel(ButtonModel)

SetSets the model that this button represents. @param m the Modelnew ButtonModel @see #getModel @beaninfo bound: true description: Model that the Button uses.
Class AbstractButton, void setPressedIcon(Icon)

Sets the pressed icon for the button. @param gpressedIcon the icon used as the "pressed" image @see #getPressedIcon @beaninfo bound: true attribute: visualUpdate true description: The pressed icon for the button.
Class AbstractButton, void setRolloverEnabled(boolean)

Sets whether rollover effects should be enabled. @param b if true rollover effects should be painted. @see #isRolloverEnabled @beaninfo bound: true attribute: visualUpdate true description: Whether rollover effects should be enabled.
Class AbstractButton, void setRolloverIcon(Icon)

Sets the rollover icon for the button. @param grolloverIcon the icon used as the "rollover" image @see #getRolloverIcon @beaninfo bound: true attribute: visualUpdate true description: The rollover icon for the button.
Class AbstractButton, void setRolloverSelectedIcon(Icon)

Sets the rollover selected icon for the button. @param grolloverSelectedIcon the icon used as the "selected rollover" image @see #getRolloverSelectedIcon @beaninfo bound: true attribute: visualUpdate true description: The rollover selected icon for the button.
Class AbstractButton, void setSelected(boolean)

Sets the state of the button. Note that this method does not trigger an actionEvent. Call doClick() to perform a programatic action change. @param b true if the button is selected otherwise false
Class AbstractButton, void setSelectedIcon(Icon)

Sets the selected icon for the button. @param gselectedIcon the icon used as the "selected" image @see #getSelectedIcon @beaninfo bound: true attribute: visualUpdate true description: The selected icon for the button.
Class AbstractButton, void setUI(ButtonUI)

Sets the button'sL&F UIobject that renders this component. @param ui the new ButtonUI L&F object @see #getUI
Class AbstractButton, void setVerticalAlignment(int)

Sets the vertical alignment of the icon and text. Valid@param alignment one of the following keysvalues: @beaninfo bound: true enum: TOP SwingConstants.TOP CENTER SwingConstants.CENTER BOTTOM SwingConstants.BOTTOM attribute: visualUpdate true description: The vertical alignment of the icon and text.
Class AbstractButton, void setVerticalTextPosition(int)

Sets the vertical position of the text relative to the icon. Valid@param alignment one of the following keysvalues: @beaninfo bound: true enum: TOP SwingConstants.TOP CENTER SwingConstants.CENTER BOTTOM SwingConstants.BOTTOM attribute: visualUpdate true description: The vertical position of the text relative to the icon.
Class AbstractButton, void updateUI()

GetsNotification a newfrom UIthe objectUIFactory fromthat the defaultL&F UIFactoryhas changed. Subtypes of AbstractButton should override this to update the UI. For example JButton might do the following:
 setUI((ButtonUI)UIManager.getUI( "ButtonUI" "javax.swing.plaf.basic.BasicButtonUI" this)); 
Class AbstractButton, String ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY

Identifies a change to the icon used when the cursrorcursor is over the button and it has been selected.
Class AbstractButton, ChangeEvent changeEvent

Only one ChangeEvent is needed per button instance since the event's only state is the source property. The source of events generated is always "this".
Class AbstractButton, ChangeListener changeListener

The button's model's listenerschangeListener.

Class AbstractListModel

The Abstract definition for the data model the provides a List with its contents.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.19 1022 02/2702/9800 @author Hans Muller


Class Action

The JFC Action interface provides a useful extension to the ActionListnerActionListener interface in cases where the same functionality may be accessed by several controls.

In addition to the actionPerformed method defined by the ActionListener interface this interface allows the application to define in a single place:

Containers in the SwingCertain set likecontainers including menus and toolbarstool bars know how to add an Action object as well as other components using a version of the addAction methodobject. When an Action object is added to such a container the container:
  1. Creates a component that is appropriate for that container (a toolbartool bar creates a button component for example).
  2. Gets the appropriate property(s) from the Action object to customize the component (for example the icon image and flyover text).
  3. Checks the intial state of the Action object to determine if it is enabled or disabled and renders the component in the appropriate fashion.
  4. Registers a listener with the Action object so that is notified of state changes. When the Action object changes from enabled to disabled or back the container makes the appropriate revisions to the event-generation mechanisms and renders the component accordingly.
For example both a menu item and a toolbar button could access a Cut action object. The text associated with the object is specified as "Cut" and an image depicting a pair of scissors is specified as its icon. The Cut action-object can then be added to a menu and to a toolbartool bar. Each container does the appropriate things with the object and invokes its actionPerformed method when the component associated with it is activated. The application can then disable or enable the application object without worrying about what user-interface components are connected to it.

This interface can be added to an existing class or used to create an adapter (typically by subclassing AbstractActionAbstractActio). The Action object can then be added to multiple action-aware containers and connected to Action-capable components. The GUI controls can then be activated or deactivated all at once by invoking the Action object's setEnabled method.

Note that Action implementations tend to be more expensive in terms of storage than a typical ActionListener which does not offer the benefits of centralized control of functionality and broadcast of property changes. For thisth is reason you should take care to only use ActionsActions where their benefits are desired and use a simple ActionListener where they are notActionListeners necessaryelsewhere. @version 1.1521 1002/3002/9800 @author Georges Saab @see AbstractAction

Class Action, void addPropertyChangeListener(PropertyChangeListener)

AddAdds a PropertyChange listener. Containers and attached components use these methods to register interest in this Action object. When its enabled state or other property changes the registered listeners are informed of the change. @param listener a PropertyChangeListener object ...
Class Action, boolean isEnabled()

SetsReturns the enabled state of the Action. When enabled any component associated with this object is active and able to fire this object's actionPerformed method. @return true if this Action is enabled
Class Action, void putValue(String, Object)

Sets one of this object's properties using the associated key. If the value has changed a PropertyChangeEvent is sent to listeners. @param key a String containing the key @param value an Object value
Class Action, void removePropertyChangeListener(PropertyChangeListener)

RemoveRemoves a PropertyChange listener. @param listener a PropertyChangeListener object ... @see #addPropertyChangeListener
Class Action, void setEnabled(boolean)

TestsSets the enabled state of the Action. When enabled any component associated with this object is active and able to fire this object's actionPerformed method. If the value has changed a PropertyChangeEvent is sent to listeners. @param b true to enable this Action false to disable it
Class Action, String DEFAULT

Useful constants that can be used as the storage-retreivalretrieval key when setting or getting one of this object's properties (text or icon).

Class BorderFactory

Factory class for vending standard Border objects. WhereeverWherever possible this factory will hand out references to shared Border instances. For further information and examples see How to Use Borders a section in The Java Tutorial. @version 1.15 1023 02/2002/9800 @author David Kloba
Class BorderFactory, Border createBevelBorder(int)

CreateCreates a beveled border of the specified type using brighter shades of the component's current background color for highlighting and darker shading for shadows. (In a lowered border shadows are on top and highlights are underneath.). @param type an intinteger specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDRAISED @return the Border object
Class BorderFactory, Border createBevelBorder(int, Color, Color)

CreateCreates a beveled border of the specified type using the specified highlighting and shadowing. The outer edge of the highlighted area uses a brighter shade of the highlight color. The inner edge of the shadow area uses a brighter shade of the shadawshadow color. @param type an intinteger specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDRAISED @param highlight a Color object for highlights @param shadow a Color object for shadows @return the Border object
Class BorderFactory, Border createBevelBorder(int, Color, Color, Color, Color)

CreateCreates a beveled border of the specified type using the specified colors for the inner and outer highlight and shadow areas. @param type an intinteger specifying either BevelBorder.LOWERED or BevelBorder.LOWEREDRAISED @param highlightOuter a Color object for the outer edge of the highlight area @param highlightInner a Color object for the inner edge of the highlight area @param shadowOuter a Color object for the outer edge of the shadow area @param shadowInner a Color object for the inner edge of the shadow area @return the Border object
Class BorderFactory, CompoundBorder createCompoundBorder()

CreateCreates a compound border with a null inside edge and a null outside edge. @return the CompoundBorder object
Class BorderFactory, CompoundBorder createCompoundBorder(Border, Border)

CreateCreates a compound border specifying the border objects to use for the outside and inside edges. @param outsideBorder a Border object for the outer edge of the compound border @param insideBorder a Border object for the inner edge of the compound border @return the CompoundBorder object
Class BorderFactory, Border createEmptyBorder()

Creates an empty border that takes up no space. (The width of the top bottom left and right sides are all zero.) @return the Border object
Class BorderFactory, Border createEmptyBorder(int, int, int, int)

Creates an empty border that takes up no space but which does no drawing specifying the width of the top left bottom and right sides. @param top an intinteger specifying the width of the top in pixels @param left an intinteger specifying the width of the left side in pixels @param bottom an intinteger specifying the width of the right side in pixels @param right an intinteger specifying the width of the bottom in pixels @return the Border object
Class BorderFactory, Border createEtchedBorder()

CreateCreates a border with an "etched" look using the component's current background color for highlighting and shading. @return the Border object
Class BorderFactory, Border createLineBorder(Color)

Creates a line border withe the specified color. @param color a Color to use for the line @return the Border object
Class BorderFactory, Border createLineBorder(Color, int)

Creates a line border withewith the specified color and width. The width applies to all 4four sides of the border. To specify widths individually for the top bottom left and right use in int int Color)}. @param color a Color to use for the line @param thickness an intinteger specifying the width in pixels @return the Border object
Class BorderFactory, Border createLoweredBevelBorder()

CreatedCreates a border with a lowered beveled edge using brighter shades of the component's current background color for highlighting and darker shading for shadows. (In a lowered border shadows are on top and highlights are underneath.) @return the Border object
Class BorderFactory, MatteBorder createMatteBorder(int, int, int, int, Color)

CreateCreates a matte-look border using a solid color. (The difference between this border and a line border is that you can specify the individual border dimensions.) @param top an intinteger specifying the width of the top in pixels @param left an intinteger specifying the width of the left side in pixels @param bottom an intinteger specifying the width of the right side in pixels @param right an intinteger specifying the width of the bottom in pixels @param color a Color to use for the border @return the MatteBorder object
Class BorderFactory, MatteBorder createMatteBorder(int, int, int, int, Icon)

CreateCreates a matte-look border that consists of multiple tiles of a specified icon. Multiple copies of the icon are placed side-by-side to fill up the border area.

Note:
If the icon doesn't load the border area is painted gray. @param top an intinteger specifying the width of the top in pixels @param left an intinteger specifying the width of the left side in pixels @param bottom an intinteger specifying the width of the right side in pixels @param right an intinteger specifying the width of the bottom in pixels @param tileIcon the Icon object used for the border tiles @return the MatteBorder object

Class BorderFactory, Border createRaisedBevelBorder()

CreatedCreates a border with a raised beveled edge using brighter shades of the component's current background color for highlighting and darker shading for shadows. (In a raised border highlights are on top and shadows are underneath.) @return the Border object
Class BorderFactory, TitledBorder createTitledBorder(Border)

CreateCreates a new title border with an empty title specifying the border object using the default text position (sitting on the top line) and default justification (leftleading) and using the default font text color and border determined by the current look and feel. (The Motif and Windows look and feels use an etched border; The Java look and feel useuses a gray border.) @param border the Border object to add the title to @return the TitledBorder object
Class BorderFactory, TitledBorder createTitledBorder(Border, String)

AddAdds a title to an existing border specifying the text of the title using the default positioning (sitting on the top line) and default justification (leftleading) and using the default font and text color determined by the current look and feel. @param border the Border object to add the title to @param title a String containing the text of the title @return the TitledBorder object
Class BorderFactory, TitledBorder createTitledBorder(Border, String, int, int)

AddAdds a title to an existing border specifying the text of the title along with its positioning using the default font and text color determined by the current look and feel. @param border the Border object to add the title to @param title a String containing the text of the title @param titleJustification an intinteger specifying the left/rightjustification position of the title -- one of the following:
  • TitledBorder.LEFT
  • TitledBorder.CENTER or
  • TitledBorder.RIGHT
  • TitledBorder.LEADING
  • TitledBorder.TRAILING
  • TitledBorder.DEFAULT_JUSTIFICATION (leftleading).
@param titlePosition an intinteger specifying the vertical position of the text in relation to the border -- one of the following:
  • TitledBorder.ABOVE_TOP
  • TitledBorder.TOP (sitting on the top line)
  • TitledBorder.BELOW_TOP
  • TitledBorder.ABOVE_BOTTOM
  • TitledBorder.BOTTOM (sitting on the bottom line)
  • TitledBorder.BELOW_BOTTOM or
  • TitledBorder.DEFAULT_POSITION (top).
@return the TitledBorder object
Class BorderFactory, TitledBorder createTitledBorder(Border, String, int, int, Font)

AddAdds a title to an existing border specifying the text of the title along with its positioning and font using the default text color determined by the current look and feel. @param border the Border object to add the title to @param title a String containing the text of the title @param titleJustification an intinteger specifying the left/rightjustification position of the title -- one of the following:
  • TitledBorder.LEFT
  • TitledBorder.CENTER or
  • TitledBorder.RIGHT
  • TitledBorder.LEADING
  • TitledBorder.TRAILING
  • TitledBorder.DEFAULT_JUSTIFICATION (leftleading).
@param titlePosition an intinteger specifying the vertical position of the text in relation to the border -- one of the following:
  • TitledBorder.ABOVE_TOP
  • TitledBorder.TOP (sitting on the top line)
  • TitledBorder.BELOW_TOP
  • TitledBorder.ABOVE_BOTTOM
  • TitledBorder.BOTTOM (sitting on the bottom line)
  • TitledBorder.BELOW_BOTTOM or
  • TitledBorder.DEFAULT_POSITION (top).
@param titleFont a Font object specifying the title font @return the TitledBorder object
Class BorderFactory, TitledBorder createTitledBorder(Border, String, int, int, Font, Color)

AddAdds a title to an existing border specifying the text of the title along with its positioning font and color. @param border the Border object to add the title to @param title a String containing the text of the title @param titleJustification an intinteger specifying the left/rightjustification position of the title -- one of the following:
  • TitledBorder.LEFT
  • TitledBorder.CENTER or
  • TitledBorder.RIGHT
  • TitledBorder.LEADING
  • TitledBorder.TRAILING
  • TitledBorder.DEFAULT_JUSTIFICATION (leftleading).
@param titlePosition an intinteger specifying the vertical position of the text in relation to the border -- one of the following:
  • TitledBorder.ABOVE_TOP
  • TitledBorder.TOP (sitting on the top line)
  • TitledBorder.BELOW_TOP
  • TitledBorder.ABOVE_BOTTOM
  • TitledBorder.BOTTOM (sitting on the bottom line)
  • TitledBorder.BELOW_BOTTOM or
  • TitledBorder.DEFAULT_POSITION (top).
@param titleFont a Font object specifying the title font @param titleColor a Color object specifying the title color @return the TitledBorder object
Class BorderFactory, TitledBorder createTitledBorder(String)

CreateCreates a new title border specifying the text of the title using the default border (etched) using the default text position (sitting on the top line) and default justification (leftleading) and using the default font and text color determined by the current look and feel. @param title a String containing the text of the title @return the TitledBorder object

Class BoundedRangeModel

Defines the data model used by components like Sliders and ProgressBars. Defines four interrelated integer properties: minimum maximum extent and value. These four integers define two nested ranges like this:
 minimum < value < value+extent < maximum 
The outer range is minimum maximum and the inner range is value value+extent. The inner range must lie within the outer one i.e. value must be less than or equal to maximum and value+extent must greater than or equal to minimum and maximum must be greater than or equal to minimum. There are a few features of this model that one might find a little surprising. These quirks exist for the convenience of the Swing BoundedRangeModel clients like like Slider and ScrollBar.
  • The minimum and maximum set methods "correct" the other three properties to acommodate their new value argument. For example setting the model's minimum may change its maximum value and extent properties (in that order) to maintain the constraints specified above.
  • The value and extent set methods "correct" their argument to fit within the limits defined by the other three properties. For example if value == maximum setExtent(10) would change the extent (back) to zero.
  • The four BoundedRangeModel values are defined as Java Beans properties however Swing ChangeEvents are used to notify clients of changes rather than PropertyChangeEvents. This was done to keep the overhead of monitoring a BoundedRangeModel low. Changes are often reported at MouseDragged rates.

For an example of specifying custom bounded range models used by sliders see The Anatomy of a Swing-Based Program in The Java Tutorial. @version 1.19 0822 02/2602/9800 @author Hans Muller @see DefaultBoundedRangeModel


Class Box

A lightweight container that uses a BoxLayout object as its layout manager. Box provides several class methods that are useful for containers using BoxLayout -- even non-Box containers.

The Box class can create several kinds of invisible components that affect layout: glue struts and rigid areas. If all the components your Box contains have a fixed size you might want to use a glue component (returned by createGlue) to control the components' positions. If you need a fixed amount of space between two components try using a strut (createHorizontalStrut or createVerticalStrut). If you need an invisible component that always takes up the same amount of space get it by invoking createRigidArea.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see BoxLayout @author Timothy Prinzing @version 1.30 0934 03/0114/9800


Class Box.AccessibleBox, Accessible getAccessibleChild(int)

Return the nth Accessible child of the object. @param i zero-based index of child @return the nth Accessible child of the object or null
Class Box.AccessibleBox, int getAccessibleChildrenCount()

Returns the number of accessible children in the object. If all of the children of this object implement Accessible thenthan this method should return the number of children of this object. @return the number of accessible children in the object = 0.
Class Box.AccessibleBox, AccessibleComponent getAccessibleComponent()

GetsGet the AccessibleComponent associated with this object if one exists. Otherwise return null. @return the component
Class Box.AccessibleBox, int getAccessibleIndexInParent()

GetsGet the index of this object in its accessible parent. @return the index of this object in its parent = 0; -1 if this object does not have an accessible parent. @see #getAccessibleParent
Class Box.AccessibleBox, Accessible getAccessibleParent()

GetsGet the Accessible parent of this object. If the parent of this object implements Accessible this method should simply return getParent(). @return the Accessible parent of this object -- can be null if this object does not have an Accessible parent
Class Box.AccessibleBox, AccessibleStateSet getAccessibleStateSet()

GetsGet the state of this object. @return an instance of AccessibleStateSet containing the current state set of the object @see AccessibleState
Class Box.AccessibleBox, Color getBackground()

GetsGet the background color of this object. @return the background color if supported of the object; otherwise null
Class Box.AccessibleBox, Cursor getCursor()

GetsGet the Cursor of this object. @return the Cursor if supported of the object; otherwise null
Class Box.AccessibleBox, Font getFont()

GetsGet the Font of this object. @return the Font if supported for the object; otherwise null
Class Box.AccessibleBox, FontMetrics getFontMetrics(Font)

GetsGet the FontMetrics of this object. @param f the Font @return the FontMetrics if supported the object; otherwise null @see #getFont
Class Box.AccessibleBox, Color getForeground()

GetsGet the foreground color of this object. @return the foreground color if supported of the object; otherwise null
Class Box.AccessibleBox, Locale getLocale()

ReturnsReturn the locale of this object. @return the locale of this object
Class Box.AccessibleBox, boolean isEnabled()

DeterminesDetermine if the object is enabled. @return true if object is enabled; otherwise false
Class Box.AccessibleBox, boolean isFocusTraversable()

DeterminesReturns whether this object can accept focus or not. @return true if object can accept focus; otherwise false
Class Box.AccessibleBox, boolean isShowing()

DeterminesDetermine if the object is showing. This is determined by checking the visibility of the object and ancestors of the object. Note: this will return true even if the object is obscured by another (for example it happens to be underneath a menu that was pulled down). @return true if object is showing; otherwise false
Class Box.AccessibleBox, boolean isVisible()

DeterminesDetermine if the object is visible. Note: this means that the object intends to be visible; however it may not in fact be showing on the screen because one of the objects that this object is contained by is not visible. To determine if an object is showing on the screen use isShowing(). @return true if object is visible; otherwise false
Class Box.AccessibleBox, void setBackground(Color)

SetsSet the background color of this object. (For transparency see isOpaque.) @param c the new Color for the background null if@see noneComponent#isOpaque
Class Box.AccessibleBox, void setBounds(Rectangle)

Sets the bounds of this object in the form of a Rectangle object. The bounds specify this object's width height and location relative to its parent. @param rA a rectangle indicating this component's bounds
Class Box.AccessibleBox, void setCursor(Cursor)

SetsSet the Cursor of this object. @param cursorc the new Cursor for the object null if none
Class Box.AccessibleBox, void setEnabled(boolean)

SetsSet the enabled state of the object. @param b if true enables this object; otherwise disables it
Class Box.AccessibleBox, void setFont(Font)

SetsSet the Font of this object. @param f the new Font for the object null if none
Class Box.AccessibleBox, void setForeground(Color)

SetsSet the foreground color of this object. @param c the new Color for the foreground null if none
Class Box.AccessibleBox, void setLocation(Point)

Sets the location of the object relative to the parent. @param p the location to be set
Class Box.AccessibleBox, void setSize(Dimension)

Resizes this object so that it has width width and height. @param d - The dimension specifying the new size of the object.
Class Box.AccessibleBox, void setVisible(boolean)

SetsSet the visible state of the object. @param b if true shows this object; otherwise hides it

Class Box.Filler.AccessibleBoxFiller, void addFocusListener(FocusListener)

Adds the specified focus listener to receive focus events from this component. @param l the focus listener
Class Box.Filler.AccessibleBoxFiller, Accessible getAccessibleChild(int)

ReturnsReturn the nth Accessible child of the object. @param i zero-based index of child @return the nth Accessible child of the object null if none
Class Box.Filler.AccessibleBoxFiller, int getAccessibleChildrenCount()

Returns the number of accessible children in the object. If all of the children of this object implement Accessible thenthan this method should return the number of children of this object. @return the number of accessible children in the object = 0.
Class Box.Filler.AccessibleBoxFiller, AccessibleComponent getAccessibleComponent()

GetsGet the AccessibleComponent associated with this object if one exists. Otherwise return null. @return the component
Class Box.Filler.AccessibleBoxFiller, int getAccessibleIndexInParent()

GetsGet the index of this object in its accessible parent. @return the index of this object in its parent = 0; -1 if this object does not have an accessible parent. @see #getAccessibleParent
Class Box.Filler.AccessibleBoxFiller, Accessible getAccessibleParent()

Get the Accessible parent of this object. If the parent of this object implements Accessible this method should simply return getParent(). @return the Accessible parent of this object; -- can be null if this object does not have an Accessible parent
Class Box.Filler.AccessibleBoxFiller, AccessibleStateSet getAccessibleStateSet()

GetsGet the state of this object. @return an instance of AccessibleStateSet containing the current state set of the object @see AccessibleState
Class Box.Filler.AccessibleBoxFiller, Color getBackground()

GetsGet the background color of this object. @return the background color if supported of the object; otherwise null
Class Box.Filler.AccessibleBoxFiller, Cursor getCursor()

GetsGet the Cursor of this object. @return the Cursor if supported of the object; otherwise null
Class Box.Filler.AccessibleBoxFiller, Font getFont()

GetsGet the Font of this object. @return the Font if supported for the object; otherwise null
Class Box.Filler.AccessibleBoxFiller, FontMetrics getFontMetrics(Font)

GetsGet the FontMetrics of this object. @param f the Font null if none @return the FontMetrics if supported the object; otherwise null @see #getFont
Class Box.Filler.AccessibleBoxFiller, Color getForeground()

GetsGet the foreground color of this object. @return the foreground color if supported of the object; otherwise null
Class Box.Filler.AccessibleBoxFiller, Locale getLocale()

ReturnsReturn the locale of this object. @return the locale of this object
Class Box.Filler.AccessibleBoxFiller, Point getLocationOnScreen()

Returns the location of the object on the screen. @return location of object on screen; -- can be null if this object is not on the screen
Class Box.Filler.AccessibleBoxFiller, boolean isEnabled()

DeterminesDetermine if the object is enabled. @return true if object is enabled; otherwise false
Class Box.Filler.AccessibleBoxFiller, boolean isShowing()

DeterminesDetermine if the object is showing. This is determined by checking the visibility of the object and ancestors of the object. Note: this will return true even if the object is obscured by another (for example it happens to be underneath a menu that was pulled down). @return true if object is showing; otherwise false
Class Box.Filler.AccessibleBoxFiller, boolean isVisible()

DeterminesDetermine if the object is visible. Note: this means that the object intends to be visible; however it may not in fact be showing on the screen because one of the objects that this object is contained by is not visible. To determine if an object is showing on the screen use isShowing(). @return true if object is visible; otherwise false
Class Box.Filler.AccessibleBoxFiller, void removeFocusListener(FocusListener)

Removes the specified focus listener so it no longer receives focus events from this component. @param l the focus listener
Class Box.Filler.AccessibleBoxFiller, void setBackground(Color)

SetsSet the background color of this object. (For transparency see isOpaque.) @param c the new Color for the background null if none @s JComponentsee Component#isOpaque
Class Box.Filler.AccessibleBoxFiller, void setBounds(Rectangle)

Sets the bounds of this object in the form of a Rectangle object. The bounds specify this object's width height and location relative to its parent. @param rA a rectangle indicating this component's bounds
Class Box.Filler.AccessibleBoxFiller, void setCursor(Cursor)

Set the Cursor of this object. @param cursorc the new Cursor for the object null if none
Class Box.Filler.AccessibleBoxFiller, void setEnabled(boolean)

SetsSet the enabled state of the object. @param b if true enables this object; otherwise disables it
Class Box.Filler.AccessibleBoxFiller, void setFont(Font)

SetsSet the Font of this object. @param f the new Font for the object null if none
Class Box.Filler.AccessibleBoxFiller, void setForeground(Color)

SetsSet the foreground color of this object. @param c the new Color for the foreground null if none
Class Box.Filler.AccessibleBoxFiller, void setLocation(Point)

Sets the location of the object relative to the parent. @param p the location to be set
Class Box.Filler.AccessibleBoxFiller, void setSize(Dimension)

Resizes this object so that it has width width and height. @param d - The dimension specifying the new size of the object.
Class Box.Filler.AccessibleBoxFiller, void setVisible(boolean)

SetsSet the visible state of the object. @param b if true shows this object; otherwise hides it

Class Box.Filler, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this ComponentBox.Filler. For box fillers the AccessibleContext takes the form of an CreatesAccessibleBoxFiller. aA new contextAccessibleAWTBoxFiller instance is created if necessary. @return an AccessibleBoxFiller that serves as the AccessibleContext of this ComponentBox.Filler.

Class Box, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentBox. Creates aFor boxes the AccessibleContext takes the form of an AccessibleBox. A new contextAccessibleAWTBox instance is created if necessary. @return an AccessibleBox that serves as the AccessibleContext of this JComponentBox

Class BoxLayout

A layout manager that allows multiple components to be layed out either vertically or horizontally. The components will not wrap so for example a vertical arrangement of components will stay vertically arranged when the frame is resized.

Nesting multiple panels with different combinations of horizontal and vertical gives an effect similar to GridBagLayout without the complexity. The diagram shows two panels arranged horizontally each of which contains 3 components arranged vertically.

The Box container uses BoxLayout (unlike JPanel which defaults to flow layout). You can nest multiple boxes and add components to them to get the arrangement you want.

The BoxLayout manager that places each of its managed components from left to right or from top to bottom. When you create a BoxLayout you specify whether its major axis is the X axis (which means left to right placement) or Y axis (top to bottom placement). Components are arranged from left to right (or top to bottom) in the same order as they were added to the container.

Instead of using BoxLayout directly many programs use the Box class. The Box class provides a lightweight container that uses a BoxLayout. Box also provides handy methods to help you use BoxLayout well.

BoxLayout attempts to arrange components at their preferred widths (for left to right layout) or heights (for top to bottom layout). For a left to right layout if not all the components are the same height BoxLayout attempts to make all the components as high as the highest component. If that's not possible for a particular component then BoxLayout aligns that component vertically according to the component's Y alignment. By default a component has an Y alignment of 0.5 which means that the vertical center of the component should have the same Y coordinate as the vertical centers of other components with 0.5 Y alignment.

Similarly for a vertical layout BoxLayout attempts to make all components in the column as wide as the widest component; if that fails it aligns them horizontally according to their X alignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see Box @see Component#getAlignmentX @see Component#getAlignmentY @author Timothy Prinzing @version 1.20 1024 02/2002/9800

Class BoxLayout, int Y_AXIS

Specifies that components should be laid out top to buttombottom.

Class ButtonGroup

This class is used to create a multiple-exclusion scope for a set of buttons. Creating a set of buttons with the same ButtonGroup object means that turning "on" one of those buttons turns off all other buttons in the group.

A ButtonGroup can be used with setsany set of JButtonobjects that inherit from AbstractButton. Typically a button group contains instances of JRadioButton JRadioButtonMenuItem or JRadioButtonMenuItemJToggleButton. objectsIt wouldn't make sense to put an instance of JButton or JMenuItem in a button group because JButton and JMenuItem don't implement the selected state.

Initially all buttons in the group are unselected. Once any button is selected one button is always selected in the group. There is no way to turn a button programmatically to "off" in order to clear the button group. To give the appearance of "none selected" add an invisible radio button to the group and then programmatically select that button to turn off all the displayed radio buttons. For example a normal button with the label "none" could be wired to select the invisible radio button.

For examples and further information on using button groups see How to Use Radio Buttons a section in The Java Tutorial.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.22 0827 02/2802/9800 @author Jeff Dinkins


Class ButtonModel

State Model for buttons. This model is used for checkboxescheck boxes and radiobuttonsradio buttons which are special kinds of buttons as well as for normal buttons. For checkboxescheck boxes and radiobuttonsradio buttons pressing the mouse selects the button. For normal buttons pressing the mouse "arms" the button. Releasing the mouse over the button then initiates a button press firing its action event. Releasing the mouse elsewhere disarms the button.

In use a UI will invoke #setSelected() when a mouse click occurs over a checkboxcheck box or radiobuttonradio button. It will invoke #setArmed when the mouse is pressed over a regular button and invoke #setPressed when the mouse is released. If the mouse travels outside the button in the meantime setArmed(false) will tell the button not to fire when it sees setPressed. (If the mouse travels back in the button will be rearmed.)

Note:
A button is triggered when it is both "armed" and "pressed".
@version 1.20 0823 02/2602/9800 @author Jeff Dinkins
Class ButtonModel, boolean isEnabled()

Indicates if the button can be selected or pressed by an input device (such as a mouse pointer). (Checkbox-buttonsCheck boxes are selected regular buttons are "pressed".) @return true if the button is enabled and therefore selectable (or pressable)
Class ButtonModel, boolean isSelected()

Indicates if the button has been selected. Only needed for certain types of buttons - such as RadioButtonradio orbuttons and check Checkboxboxes. @return true if the button is selected

Class CellEditor

This interface defines the methods any general editor should be able to implement.

Having this interface enables complex components (the client of the editor) such as JList JTree and JTable to allow any generic editor to edit values in a table cell or tree cell etc. Without this generic editor interface JTable would have to know about specific editors such as JTextField JCheckBox JComboBox etc. In addition without this interface clients of editors such as JTable would not be able to work with any editors developed in the future by the user or a 3rd party ISV.

To use this interface a developer creating a new editor can have the new component implement the interface. Or the developer can choose a wrapper based approch and provide a companion object which implements the CellEditor interface (See JCellEditor for example). The wrapper approch is particularly useful if the user want to use a 3rd party ISV editor with JTable but the ISV didn't implement the CellEditor interface. The user can simply create an object that contains an instance of the 3rd party editor object and "translate" the CellEditor API into the 3rd party editor's API. @see javax.swing.event.CellEditorListener @version 1.16 0819 02/2602/9800 @author Alan Chung

Class CellEditor, boolean shouldSelectCell(EventObject)

Tell the editor to start editing using anEvent. It is up to the editor if it want to start editing in different states depending on the exact type of anEvent. For example with a text field editor if the event is a mouse event the editor might start editing with the cursor at the clicked point. If the event is a keyboard event it might want replace the value of the text field with that first key etc. anEvent is in the invoking component's coordinate system. A null value is a valid parameter for anEvent and it is up to the editor to determine what is the default starting state. For example a text field editor might want to select all the text and start editing if anEvent is null. The editor can assume the Component returned by getCellEditorComponent() is properly installed in the clients Component hierarchy before this method is called. The return value of shouldSelectCell() is a boolean indicating whether the editing cell should be selected or not. Typically the return value is true because is most cases the editing cell should be selected. However it is useful to return false to keep the selection from changing for some types of edits. eg. A table that contains a column of check boxes the user might want to be able to change those checkboxes without altering the selection. (See Netscape Communicator for just such an example) Of course it is up to the client of the editor to use the return value but it doesn't need to if it doesn't want to. @param anEvent the event the editor should use to start editing. @return true if the editor would like the editing cell to be selected @see #isCellEditable

Class CellRendererPane

This class is inserted in between cell renderers and the components that use them. It just exists to thwart the repaint() and invalidate() methods which would otherwise propogate up the tree when the renderer was configured. It's used by the implementations of JTable JTree and JList. For example here's how CellRendererPane is used in the code the paints each row in a JList:
 cellRendererPane = new CellRendererPane(); ... Component rendererComponent = renderer.getListCellRendererComponent(); renderer.configureListCellRenderer(dataModel.getElementAt(row) row); cellRendererPane.paintComponent(g rendererComponent this x y w h); 

A renderer component must override isShowing() and unconditionally return true to work correctly because the Swing paint does nothing for components with isShowing false.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.28 0932 03/0114/9800 @author Hans Muller


Class CellRendererPane.AccessibleCellRendererPane, AccessibleComponent getAccessibleComponent()

Get the AccessibleComponent associated with this object if one exists. Otherwise return null. @return the component
Class CellRendererPane.AccessibleCellRendererPane, void setBackground(Color)

Set the background color of this object. (For transparency see isOpaque.) @param c the new Color for the background @see Component#isOpaque

Class CellRendererPane, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this CellRendererPane. For CellRendererPanes the AccessibleContext takes the form of an AccessibleCellRendererPane. A new AccessibleCellRendererPane instance is created if necessary. @return an AccessibleCellRendererPane that serves as the AccessibleContext of this CellRendererPane

Class ComboBoxEditor

The editor component used for JComboBox components. @version 1.8 0810 02/2602/9800 @author Arnaud Weber

Class DebugGraphics

Graphics subclass supporting graphics debugging. Overrides most methods from Graphics. DebugGraphics objects are rarely created by hand. They are most frequently created automatically when a JComponent's debugGraphicsOptions are changed using the setDebugGraphicsOptions() method.

NOTE: You must turn off double buffering to use DebugGraphics: RepaintManager repaintManager = RepaintManager.currentManager(component); repaintManager.setDoubleBufferingEnabled(false); @see JComponent#setDebugGraphicsOptions @see RepaintManager#currentManager @see RepaintManager#setDoubleBufferingEnabled @version 1.17 1019 02/2002/9800 @author Dave Karlton


Class DefaultBoundedRangeModel

A generic implementation of BoundedRangeModel.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.32 1035 02/2602/9800 @author David Kloba @author Hans Muller @see BoundedRangeModel


Class DefaultButtonModel

The default implementation of a Button component's data model.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.26 0832 02/2802/9800 @author Jeff Dinkins


Class DefaultCellEditor

The default editor for table and tree cells.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.36 0338 02/0802/00 @author Philip MilneAlan Chung @author AlanPhilip ChungMilne


Class DefaultComboBoxModel

The default model for combo boxes. @version 1.6 0911 02/0102/9800 @author Arnaud Weber @author Tom Santos

Class DefaultDesktopManager

This is an implementaion of the DesktopManager. It currently implements a the basic behaviors for managing JInternalFrames in an arbitrary parent. JInternalFrames that are not children of a JDesktop will use this component to handle their desktop-like actions. @see JDesktopPane @see JInternalFrame @version 1.24 0441 02/2202/9900 @author David Kloba @author Steve Wilson
Class DefaultDesktopManager, void closeFrame(JInternalFrame)

Removes the frame and if necessary the desktopIcon from it'sits parent.
Class DefaultDesktopManager, void deiconifyFrame(JInternalFrame)

Removes the desktopIcon from it'sits parent and adds it'sits frame to the parent.
Class DefaultDesktopManager, void iconifyFrame(JInternalFrame)

Removes the frame from it'sits parent and adds it'sits desktopIcon to the parent.
Class DefaultDesktopManager, void maximizeFrame(JInternalFrame)

Resizes the frame to fill it'sits parents bounds.
Class DefaultDesktopManager, void minimizeFrame(JInternalFrame)

Restores the frame back to it'sits size and position prior to a maximizeFrame() call.
Class DefaultDesktopManager, void openFrame(JInternalFrame)

Normally this method will not be called. If it is it try to determine the appropriate parent from the desktopIcon of the frame. Will remove the desktopIcon from it'sits parent if it successfully adds the frame.

Class DefaultFocusManager

Default swing focus manager implementation. @version 1.14 0415 07/2213/99 @author Arnaud Weber

Class DefaultListCellRenderer

Renders an item in a list.

Implementation Note: This class overrides validate revalidate repaint and firePropertyChange solely to improve performance. If not overridden these frequently called methods would execute code paths that are unnecessary for the default list cell renderer. If you write your own renderer take care to weigh the benefits and drawbacks of overriding these methods.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.12 0417 02/2202/9900 @author Philip Milne @author Hans Muller

Class DefaultListCellRenderer, void revalidate()

SupportOverridden for deferredperformance automatic layout. Calls invalidate() and then adds this components validateRoot to a list of components that need to be validated. Validation will occur after all currently pending events have been dispatched. In other words after this method is called the first validateRoot (if any) found when walking up the containment hierarchy of this component will be validated. By default JRootPane JScrollPane and JTextField return true from isValidateRoot(). This method will automatically be called on this component when a property value changes such that size location or internal layout of this component has been affectedreasons. ThisSee automatic updating differs from the AWT because programs generally no longer need to invoke validate() to get the contents of the GUI to update. Implementation @seeNote java.awt.Component#invalidatefor @seemore java.awtinformation.Container#validate @see #isValidateRoot @see RepaintManager#addInvalidComponent
Class DefaultListCellRenderer, void validate()

Validates this containerOverridden for performance and all of its subcomponentsreasons. AWT uses validate to cause a container to laySee out its subcomponents again after the components it containsImplementation haveNote been addedfor more to or modifiedinformation. @see #validate @see Component#invalidate

Class DefaultListModel

This class implements the java.util.Vector API and notifies the ListDataListeners when changes occur. Presently it delegates to a Vector in a future release it will be a real Collection implementation.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.21 1026 02/0602/9800 @author Hans Muller


Class DefaultListSelectionModel

Default data model for list selections.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.52 0455 02/2202/9900 @author Philip Milne @author Hans Muller @see ListSelectionModel

Class DefaultListSelectionModel, Object clone()

Returns a clone of thethis selection recievermodel with the same selection. listenerLists are not duplicated. @exception CloneNotSupportedException if the receiverselection model does not both (a) implement the Cloneable interface and (b) define a clone method.
Class DefaultListSelectionModel, void fireValueChanged(boolean)

NotifyNotifies listeners that we have ended a series of adjustments.
Class DefaultListSelectionModel, void fireValueChanged(int, int)

NotifyNotifies ListSelectionListeners that the value of the selection in the closed interval firstIndex lastIndex has changed.
Class DefaultListSelectionModel, void fireValueChanged(int, int, boolean)

@param firstIndex Thethe first index in the interval. @param index1 ThelastIndex the last index in the interval. @param isAdjusting Truetrue if this is the final change in a series of them.adjustments @see EventListenerList
Class DefaultListSelectionModel, boolean isLeadAnchorNotificationEnabled()

Returns the value of the leadAnchorNotificationEnabled flag. When leadAnchorNotificationEnabled is true the model generates notification events with bounds that cover all the changes to the selection plus the changes to the lead and anchor indices. Setting the flag to false causes a norrowingnarrowing of the event's bounds to include only the elements that have been selected or deselected since the last change. Either way the model continues to maintain the lead and anchor variables internally. The default is true. @return the value of the leadAnchorNotificationEnabled flag @see #setLeadAnchorNotificationEnabled(boolean)
Class DefaultListSelectionModel, void setLeadSelectionIndex(int)

SetSets the lead selection index ensuring that values between the anchor and the new lead are either all selected or all deselected. If the value at the anchor index is selected first clear all the values in the range [anchor oldLeadIndex] then select all the values values in the range [anchor newLeadIndex] where oldLeadIndex is the old leadIndex and newLeadIndex is the new one.

If the value at the anchor index is not selected do the same thing in reverse selecting values in the old range and deslecting values in the new one.

Generate a single event for this change and notify all listeners. For the purposes of generating minimal bounds in this event do the operation in a single pass; that way the first and last index inside the ListSelectionEvent that is broadcast will refer to cells that actually changed value because of this method. If instead this operation were done in two steps the effect on the selection state would be the same but two events would be generated and the bounds around the changed values would be wider including cells that had been first cleared only to later be set.

This method can be used in the mouseDragged() method of a UI class to extend a selection. @see #getLeadSelectionIndex @see #setAnchorSelectionIndex

Class DefaultListSelectionModel, String toString()

Returns a string that displays and identifies this object's properties. @return a String representation of this object

Class DefaultSingleSelectionModel

A generic implementation of SingleSelectionModel.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.22 0925 02/0102/9800 @author Dave Moore


Class DesktopManager

DesktopManager objects are owned by a JDesktopPane object. They are responsible for implementing L&F specific behaviors for the JDesktopPane. JInternalFrame implementations should delegate specific behaviors to the DesktopManager. For instance if a JInternalFrame was asked to iconify it should try:
 getDesktopPane().getDesktopManager().iconifyFrame(frame); 
This delegation allows each L&F to provide custom behaviors for desktop-specific actions. (For example how and where the internal frame's icon would appear.) @see JDesktopPane @see JInternalFrame @see JInternalFrame.JDesktopIcon @version 1.8 0810 02/2602/9800 @author David Kloba

Class FocusManager

Swing Focus Manager @version 1.9 0811 02/2602/9800 @author Arnaud Weber

Class GrayFilter

An image filter that "disables" an image by turning it into a grayscale image and brightening the pixels in the image. Used by buttons to create an image for a disabled button. @author Jeff Dinkins @author Tom Ball @author Jim Graham @version 1.10 0812 02/2602/9800

Class ImageIcon

An implementation of the Icon interface that paints Icons from Images. Images that are created from a URL or filename are preloaded using MediaTracker to monitor the loaded state of the image.

For further information and examples of using image icons see How to Use Icons in The Java Tutorial.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.33 0845 03/2815/9800 @author Jeff Dinkins @author Lynn Monsanto

Class ImageIcon, constructor ImageIcon(Image)

Creates an ImageIcon from an image object. If the image has a "comment" property that is a string then the string is used as the description of this icon. @param image the image @see #getDescription @see java.awt.Image#getProperty
Class ImageIcon, constructor ImageIcon(String)

Creates an ImageIcon from the specified file. The image will be preloaded by using MediaTracker to monitor the loading state of the image. The specified String can be a file name or a file path. When specifying a path use the Internet-standard forward-slash ("/") as a separator. (The string is converted to an URL so the forward-slash works on all systems.) For example specify:
 new ImageIcon("images/myImage.gif") 
(The stringdescription is convertedinitialized to an URL so the forward-slash works on allfilename systemsstring.) @param filename a String specifying a filename or path @see #getDescription
Class ImageIcon, constructor ImageIcon(URL)

Creates an ImageIcon from the specified URL. The image will be preloaded by using MediaTracker to monitor the loaded state of the image. The icon's description is initialized to be a string representation of the URL. @param location the URL for the image @see #getDescription
Class ImageIcon, constructor ImageIcon(URL, String)

Creates an ImageIcon from the specified URL. The image will be preloaded by using MediaTracker to monitor the loaded state of the image. @param URLlocation the URL for the image @param description a brief textual description of the image @see #ImageIcon(String)
Class ImageIcon, constructor ImageIcon(byte[])

Creates an ImageIcon from an array of bytes which were read from an image file containing a supported image format such as GIF or JPEG. Normally this array is created by reading an image using Class.getResourceAsStream() but the byte array may also be statically stored in a class. If the resulting image has a "comment" property that is a string then the string is used as the description of this icon. @param imageData an array of pixels in an image format supported by the AWT Toolkit such as GIF or JPEG. @see java.awt.Toolkit#createImage @see #getDescription @see java.awt.Image#getProperty
Class ImageIcon, String getDescription()

GetGets the description of the image. This is meant to be a brief textual description of the object. For example it might be presented to a blind user to give an indication of the purpose of the image. The description may be null. @return a brief textual description of the image
Class ImageIcon, int getIconHeight()

GetGets the height of the Iconicon. @return the height in pixels of this icon
Class ImageIcon, int getIconWidth()

GetGets the width of the Iconicon. @return the width in pixels of this icon
Class ImageIcon, Image getImage()

Returns the Iconthis icon's Image. @return the Image object for this ImageIcon
Class ImageIcon, int getImageLoadStatus()

Returns the status of the image loading operation. @return the loading status as defined by java.awt.MediaTracker. @see java.awt.MediaTracker#ABORTED @see java.awt.MediaTracker#ERRORED @see java.awt.MediaTracker#COMPLETE
Class ImageIcon, ImageObserver getImageObserver()

ReturnReturns the umageimage observer for the image. @return the image observer which may be null
Class ImageIcon, void loadImage(Image)

WaitLoads forthe image returning only when the image tois loaded. @param image the loadimage
Class ImageIcon, void paintIcon(Component, Graphics, int, int)

Paints the Iconicon. The top-left corner of the icon is drawn at the point (x y) in the coordinate space of the graphics context g. If this icon has no image observer this method uses the c component as the observer. @param c the component to be used as the observer if this icon has no image observer @param g the graphics context @param x the X coordinate of the icon's top-left corner @param y the Y coordinate of the icon's top-left corner
Class ImageIcon, void setDescription(String)

SetSets the description of the image. This is meant to be a brief textual description of the object. For example it might be presented to a blind user to give an indication of the purpose of the image. @param description a brief textual description of the image
Class ImageIcon, void setImage(Image)

SetSets the image displayed by this icon. @param image the image
Class ImageIcon, void setImageObserver(ImageObserver)

SetSets the image observer for the image. Set this property if the ImageIcon contains an animated GIF so the observer is notified to update its display. For example:
 icon = new ImageIcon(...) button.setIcon(icon); icon.setImageObserver(button); 
@param observer the image observer
Class ImageIcon, String toString()

Returns a string representation of the object. In general the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommendedthat all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance the at-sign character `@' and the unsigned hexadecimal representation of the hash code of the object. In other words this method returns a string equal to the value of: getClass().getName() + '@' + Integerimage.toHexString(hashCode()) @return a string representation ofrepresenting thethis object.image

Class JApplet

An extended version of java.applet.Applet that adds support for interposing input and painting behavior in frontthe ofJFC/Swing thecomponent appletsarchitecture. childrenYou (seecan glassPane)find supporttask-oriented for special childrendocumentation about using thatJApplet arein managedThe byJava aTutorial LayeredPanein (seethe rootPane)section andHow for Swingto Make MenuBarsApplets.

The JApplet class is slightly incompatible with java.applet.Applet. JApplet contains a JRootPane as it's only child. The contentPane should be the parent of any children of the JApplet. This is different than java.applet.Applet e.g. to add a child to an an java.applet.Applet you'd write:

 applet.add(child); 
However using JApplet you need to add the child to the JApplet's contentPane instead:
 applet.getContentPane().add(child); 
The same is true for setting LayoutManagers removing components listing children etc. All these methods should normally be sent to the contentPane() instead of the JApplet itself. The contentPane() will always be non-null. Attempting to set it to null will cause the JApplet to throw an exception. The default contentPane() will have a BorderLayout manager set on it.

Please see the JRootPane documentation for a complete description of the contentPane glassPane and layeredPane properties.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JApplet key assignments.

Both Netscape Communicator and Internet Explorer 4.0 unconditionally print an error message to the Java console when an applet attempts to access the AWT system event queue. Swing applets do this once to check if access is permitted. To prevent the warning message in a production applet one can set a client property called "defeatSystemEventQueueCheck" on the JApplets RootPane to any non null value e.g: JRootPane rp = myJApplet.getRootPane(); rp.putClientProperty("defeatSystemEventQueueCheck" Boolean.TRUE); We hope that future versions of the browsers will not have this limitation and we'll be able to retire this hack. Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer true attribute: containerDelegate getContentPane description: Swing's Applet subclass. @version 1.38 0442 03/2214/9900 @author Arnaud Weber


Class JApplet.AccessibleJApplet, AccessibleComponent getAccessibleComponent()

Get the AccessibleComponent associated with this object if one exists. Otherwise return null. @return the component
Class JApplet.AccessibleJApplet, AccessibleRole getAccessibleRole()

Get the role of this object. @return an instance of AccessibleRole describing the role of the object @see AccessibleRole
Class JApplet.AccessibleJApplet, void setBackground(Color)

Set the background color of this object. (For transparency see isOpaque.) @param c the new Color for the background @see Component#isOpaque

Class JApplet, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JApplet. For JApplets the AccessibleContext takes the form of an AccessibleJApplet. A new AccessibleJApplet instance is created if necessary. @return an AccessibleJApplet that serves as the AccessibleContext of this JApplet

Class JButton

An implementation of a "push" button. To create a set of mutually exclusive buttons create a ButtonGroup object and use its addSee methodHow to include the JButton objects in the group.Use SeeButtons Check HowBoxes to Useand Radio Buttons in The Java Tutorial for furtherinformation and examples of using documentationbuttons.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JButton key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: An implementation of a \"push\" button. @version 1.73 0983 03/0114/9800 @author Jeff Dinkins @see ButtonGroup


Class JButton.AccessibleJButton

TheThis class usedimplements toaccessibility support obtainfor the accessibleJButton class. role forIt provides thisan implementation of the Java Accessibility API appropriate to button user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JButton, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJButton. For JButtons the AccessibleContext takes the form of an AccessibleJButton. A new AccessibleJButton instance is created if necessary. @return an AccessibleJButton that serves as the AccessibleContext of this JComponentJButton @beaninfo expert: true description: The AccessibleContext associated with this Button.
Class JButton, void removeNotify()

NotificationOverrides JComponent.removeNotify to check if this component that it no longer has a parentbutton is currently set as the default button component.on When this method is invoked any KeyboardActionsthe RootPane and if so sets the setRootPane's up indefault button theto null to ensure the chainRootPane ofdoesn't parent components arehold onto an removed.invalid @seebutton #registerKeyboardActionreference.

Class JCheckBox

An implementation of a CheckBoxcheck box -- an item that can be selected or deselected and which displays its state to the user. In a groupBy convention any number of checkboxescheck boxes in multiple checkboxesa group can be selected. See How to Use CheckBoxesButtonc Check Boxes and Radio Buttons in The Java Tutorial for furtherexamples and information on using documentationcheck boxes.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JCheckBox key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JRadioButton @beaninfo attribute: isContainer false description: A component which can be selected or deselected. @version 1.46 0958 03/0114/9800 @author Jeff Dinkins


Class JCheckBox.AccessibleJCheckBox

TheThis class usedimplements toaccessibility support obtainfor the accessibleJCheckBox class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to check box user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JCheckBox, constructor JCheckBox()

Creates an initially unselected checkboxcheck box button with no text no icon.
Class JCheckBox, constructor JCheckBox(Icon)

Creates an initially unselected checkboxcheck box with an icon. @param icon the Icon image to display
Class JCheckBox, constructor JCheckBox(Icon, boolean)

Creates a checkboxcheck box with an icon and specifies whether or not it is initially selected. @param icon the Icon image to display @param selected a boolean value indicating the initial selection state. If true the checkboxcheck box is selected
Class JCheckBox, constructor JCheckBox(String)

Creates an initially unselected checkboxcheck box with text. @param text the text of the checkboxcheck box.
Class JCheckBox, constructor JCheckBox(String, Icon)

Creates an initially unselected checkboxcheck box with the specified text and icon. @param text the text of the checkboxcheck box. @param icon the Icon image to display
Class JCheckBox, constructor JCheckBox(String, Icon, boolean)

Creates a checkboxcheck box with text and icon and specifies whether or not it is initially selected. @param text the text of the checkboxcheck box. @param icon the Icon image to display @param selected a boolean value indicating the initial selection state. If true the checkboxcheck box is selected
Class JCheckBox, constructor JCheckBox(String, boolean)

Creates a checkboxcheck box with text and specifies whether or not it is initially selected. @param text the text of the checkboxcheck box. @param selected a boolean value indicating the initial selection state. If true the checkboxcheck box is selected
Class JCheckBox, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJCheckBox. For JCheckBoxes the AccessibleContext takes the form of an AccessibleJCheckBox. A new AccessibleJCheckBox instance is created if necessary. @return an AccessibleJCheckBox that serves as the AccessibleContext of this JComponentJCheckBox @beaninfo expert: true description: The AccessibleContext associated with this CheckBox.

Class JCheckBoxMenuItem

A menu item that can be selected or deselected. If selected the menu item typically appears with a checkmark next to it. If unselected or deselected the menu item appears without a checkmark. Like a regular menu item a checkboxcheck box menu item can have either text or a graphic icon associated with it or both.

Either isSelected/setSelected or getState/setState can be used to determine/specify the menu item's selection state. (The Swing-standardpreferred methods are isSelected and setSelected. These methodswhich work for all menus and buttons. The getState and setState methods exist for compatibility with other component sets.)

For further information and examples of using check box menu items see How to Use Menus a section in The Java Tutorial. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JCheckBoxMenuItem key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A menu item which can be selected or deselected. @version 1.40 1147 03/0214/9800 @author Georges Saab @author David Karlton


Class JCheckBoxMenuItem.AccessibleJCheckBoxMenuItem

TheThis class usedimplements toaccessibility support obtainfor the accessibleJCheckBoxMenuItem class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to checkbox menu item user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JCheckBoxMenuItem, constructor JCheckBoxMenuItem()

Creates an initially unselected checkboxMenuItemcheck box menu item with no set text or icon.
Class JCheckBoxMenuItem, constructor JCheckBoxMenuItem(Icon)

Creates an initially unselected checkboxMenuItemcheck box menu item with an icon. @param icon the icon of the CheckBoxMenuItem.
Class JCheckBoxMenuItem, constructor JCheckBoxMenuItem(String)

Creates an initially unselected checkboxMenuItemcheck box menu item with text. @param text the text of the CheckBoxMenuItem
Class JCheckBoxMenuItem, constructor JCheckBoxMenuItem(String, Icon)

Creates an initially unselected checkboxMenuItemcheck box menu item with the specified text and icon. @param text the text of the CheckBoxMenuItem @param icon the icon of the CheckBoxMenuItem
Class JCheckBoxMenuItem, constructor JCheckBoxMenuItem(String, Icon, boolean)

Creates a checkboxMenuItemcheck box menu item with the specified text icon and selection state. @param text the text of the CheckBoxMenuItemcheck box menu item @param icon the icon of the CheckBoxMenuItemcheck box menu item @param b the selected state of the checkboxmenuitemcheck box menu item
Class JCheckBoxMenuItem, constructor JCheckBoxMenuItem(String, boolean)

Creates a checkboxMenuItemcheck box menu item with the specified text and selection state. @param text the text of the CheckBoxMenuItemcheck box menu item. @param b the selected state of the checkboxmenuitemcheck box menu item
Class JCheckBoxMenuItem, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJCheckBoxMenuItem. For JCheckBoxMenuItems the AccessibleContext takes the form of an AccessibleJCheckBoxMenuItem. A new AccessibleJCheckBoxMenuItem instance is created if necessary. @return an AccessibleJCheckBoxMenuItem that serves as the AccessibleContext of this JComponentAccessibleJCheckBoxMenuItem
Class JCheckBoxMenuItem, Object[] getSelectedObjects()

Returns an array (length 1) containing the checkboxcheck box menu item label or null if the checkboxcheck box is not selected. @return an array containing 1one Object -- the text of the menu item -- if the item is selected; otherwise null
Class JCheckBoxMenuItem, void setState(boolean)

Sets the selected-state of the item. This method exists for AWT compatibility only. New code should use setSelected() instead. @param b a boolean value indicating the item's selected-state where true=selected @beaninfo description: The selection state of the Checkboxcheck box menu item hidden: true

Class JColorChooser

JColorChooser provides a pane of controls designed to allow a user to manipulate and select a color. For information about using color choosers see How to Use Color Choosers a section in The Java Tutorial.

This class provides 3three levels of API:

  1. A static convenience method which shows a modal color-chooser dialog and returns the color selected by the user.
  2. A static convenience method for creating a color-chooser dialog where ActionListeners can be specified to be invoked when the user presses one of the dialog buttons.
  3. The ability to create instances of JColorChooser panes directly (within any container). PropertyChange listeners can be added to detect when the current "color" property changes.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A component that supports selecting a Color. @version 1.22 0929 03/0114/9800 @author James Gosling @author Amy Fowler @author Steve Wilson


Class JColorChooser.AccessibleJColorChooser

TheThis class usedimplements toaccessibility support obtainfor the accessibleJColorChooser class. It contextprovides foran implementation of the Java Accessibility API appropriate to color chooser thisuser-interface objectelements.

Class JColorChooser, constructor JColorChooser(ColorSelectionModel)

Creates a color chooser pane with the specified ColorSelectionModel. @param initialColor the initial color set in the chooser
Class JColorChooser, JDialog createDialog(Component, String, boolean, JColorChooser, ActionListener, ActionListener)

Creates and returns a new dialog containing the specified ColorChooser` pane along with "OK" "Cancel" and "Reset" buttons. If the "OK" or "Cancel" buttons are pressed the dialog is automatically hidden (but not disposed). If the "Reset" button is pressed the color-chooser's color will be reset to the color which was set the last time show() was invoked on the dialog and the dialog will remain showing. @param c the parent component for the dialog @param title the title for the dialog @param modal a boolean. When true the remainder of the program is inactive until the dialog is closed. @param chooserPane the color-chooser to be placed inside the dialog @param okListener the ActionListener invoked when "OK" is pressed @param cancelListener the ActionListener invoked when "Cancel" is pressed
Class JColorChooser, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JColorChooser. For color choosers the AccessibleContext takes the form of an AccessibleJColorChooser. A new AccessibleJColorChooser instance is created if necessary. @return an AccessibleJColorChooser that serves as the AccessibleContext of this JColorChooser
Class JColorChooser, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "ColorChooserUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JColorChooser, String paramString()

Returns a string representation of this JColorChooser. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JColorChooser.
Class JColorChooser, AbstractColorChooserPanel removeChooserPanel(AbstractColorChooserPanel)

Removes the Color Panel specified. @exception IllegalArgumentException if panel is not in list of known chooser panels @param name a string that specifies the panel to be removed @return the color panel
Class JColorChooser, void setColor(Color)

Sets the current color of the color chooser to the specified color. This will fire a PropertyChangeEvent for the property named "color". @param color the color to be set in the color chooser @see JComponent#addPropertyChangeListener @beaninfo bound: false hidden: false description: The current color the chooser is to display.
Class JColorChooser, void setColor(int, int, int)

Sets the current color of the color chooser to the specified RGB color. Note that the values of red green and blue should be between the numbers 0 and 255 inclusive. @param r an int specifying the amount of Red @param g an int specifying the amount of Green @param b an int specifying the amount of Blue @exception IllegalArgumentException if r g b values are out of range @see java.awt.Color
Class JColorChooser, void setPreviewPanel(JComponent)

Sets the current preview panel. This will fire a PropertyChangeEvent for the property named "previewPanel". @param color the color to be set in the color chooser @see JComponent#addPropertyChangeListener @beaninfo bound: true hidden: true description: The UI component which displays the current color.
Class JColorChooser, Color showDialog(Component, String, Color)

Shows a modal color-chooser dialog and blocks until the dialog is hidden. If the user presses the "OK" button then this method hides/disposes the dialog and returns the selected color. If the user presses the "Cancel" button or closes the dialog without pressing "OK" then this method hides/disposes the dialog and returns null. @param component the parent Component for the dialog @param title the String containing the dialog's title @param initialColor the initial Color set when the color-chooser is shown
Class JColorChooser, void updateUI()

Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager. @see JComponent#updateUI

Class JComboBox

Swing'sA implementation ofcomponent that combines a ComboBoxbutton --or text field and a combinationdrop-down oflist. The user can select a text field andvalue from the drop-down list thatwhich letsappears at the user's eitherrequest. type in a value or select it from a list thatIf you make the combo box editable then the combo box isincludes a text field displayed wheninto which the user askscan fortype a itvalue. TheFor editing capability can also be disabled so thatexamples and information on using combo boxes see theHow JComboBox acts onlyto Use Combo asBoxes a drop downsection in listThe Java Tutorial.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JComboBox key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A combination of a text field and a drop-down list. @version 1.57 1079 03/0814/9800 @author Arnaud Weber


Class JComboBox.AccessibleJComboBox

TheThis class usedimplements toaccessibility support obtainfor the accessibleJComboBox class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to Combo Box user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JComboBox.AccessibleJComboBox, AccessibleAction getAccessibleAction()

Get the AccessibleAction associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleAction interface on behalf of itself. @return this object
Class JComboBox.AccessibleJComboBox, int getAccessibleActionCount()

Returns the number of Actions available in this object. IfThe there is moredefault than one the first onebehavior of a combo box is theto "default"have one action. @return 1 the number of Actions in this object
Class JComboBox.AccessibleJComboBox, Accessible getAccessibleChild(int)

ReturnReturns the nth Accessible child of the object. The child at index zero represents the popup. If the combo box is editable the child at index one represents the editor. @param i zero-based index of child @return the nth Accessible child of the object

Class JComboBox.KeySelectionManager

The interface that defines a KeySelectionManager. To qualify as a KeySelectionManager the class needs to implement the method that identifies the list index given a character and the combo box data model.

Class JComboBox, constructor JComboBox()

Creates a JComboBox with a default data model. The default data model is an empty list of objects. Use addItem to add items. By default the first item in the data model becomes selected. @see DefaultComboBoxModel
Class JComboBox, constructor JComboBox(ComboBoxModel)

Creates a JComboBox that takes itsit's items from an existing ComboBoxModel. Since the ComboBoxModel is provided a combo box created using this constructor does not create a default combo box model and may impact how the insert remove and add methods behave. @param aModel the ComboBoxModel that provides the displayed list of items @see DefaultComboBoxModel
Class JComboBox, constructor JComboBox(Object[])

Creates a JComboBox that contains the elements in the specified array. By default the first item in the array (and therefore the data model) becomes selected. @param items an array of objects to insert into the combo box @see DefaultComboBoxModel
Class JComboBox, constructor JComboBox(Vector)

Creates a JComboBox that contains the elements in the specified Vector. By default the first item in the vector and therefore the data model) becomes selected. @param items an array of vectors to insert into the combo box @see DefaultComboBoxModel
Class JComboBox, void addActionListener(ActionListener)

Adds an ActionListener. The listener will receive an action event the user finishes making a selection. @param l the ActionListener that is to be notified
Class JComboBox, void addItem(Object)

Adds an item to the item list. This method works only if the JComboBox uses the default data model. JComboBox uses the default data model when created with the empty constructor and no other model has been set.

Warning: Focus and keyboard navigation problems may arise if you add duplicate String objects. A workaround is to add new objects instead of String objects and make sure that the toString() method is defined. For example:

 comboBox.addItem(makeObj("Item 1")); comboBox.addItem(makeObj("Item 1")); ... private Object makeObj(final String item) { return new Object() { public String toString() { return item; } }; } 
@param anObject the Object to add to the list
Class JComboBox, void addItemListener(ItemListener)

Adds an ItemListener. aListener will receive an event when the selected item changes. @param aListener the ItemListener that is to be notified
Class JComboBox, void configureEditor(ComboBoxEditor, Object)

Initializes the editor with the specified item. @param anEditor the ComboBoxEditor that displays the list item in the combo box field and allows it to be edited @param anItem the object to display and edit in the field
Class JComboBox, KeySelectionManager createDefaultKeySelectionManager()

Returns an instance of the default key-selection manager. @return the KeySelectionManager currently used by the list @see #setKeySelectionManager
Class JComboBox, void fireActionEvent()

NotifyNotifies all listeners that have registered interest for notification on this event type. @param e the event of interest @see EventListenerList
Class JComboBox, void fireItemStateChanged(ItemEvent)

NotifyNotifies all listeners that have registered interest for notification on this event type. @param e the event of interest @see EventListenerList
Class JComboBox, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJComboBox. For combo boxes the AccessibleContext takes the form of an AccessibleJComboBox. A new AccessibleJComboBox instance is created if necessary. @return an AccessibleJComboBox that serves as the AccessibleContext of this JComponentJComboBox
Class JComboBox, String getActionCommand()

Returns the action commnandcommand that is included in the event sent to action listeners. @return the string containing the "command" that is sent to action listeners.
Class JComboBox, ComboBoxEditor getEditor()

Returns the editor used to paint and edit the selected item in the JComboBox field. @return the ComboBoxEditor that displays the selected item
Class JComboBox, Object getItemAt(int)

Returns the list item at the specified index. If index is out of range (less than zero or greater than or equal to size) it will return null. @param index an intinteger indicating the list position where the first item starts at zero @return the Object at that list position; or null if out of range
Class JComboBox, int getItemCount()

Returns the number of items in the list. @return an intinteger equal to the number of items in the list
Class JComboBox, KeySelectionManager getKeySelectionManager()

Returns the list's key-selection manager. @return the KeySelectionManager currently in use
Class JComboBox, int getMaximumRowCount()

Returns the maximum number of items the combo box can display without a scrollbar @return an intinteger specifying the maximum number of items that are displayed in the list before using a scrollbar
Class JComboBox, ComboBoxModel getModel()

Returns the data model currently used by the JComboBox. @return the ComboBoxModel that provides the displayed list of items
Class JComboBox, ListCellRenderer getRenderer()

Returns the renderer used to display the selected item in the JComboBox field. @return the ListCellRenderer that displays the selected item.
Class JComboBox, int getSelectedIndex()

Returns the index of the currently selected item infirst item in the list that matches the listgiven item. The result is not always defined if the JComboBox box allows selected items that are not in the list. Returns -1 if there is no selected item or if the user specified an item which is not in the list. @return an intinteger specifying the currently selected list item where 0 specifies the first item in the list; or -1 if no item is selected or if the currently selected item is not in the list
Class JComboBox, Object[] getSelectedObjects()

Returns an array containing the selected item. This method is implemented for compatibility with ItemSelectable. @returns an array of Objects containing one element -- the selected item
Class JComboBox, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "ComboBoxUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JComboBox, void hidePopup()

Causes the combo box to close its popup window. @see #setPopupVisible
Class JComboBox, void insertItemAt(Object, int)

Inserts an item into the item list at a given index. This method works only if the JComboBox uses the default data model. JComboBox uses the default data model when created with the empty constructor and no other model has been set. @param anObject the Object to add to the list @param index an intinteger specifying the position at which to add the item
Class JComboBox, void intervalRemoved(ListDataEvent)

Invoked when values have been removed from the data model. The "interval" includes the first and last values removed. @see javax.swing.event.ListDataListener
Class JComboBox, boolean isEditable()

Returns true if the JComboBox is editable. By default a combo box is not editable. @return true if the JComboBox is editable else false
Class JComboBox, boolean isFocusTraversable()

Returns true if the component can receive the focus. In this case the component returns false if it is editable so that the Editor object receives the focus instead of the component. @return true if the component can receive the focus else false.
Class JComboBox, boolean isPopupVisible()

DetermineDetermines the visibility of the popup.
Class JComboBox, String paramString()

Returns a string representation of this JComboBox. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JComboBox.
Class JComboBox, void processKeyEvent(KeyEvent)

Handles KeyEventsKeyEvents looking for the Tab key. If the Tab key is found the popup window is closed. @param e the KeyEvent containing the keyboard key that was pressed
Class JComboBox, void removeActionListener(ActionListener)

Removes an ActionListener. @param l the ActionListener to remove
Class JComboBox, void removeAllItems()

Removes all items from the item list. This method works only if the JComboBox uses the default data model. JComboBox uses the default data model when created with the empty constructor and no other model has been set.
Class JComboBox, void removeItem(Object)

Removes an item from the item list. This method works only if the JComboBox uses the default data model. JComboBox uses the default data model when created with the empty constructor and no other model has been set. @param anObject the object to remove from the item list
Class JComboBox, void removeItemAt(int)

Removes the item at anIndex This method works only if the JComboBox uses the default data model. JComboBox uses the default data model when created with the empty constructor and no other model has been set. @param anIndex an int specifying the idex of the item to remove where 0 indicates the first item in the list
Class JComboBox, void removeItemListener(ItemListener)

Removes an ItemListener. @param aListener the ItemListener to remove
Class JComboBox, void selectedItemChanged()

This method is called when the selected item changes. Its default implementation notifies the item listeners.
Class JComboBox, void setActionCommand(String)

Sets the action commnand that should be included in the event sent to action listeners. @param aCommand a string containing the "command" that is sent to action listeners. The; the same listener can then do different things depending on the command it receives.
Class JComboBox, void setEditable(boolean)

Determines whether the JComboBox field is editable. An editable JComboBox allows the user to type into the field or selected an item from the list to initialize the field after which it can be edited. (The editing affects only the field the list item remains intact.) A non editable JComboBox displays the selected item inthein the field but the selection cannot be modified. @param aFlag a boolean value where true indicates that the field is editable @beaninfo bound: true preferred: true description: If true the user can type a new value in the combo box.
Class JComboBox, void setEditor(ComboBoxEditor)

Sets the editor used to paint and edit the selected item in the JComboBox field. The editor is used only if the receiving JComboBox is editable. If not editable the combo box uses the renderer to paint the selected item. @param anEditor the ComboBoxEditor that displays the selected item @see #setRenderer @beaninfo bound: true expert: true description: The editor that combo box uses to edit the current value
Class JComboBox, void setEnabled(boolean)

Enables the combo box so that items can be selected. When the combo box is disabled items cannot be selected and values cannot be typed into its field (if it is editable). @param b a boolean value where true enables the component and false disables it @beaninfo bound: true preferred: true description: Whether the combo box is enabled.
Class JComboBox, void setLightWeightPopupEnabled(boolean)

When displaying the popup JComboBox choose to use a light weight popup if it fits. This method allows you to disable this feature. You have to do disable it if your application mixes light weight and heavy weights components. @beaninfo expert: true description: When set disables using light weight popups.
Class JComboBox, void setMaximumRowCount(int)

Sets the maximum number of rows the JComboBox displays. If the number of objects in the model is greater than count the combo box uses a scrollbar. @param count an intinteger specifying the maximum number of items to display in the list before using a scrollbar @beaninfo bound: true preferred: true description: The maximum number of rows the popup should have
Class JComboBox, void setModel(ComboBoxModel)

Sets the data model that the JComboBox uses to obtain the list of items. @param aModel the ComboBoxModel that provides the displayed list of items @beaninfo bound: true description: Model that the combo box uses to get data to display.
Class JComboBox, void setPopupVisible(boolean)

SetSets the visiblityvisibility of the popup.
Class JComboBox, void setRenderer(ListCellRenderer)

Sets the renderer that paints the item selected from the list in the JComboBox field. The renderer is used if the JComboBox is not editable. If it is editable the editor is used to render and edit the selected item.

The default renderer displays a string obtained by calling the selected object's toString method. Other renderers can handle graphic images and composite items.

To display the selected item aRenderer.getListCellRendererComponent is called passing the list object and an index of -1. @param aRenderer the ListCellRenderer that displays the selected item. @see #setEditor @beaninfo bound: true expert: true description: The renderer that paints the item selected in the list.

Class JComboBox, void setSelectedIndex(int)

Selects the item at index anIndex. @param anIndex an intinteger specifying the list item to select where 0 specifies the first item in the list @exception IllegalArgumentException if anIndex <-1 or anIndex is greater than or equal to size @beaninfo preferred: true description: The item at index is selected.
Class JComboBox, void setSelectedItem(Object)

Sets the selected item in the JComboBox by specifying the object in the list. If anObject is in the list the list displays with anObject selected. If the object does not exist in the list the default data model selects the first item in the list. @param anObject the list object to select @beaninfo preferred: true description: Sets the selected item in the JComboBox.
Class JComboBox, void setUI(ComboBoxUI)

Sets the L&F object that renders this component. @param ui the ComboBoxUI L&F object @see UIDefaults#getUI @beaninfo expert: true description: The ComboBoxUI implementation that defines the combo box look and feel.
Class JComboBox, void showPopup()

Causes the combo box to display its popup window. @see #setPopupVisible
Class JComboBox, void updateUI()

Notification from the UIFactory that the L&F has changed. @see JComponent#updateUI

Class JComponent

The base class for all Swing components except top-level containers. To use a component that inherits from JComponent you must place the component in a containment hierarchy whose root is a top-level Swing container. Top-level Swing containers -- such as JFrame JDialog and JApplet -- are specialized components that provide a place for other Swing components to paint themselves. For an explanation of containment hierarchies see Swing Components and the Containment Hierarchy a section in The Java Tutorial.

The JComponent class provides:

  • The base class for both standard and custom components that use the Swing architecture.
  • A "pluggable look and feel" (lL&fF) that can be specified by the programmer or (optionally) selected by the user at runtime. Components that areSee designedHow to beSet the combinedLook and extendedFeel in orderThe toJava createTutorial customfor componentsmore information.
  • Comprehensive keystroke-handling thathandling. works with nestedSee the document components.Keyboard ActionBindings objectsin forSwing single-pointan control ofarticle in programThe actionsSwing initiatedConnection by multiple componentsfor more information.
  • ASupport for tool tips -- border propertyshort descriptions that implicitlypop up defineswhen the component'scursor lingers over insetsa component. TheSee abilityHow to set theUse Tool preferredTips minimimin andThe maximumJava sizeTutorial for a componentmore information.
  • ToolTips --Support shortfor descriptionsaccessibility. thatJComponent pop up whencontains all of the cursor lingersmethods over ain the component.Accessible Autoscrollinginterface --but automaticit scrollingdoesn't in a listactually implement the tableinterface. or tree that occurs whenThat is the responsibility of the userindividual is dragging theclasses that extend mouseJComponent.
  • Simple easySupport for dialogcomponent-specific constructionproperties. using staticWith the methods#putClientProperty inand the#getClientProperty JOptionPane class that letmethods you can associate youname-object display information and query thepairs with any object that userdescends from JComponent.
  • Slow-motionAn graphics rendering using debugGraphics so you can see what isinfrastructure for painting that includes double buffering and support for beingborders. displayed on screen andFor more information see whetherPainting orand notHow it isto Use beingBorders overwritten.both Supportof forwhich Accessibility.are Supportsections forin The internationalJava LocalizationTutorial.
For more information on these subjects see the Swing package description and The Java Tutorial section The JComponent Class.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see KeyStroke @see Action @see #setBorder @see #registerKeyboardAction @see JOptionPane @see #setDebugGraphicsOptions @see #setToolTipText @see #setAutoscrolls @version 2.111 03130 07/0809/0099 @author Hans Muller @author Arnaud Weber


Class JComponent.AccessibleJComponent

Inner class of JComponent used to provide default support for accessibility. This class is not meant to be used directly by application developers but is instead meant only to be subclassed by component developers. Due to a restriction that protected inner classes cannot be subclassed outside of a package this inner class has been made public. When this restriction is lifted for JDK1.1.7 this class will be made protected. The class used to obtain the accessible role for this object.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JComponent.AccessibleJComponent, void addPropertyChangeListener(PropertyChangeListener)

AddAdds a PropertyChangeListener to the listener list. @param listener Thethe PropertyChangeListener to be added
Class JComponent.AccessibleJComponent, Accessible getAccessibleChild(int)

ReturnReturns the nth Accessible child of the object. @param i zero-based index of child @return the nth Accessible child of the object
Class JComponent.AccessibleJComponent, String getAccessibleDescription()

GetGets the accessible description of this object. This should be a concise localized description of what this object is - what is it'sits meaning to the user. If the object has a tooltip the tooltip text may be an appropriate string to return assuming it contains a concise description of the object (instead of just the name of the object - e.g.for example a "Save" icon on a toolbar that had "save" as the tooltip text shouldn't return the tooltip text as the description but something like "Saves the current text document" instead). @return the localized description of the object -- can be null if this object does not have a description @see AccessibleContext#setAccessibleDescription
Class JComponent.AccessibleJComponent, String getAccessibleName()

GetGets the accessible name of this object. This should almost never return java.awt.Component.getName() as that generally isn't a localized name and doesn't have meaning for the user. If the object is fundamentally a text object (e.g.such as a menu item) the accessible name should be the text of the object (e.g.for example "save"). If the object has a tooltip the tooltip text may also be an appropriate String to return. @return the localized name of the object -- can be null if this object does not have a name @see AccessibleContext#setAccessibleName
Class JComponent.AccessibleJComponent, AccessibleRole getAccessibleRole()

GetGets the role of this object. @return an instance of AccessibleRole describing the role of the object @see AccessibleRole
Class JComponent.AccessibleJComponent, AccessibleStateSet getAccessibleStateSet()

GetGets the state of this object. @return an instance of AccessibleStateSet containing the current state set of the object @see AccessibleState
Class JComponent.AccessibleJComponent, void removePropertyChangeListener(PropertyChangeListener)

RemoveRemoves a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. @param listener Thethe PropertyChangeListener to be removed
Class JComponent.AccessibleJComponent, void setBackground(Color)

Set the background color of this object. (For transparency see isOpaque.) @param c the new Color for the background @see JComponentComponent#isOpaque

Class JComponent, constructor JComponent()

Default JComponent constructor. This constructor does no initialization beyond calling the Container constructor e.g. For example the initial layout manager is null.
Class JComponent, void addAncestorListener(AncestorListener)

Registers listener so that it will receive AncestorEvents when it or any of its ancestors move or are made visible / invisible. Events are also sent when the component or its ancestors are added or removed from the Componentcontainment hierarchy This method will migrate to java.awt.Component in the next major JDK release @see AncestorEvent
Class JComponent, void addNotify()

NotificationNotifies to this component that it now has a parent component. When this method is invoked the chain of parent components is set up with KeyboardAction event listeners. @see #registerKeyboardAction
Class JComponent, void addPropertyChangeListener(PropertyChangeListener)

AddAdds a PropertyChangeListener to the listener list. The listener is registered for all properties.

A PropertyChangeEvent will get fired in response to setting a bound property e.g.such as setFont setBackground or setForeground. Note that if the current component is inheriting its foreground background or font from its container then no event will be fired in response to a change in the inherited property. This method will migrate to java.awt.Component in the next major JDK release @param listener Thethe PropertyChangeListener to be added

Class JComponent, void addPropertyChangeListener(String, PropertyChangeListener)

AddAdds a PropertyChangeListener for a specific property. The listener will be invoked only when a call on firePropertyChange names that specific property. If listener is null no exception is thrown and no action is performed. @param propertyName Thethe name of the property to listen on. @param listener Thethe PropertyChangeListener to be added
Class JComponent, void addVetoableChangeListener(VetoableChangeListener)

AddAdds a VetoableChangeListener to the listener list. The listener is registered for all properties. This method will migrate to java.awt.Component in the next major JDK release @param listener Thethe VetoableChangeListener to be added
Class JComponent, void computeVisibleRect(Rectangle)

Returns the Component's "visible rect rectangle" - the intersection of the visible rectangles for this component and all of its ancestors. The return value is stored in visibleRect. @see #getVisibleRect
Class JComponent, boolean contains(int, int)

GiveGives the UI delegate an opportunity to define the precise shape of this component for the sake of mouse processing. @return true if this component logically contains x y. @see java.awt.Component#contains(int int)
Class JComponent, void disable()

@deprecatedoverridden As of JDKto ensure Accessibility version 1.1 replaced by setEnabled(boolean).support
Class JComponent, void firePropertyChange(String, Object, Object)

SupportSupports for reporting bound property changes. If oldValue and newValue are not equal and the PropertyChangeEvent listener list isn't empty then fire a PropertyChange event to each listener. This method has an overloaded method for each primitive type. For example here's how to write a bound property set method whose value is an int:
 public void setFoo(int newValue) { int oldValue = foo; foo = newValue; firePropertyChange("foo" oldValue newValue); } 
This method will migrate to java.awt.Component in the next major JDK release @param propertyName Thethe programmatic name of the property that was changed. @param oldValue Thethe old value of the property. @param newValue Thethe new value of the property. @see java.beans.PropertyChangeSupport
Class JComponent, void fireVetoableChange(String, Object, Object)

SupportSupports for reporting constrained property changes. This method can be called when a constrained property has changed and it will send the appropriate PropertyChangeEvent to any registered VetoableChangeListeners. This method will migrate to java.awt.Component in the next major JDK release @exception PropertyVetoException when the attempt to set the property is vetoed by the receiver.
Class JComponent, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponent. @return the AccessibleContext of this JComponent
Class JComponent, ActionListener getActionForKeyStroke(KeyStroke)

ReturnReturns the object that will perform the action registered for a given keystroke. @return the ActionListener object invoked when the keystroke occurs @see #registerKeyboardAction
Class JComponent, float getAlignmentX()

Overrides Container.getAlignmentX to return the vertical alignment. @return the value of the alignmentX property. @see #setAlignmentX @see java.awt.Component#getAlignmentX
Class JComponent, float getAlignmentY()

Overrides Container.getAlignmentY to return the horizontal alignment. @return the value of the alignmentY property. @see #setAlignmentY @see java.awt.Component#getAlignmentY
Class JComponent, boolean getAutoscrolls()

Returns true if this component automatically scrolls its contents when dragged (when contained in a component that supports scrolling like JViewport). @see JViewport @see #setAutoscrolls
Class JComponent, Rectangle getBounds(Rectangle)

StoreStores the bounds of this component into "return value" rv and returnreturns rv. If rv is null a new Rectangle is allocated. This version of getBounds() is useful if the caller wants to avoid allocating a new Rectangle object on the heap. @param rv the return value modified to the componentscomponent's bounds @return rv
Class JComponent, Graphics getComponentGraphics(Graphics)

Returns the graphics object used to paint this component. If DebugGraphics is turned on we create a new DebugGraphics object if neccessarynecessary. otherwiseOtherwise we just configure the specified graphics objectsobject's foreground and font. @return Aa Graphics object configured for this component
Class JComponent, int getConditionForKeyStroke(KeyStroke)

ReturnReturns the condition that determines whether a registered action occurs in response to the specified keystroke.

For Java 2 platform v1.3 a KeyStroke can be associated with more than one condition. For example 'a' could be bound for the two conditions WHEN_FOCUSED and WHEN_IN_FOCUSED_WINDOW condition. @return the action-keystroke condition @see #registerKeyboardAction

Class JComponent, int getHeight()

ReturnReturns the current height of this component. This method is preferable to writing component.getBounds().height or component.getSize().height because it doesn't cause any heap allocations. This method will migrate to java.awt.Component in the next major JDK release @return the current height of this component.
Class JComponent, Insets getInsets()

If a border has been set on this component returns the border's insets; elseotherwise calls super.getInsets. @return the value of the insets property. @see #setBorder
Class JComponent, Insets getInsets(Insets)

Returns an Insets object containing this component's inset values. The passed-in Insets object will be reused if possible. Calling methods cannot assume that the same object will be returned however. All existing values within this object are overwritten. @param insets the Insets object which can be reused. @see #getInsets @beaninfo expert: true
Class JComponent, Point getLocation(Point)

StoreStores the x y origin of this component into "return value" rv and returnreturns rv. If rv is null a new Point is allocated. This version of getLocation() is useful if the caller wants to avoid allocating a new Point object on the heap. @param rv the return value modified to the componentscomponent's location @return rv
Class JComponent, Dimension getMaximumSize()

If the maximumSizemaximum size has been set to a non-null value just returnreturns it. If the UI delegatesdelegate's getMaximumSize() method returns a non null value then return that; otherwise defer to the componentscomponent's layout manager. @return the value of the maximumSize property. @see #setMaximumSize
Class JComponent, Dimension getMinimumSize()

If the minimumSizeminimum size has been set to a non-null value just returnreturns it. If the UI delegatesdelegate's getMinimumSize() method returns a non -null value then return that; otherwise defer to the componentscomponent's layout manager. @return the value of the minimumSize property. @see #setMinimumSize
Class JComponent, Component getNextFocusableComponent()

ReturnReturns the next focusable component or null if the focus manager should choose the next focusable component automatically.
Class JComponent, Dimension getPreferredSize()

If the preferredSize has been set to a non-null value just returnreturns it. If the UI delegatesdelegate's getPreferredSize() method returns a non null then value then return that; otherwise defer to the componentscomponent's layout manager. @return the value of the preferredSize property. @see #setPreferredSize
Class JComponent, KeyStroke[] getRegisteredKeyStrokes()

ReturnReturns the KeyStrokes that will initiate registered actions. @return an array of KeyStroke objects @see #registerKeyboardAction
Class JComponent, Dimension getSize(Dimension)

StoreStores the width/height of this component into "return value" rv and returnreturns rv. If rv is null a new Dimension object is allocated. This version of getSize() is useful if the caller wants to avoid allocating a new Dimension object on the heap. @param rv the return value modified to the componentscomponent's size @return rv
Class JComponent, Point getToolTipLocation(MouseEvent)

ReturnReturns the tooltip location in the receivingthis component's coordinate system. If null is returned Swing will choose a location. The default implementation returns null. @param event the MouseEvent that caused the ToolTipManager to show the tooltip.
Class JComponent, String getToolTipText()

ReturnReturns the tooltip string that has been set with setToolTipText(). @return the text of the tool tip @see #TOOL_TIP_TEXT_KEY
Class JComponent, String getToolTipText(MouseEvent)

Returns the string to be used as the tooltip for event. By default this returns any string set using setToolTipText(). If a component provides more extensizeextensive API to support differing tooltips at different locations this method should be overridden.
Class JComponent, Container getTopLevelAncestor()

Returns the top-level ancestor of this component (either the containing Window or Applet) or null if this component has not been added to any container. @return the top-level Container whichthat this component is in.
Class JComponent, String getUIClassID()

ReturnReturns the UIDefaults key used to look up the name of the swing.plaf.ComponentUI class that defines the look and feel for this component. Most applications will never need to call this method. Subclasses of JComponent that support pluggable look and feel should override this method to return a UIDefaults key that maps to the ComponentUI subclass that defines their look and feel. @return The UIDefaults key for a ComponentUI subclass. @see UIDefaults#getUI @beaninfo expert: true description: UIClassID
Class JComponent, Rectangle getVisibleRect()

Returns the Component's "visible rectangle" - the intersection of this componentscomponent's visible rectangle:
 new Rectangle(0 0 getWidth() getHeight()); 
and all of its ancestors' visible Rectangles. @return the visible rectangle
Class JComponent, int getWidth()

ReturnReturns the current width of this component. This method is preferable to writing component.getBounds().width or component.getSize().width because it doesn't cause any heap allocations. This method will migrate to java.awt.Component in the next major JDK release @return the current width of this component.
Class JComponent, int getX()

ReturnReturns the current x coordinate of the componentscomponent's origin. This method is preferable to writing component.getBounds().x or component.getLocation().x because it doesn't cause any heap allocations. This method will migrate to java.awt.Component in the next major JDK release @return the current x coordinate of the componentscomponent's origin.
Class JComponent, int getY()

ReturnReturns the current y coordinate of the componentscomponent's origin. This method is preferable to writing component.getBounds().y or component.getLocation().y because it doesn't cause any heap allocations. This method will migrate to java.awt.Component in the next major JDK release @return the current y coordinate of the componentscomponent's origin.
Class JComponent, void grabFocus()

SetSets the focus on the receiving component if it doesn't already have it. This method is for focus managers. youYou rarely want to call this method; use requestFocus() ensteadinstead.
Class JComponent, boolean hasFocus()

Returns true if this Component has the keyboard focus. This method will migrate to java.awt.Component in the next major JDK release @return true if this Component has the keyboard focus.
Class JComponent, boolean isDoubleBuffered()

ReturnReturns whether the receiving component should use a buffer to paint.
Class JComponent, boolean isLightweightComponent(Component)

Returns true if this component is a lightweight i.e.that is if it doesn't have a native window system peer. This method will migrate to java.awt.Component in the next major JDK release @return true if this component is a lightweight
Class JComponent, boolean isManagingFocus()

Override this method and return true if your JComponent manages focus. If your component manages focus the focus manager will handle your component's children. All key event will be sent to your key listener including TAB and SHIFT+TAB. CONTROL + TAB and CONTROL + SHIFT + TAB will move the focus to the next /or previous component.
Class JComponent, boolean isOpaque()

Returns true if this component is completely opaque.

An opaque component paints every pixel within its rectangular regionbounds. A non-opaque component paints only somea subset of its pixels or none at all allowing the pixels underneath it to "show through". ATherefore a component that does not fully paint its pixels therefore provides a degree of transparency.

Subclasses that guarantee to always completely paint their contents should override this method and return true. This method will migrate to java.awt.Component in the next major JDK release @return true if this component is completely opaque. @see #setOpaque

Class JComponent, boolean isOptimizedDrawingEnabled()

Returns true if this component tiles its children i.e.-- that is if it can guarantee that the children will not overlap. The repainting system is substantially more efficient in this common case. JComponent subclasses that can't make this guarantee e.g.such as JLayeredPane should override this method to return false. @return true if this componentscomponent's children don't overlap
Class JComponent, boolean isRequestFocusEnabled()

ReturnReturns whether the receiving component can obtain the focus by calling requestFocus. @see #setRequestFocusEnabled
Class JComponent, void paint(Graphics)

This method is invoked by Swing to draw components. Applications should not invoke paint directly but should instead use the repaint method to schedule the component for redrawing.

This method actually delegates the work of painting to three protected methods: paintComponent paintBorder and paintChildren. They're called in the order listed to ensure that children appear on top of component itself. Generally speaking the component and its children should not paint in the insets area allocated to the border. Subclasses can just override this method as always. A subclass that just wants to specialize the UI (look and feel) delegatesdelegate's paint method should just override paintComponent. @see #paintComponent @see #paintBorder @see #paintChildren @see #getComponentGraphics @see #repaint

Class JComponent, void paintBorder(Graphics)

PaintPaints the component's border. @see #paint @see #setBorder
Class JComponent, void paintChildren(Graphics)

PaintPaints this component's children. If shouldUseBuffer is true no component ancestor has a buffer and the component children can use a buffer if they have one. Otherwise one ancestor has a buffer currently in use and children should not use a buffer to paint. @see #paint @see java.awt.Container#paint
Class JComponent, void paintComponent(Graphics)

If the UI delegate is non-null callcalls its paint method. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (e.g.for example Graphics.translate()). @see #paint
Class JComponent, void paintImmediately(Rectangle)

PaintPaints the specified region now. This method will migrate to java.awt.Component in the next major JDK release
Class JComponent, void paintImmediately(int, int, int, int)

PaintPaints the specified region in this component and all of its descendants that overlap the region immediately.

It's rarely neccessarynecessary to call this method. In most cases it's more efficient to call repaint which defers the actual painting and can collapse redundant requests into a single paint call. This method is useful if one needs to update the display while the current event is being dispatched. @see #repaint

Class JComponent, String paramString()

Returns a string representation of this JComponent. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JComponent.
Class JComponent, void processComponentKeyEvent(KeyEvent)

ProcessProcesses any key events that the component itself recognizes. This will beis called after the focus manager and any interested listeners have been given a chance to steal away the event. This method will only beis called isonly if the event has not yet been consumed. This method is called prior to the keyboard UI logic.

This method is implemented to do nothing. Subclasses would normally override this method if they process some key events themselves. If the event is processed it should be consumed.

Class JComponent, void processKeyEvent(KeyEvent)

OverrideOverrides processKeyEvent to process events.
Class JComponent, void putClientProperty(Object, Object)

AddAdds an arbitrary key/value "client property" to this component.

The get/putClientProperty methods provide access to a small per-instance hashtable. Callers can use get/putClientProperty to annotate components that were created by another module e.g. For example a layout manager might store per child constraints this way. For example:

 componentA.putClientProperty("to the left of" componentB); 
If value is null this method will remove the property. Changes to client properties are reported with PropertyChange events. The name of the property (for the sake of PropertyChange events) is key.toString().

The clientProperty dictionary is not intended to support large scale extensions to JComponent nor should be it considered an alternative to subclassing when designing a new component. @see #getClientProperty @see #addPropertyChangeListener

Class JComponent, void registerKeyboardAction(ActionListener, KeyStroke, int)

CallsThis registerKeyboardAction(ActionListenermethod String KeyStrokeis now condition)obsolete withplease use a nullcombination of getActionMap() and getInputMap() for similiar commandbehavior.
Class JComponent, void registerKeyboardAction(ActionListener, String, KeyStroke, int)

This method is now obsolete please use a combination of getActionMap() and getInputMap() for similiar behavior. For example to bind the KeyStroke aKeyStroke to the Action anAction now use:
 component.getInputMap().put(aKeyStroke aCommand); component.getActionMap().put(aCommmand anAction); 
The above assumes you want the binding to be applicable for WHEN_FOCUSED. To register bindings for other focus states use the getInputMap method that takes an integer.

Register a new keyboard action. anAction will be invoked if a key event matching aKeyStroke occurs and aCondition is verified. The KeyStroke object defines a particular combination of a keyboard key and one or more modifiers (alt shift ctrl meta).

The aCommand will be set in the delivered event if specified.

The Condition can be one of:

WHEN_FOCUSED
The action will be invoked only when the keystroke occurs while the component has the focus.
WHEN_IN_FOCUSED_WINDOW
The action will be invoked when the keystroke occurs while the component has the focus or if the component is in the window that has the focus. Note that the component need not be an immediate descendent of the window -- it can be anywhere in the window's containment hierarchy. In other words whenever any component in the window has the focus the action registered with this component is invoked.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
The action will be invoked when the keystroke occurs while the component has the focus or if the component is an ancestor of the component that has the focus.

The combination of keystrokes and conditions lets you define high level (semantic) action events for a specified keystroke+modifier combination (using the KeyStroke class) and direct to a parent or child of a component that has the focus or to the component itself. In other words in any hierarchical structure of components an arbitrary key-combination can be immediately directed to the appropriate component in the hierarchy and cause a specific method to be invoked (usually by way of adapter objects).

If an action has already been registered for the receiving container with the same charCode and the same modifiers anAction will replace the action. @see KeyStroke

Class JComponent, void removeAncestorListener(AncestorListener)

Unregisters listener so that it will no longer receive AncestorEvents This method will migrate to java.awt.Component in the next major JDK release @see #addAncestorListener
Class JComponent, void removeNotify()

NotificationNotifies to this component that it no longer has a parent component. When this method is invoked any KeyboardActions set up in the the chain of parent components are removed. @see #registerKeyboardAction
Class JComponent, void removePropertyChangeListener(PropertyChangeListener)

RemoveRemoves a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. This method will migrate to java.awt.Component in the next major JDK release @param listener Thethe PropertyChangeListener to be removed
Class JComponent, void removePropertyChangeListener(String, PropertyChangeListener)

RemoveRemoves a PropertyChangeListener for a specific property. If listener is null no exception is thrown and no action is performed. @param propertyName Thethe name of the property that was listened on. @param listener Thethe PropertyChangeListener to be removed
Class JComponent, void removeVetoableChangeListener(VetoableChangeListener)

RemoveRemoves a VetoableChangeListener from the listener list. This removes a VetoableChangeListener that was registered for all properties. This method will migrate to java.awt.Component in the next major JDK release @param listener Thethe VetoableChangeListener to be removed
Class JComponent, boolean requestDefaultFocus()

RequestRequests the focus for the component that should have the focus by default. The default implementation will recursively request the focus on the first component that is focus-traversable. @return false if the focus has not been set otherwise return true
Class JComponent, void requestFocus()

SetSets focus on the receiving component if isRequestFocusEnabled returns true and the component doesn't already have focus.
Class JComponent, void resetKeyboardActions()

UnregisterUnregisters all keyboardthe actionsbindings @seein #registerKeyboardActionthe first tier InputMaps and ActionMap. This has the effect of removing any local bindings and allowing the bindings defined in parent InputMap/ActionMaps (the UI is usually defined in the second tier) to persist.
Class JComponent, void revalidate()

SupportSupports for deferred automatic layout.

Calls invalidate() and then adds this componentscomponent's validateRoot to a list of components that need to be validated. Validation will occur after all currently pending events have been dispatched. In other words after this method is called the first validateRoot (if any) found when walking up the containment hierarchy of this component will be validated. By default JRootPane JScrollPane and JTextField return true from isValidateRoot().

This method will automatically be called on this component when a property value changes such that size location or internal layout of this component has been affected. This automatic updating differs from the AWT because programs generally no longer need to invoke validate() to get the contents of the GUI to update.

@see java.awt.Component#invalidate @see java.awt.Container#validate @see #isValidateRoot @see RepaintManager#addInvalidComponent

Class JComponent, void scrollRectToVisible(Rectangle)

Forwards the scrollRectToVisible() message to the JComponent's parent. Components that can service the request such as a JViewport override this method and perform the scrolling. @see JViewport
Class JComponent, void setAlignmentX(float)

SetSets the the vertical alignment. @see #getAlignmentX @beaninfo description: The preferred horizontal alignment of the component.
Class JComponent, void setAlignmentY(float)

SetSets the the horizontal alignment. @see #getAlignmentY @beaninfo description: The preferred vertical alignment of the component.
Class JComponent, void setAutoscrolls(boolean)

If true this component will automatically scroll its contents when dragged if contained in a component that supports scrolling such as JViewport. @see JViewport @see #getAutoscrolls @beaninfo expert: true description: Whether this component automatically scrolls its contents when dragged.
Class JComponent, void setBorder(Border)

Sets the border of this component. The Border object is responsible for defining the insets for the component (overriding any insets set directly on the component) and for optionally rendering any border decorations within the bounds of those insets. Borders should be used (rather than insets) for creating both decorative and non-decorative (e.g.such as margins and padding) regions for a swing component. Compound borders can be used to nest multiple borders within a single component.

This is a bound property. @param border the border to be rendered for this component @see Border @see CompoundBorder @beaninfo bound: true preferred: true attribute: visualUpdate true description: The component's border.

Class JComponent, void setDebugGraphicsOptions(int)

Enables or disables diagnostic information about every graphics operation performed within the component or one of its children. The value of debugOptions determines how the component should display this information:
  • DebugGraphics.LOG_OPTION - causes a text message to be printed.
  • DebugGraphics.FLASH_OPTION - causes the drawing to flash several times.
  • DebugGraphics.BUFFERED_OPTION - creates an ExternalWindow that displays the operations performed on the View's offscreen buffer.
debug is bitwise OR'd into the current value. DebugGraphics.NONE_OPTION disables debugging. A value of 0 causes no changes to the debugging options. @beaninfo preferred: true enum: NONE_OPTION DebugGraphics.NONE_OPTION LOG_OPTION DebugGraphics.LOG_OPTION FLASH_OPTION DebugGraphics.FLASH_OPTION BUFFERED_OPTION DebugGraphics.BUFFERED_OPTION description: Diagnostic options for graphics operations.
Class JComponent, void setDoubleBuffered(boolean)

SetSets whether the receiving component should use a buffer to paint. If set to true all the drawing from this component will be done in an offscreen painting buffer. The offscreen painting buffer will the be copied onto the screen. Swing's painting system always use a maximum of one double buffer. If a Component is buffered and one of its ancestor is also buffered the ancestor buffer will be used.
Class JComponent, void setEnabled(boolean)

Sets whether or not this component is enabled. A component whichthat is enabled may respond to user input while a component whichthat is not enabled cannot respond to user input. Some components may alter their visual representation when they are disabled in order to provide feedback to the user that they cannot take input. @see java.awt.Component#isEnabled @beaninfo preferred: true bound: true attribute: visualUpdate true description: The enabled state of the component.
Class JComponent, void setMaximumSize(Dimension)

Sets the maximumSizemaximum size of this component to a constant value. Subsequent calls to getMaximumSize will always return this value; the componentscomponent's UI will not be asked to compute it. Setting the maximumSizemaximum size to null restores the default behavior. @see #getMaximumSize @beaninfo bound: true description: The maximum size of the component.
Class JComponent, void setMinimumSize(Dimension)

Sets the minimumSizeminimum size of this component to a constant value. Subsequent calls to getMinimumSize will always return this value; the componentscomponent's UI will not be asked to compute it. Setting the minimumSizeminimum size to null restores the default behavior. @see #getMinimumSize @beaninfo bound: true description: The minimum size of the component.
Class JComponent, void setOpaque(boolean)

If true the components background will be filled withcomponent paints every pixel within its the background colorbounds. Otherwise the background is transparent and whatevercomponent may not paint some isor all of its pixels allowing the underneath willunderlying pixels to show through.

The default value of this property is false for JComponent. This is a JavaBeans boundHowever the default value for this property on most standard JComponent subclasses (such as JButton and JTree) is look-and-feel dependent. @see #isOpaque @beaninfo bound: true expert: true description: The component's opacity

Class JComponent, void setPreferredSize(Dimension)

SetSets the preferred size of the receiving component. ifIf preferredSize is null the UI will be asked for the preferred size. @beaninfo preferred: true bound: true description: The preferred size of the component.
Class JComponent, void setRequestFocusEnabled(boolean)

SetSets whether the receiving component can obtain the focus by calling requestFocus. The default value is true. Note: Setting this property to false will not prevent the focus manager from setting the focus to this component it will prevent the component from getting the focus when the focus is requested explicitly. Override isFocusTraversable and return false if the component should never get the focus. @beaninfo expert: true description: Whether the component can obtain the focus by calling requestFocus.
Class JComponent, void setToolTipText(String)

Registers the text to display in a tool tip. The text displays when the cursor lingers over the component.

See How to Use Tool Tips in The Java Tutorial for further documentation. @param text Thethe string to display.; Ifif the text is null the tool tip is turned off for this component. @see #TOOL_TIP_TEXT_KEY @beaninfo preferred: true description: The text to display in a tool tip.

Class JComponent, void setUI(ComponentUI)

SetSets the look and feel delegate for this component. JComponent subclasses generally override this method to narrow the argument type e.g. For example in JSlider:
 public void setUI(SliderUI newUI) { super.setUI(newUI); } 

AdditionalyAdditionally JComponent subclasses must provide a getUI method that returns the correct type e.g. For example:

 public SliderUI getUI() { return (SliderUI)ui; } 
@see #updateUI @see UIManager#getLookAndFeel @see UIManager#getUI @beaninfo bound: true attribute: visualUpdate true description: The component's look and feel delegate.
Class JComponent, void unregisterKeyboardAction(KeyStroke)

UnregisterThis method is now obsolete. To unregister an existing binding you can either remove the binding from the ActionMap/InputMap or place a dummy binding the InputMap. Removing the binding from the InputMap allows bindings in parent InputMaps to be active whereas putting a dummy binding in the InputMap effectively disables the binding from ever happening.

Unregisters a keyboard action. @seeThis will remove the binding from the #registerKeyboardActionActionMap (if it exists) as well as the InputMaps.

Class JComponent, int UNDEFINED_CONDITION

Constant used by some of the apisAPIs to mean that no condition is defined.
Class JComponent, int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT

Constant used for registerKeyboardAction() whichthat means that the comandcommand should be invoked when the receiving component is an ancestor of the focused component or is itself the focused component.
Class JComponent, int WHEN_FOCUSED

Constant used for registerKeyboardAction() whichthat means that the command should be invoked when the component has the focus.
Class JComponent, int WHEN_IN_FOCUSED_WINDOW

Constant used for registerKeyboardAction() whichthat means that the command should be invoked when the receiving component is in the window that has the focus or is itself the focused component.
Class JComponent, AccessibleContext accessibleContext

---The Accessibility SupportAccessibleContext associated ---with JComponent will contain all of the methods in interface Accessible though it won't actally implement the interface - that will be up to the individual objects which extendthis JComponent.

Class JDesktopPane

A container used to create a multiple-document interface or a virtual desktop. You create JInternalFrame objects and add them to the JDesktopPane. JDesktopPane extends JLayeredPane to manage the potentially overlapping internal frames. It also maintains a reference to an instance of DesktopManager that is set by the UI class for the current Look and Feel (L&F).

This class is normally used as the parent of JInternalFrames to provide a pluggable DesktopManager object to the JInternalFrames. The installUI of the L&F specific implementation is responsible for setting the desktopManager variable appropriately. When the parent of a JInternalFrame is a JDesktopPane it should delegate most of its behavior to the desktopManager (closing resizing etc).

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JDesktopPane key assignments. For further documentation and examples see How to Use Internal Frames a section in The Java Tutorial.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JInternalFrame @see JInternalFrame.JDesktopIcon @see DesktopManager @version 1.26 1036 03/1514/9800 @author David Kloba


Class JDesktopPane.AccessibleJDesktopPane

TheThis class usedimplements toaccessibility support obtainfor the accessibleJDesktopPane class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to desktop pane user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JDesktopPane, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJDesktopPane. For desktop panes the AccessibleContext takes the form of an AccessibleJDesktopPane. A new AccessibleJDesktopPane instance is created if necessary. @return an AccessibleJDesktopPane that serves as the AccessibleContext of this JComponentJDesktopPane

Class JDialog

The main class for creating a dialog window. You can use this class to create a custom dialog or invoke the many staticclass methods in JOptionPane to create a variety of standard dialogs. For information about creating dialogs see The Java Tutorial section How to Make Dialogs.

The JDialog component contains a JRootPane as it'sits only child. The contentPane should be the parent of any children of the JDialog. From the older java.awt.Window object you would normally do something like this:

 dialog.add(child); 
Using JDialog the proper semantic is:
 dialog.getContentPane().add(child); 
The same priniciple holds true for setting layout managers removing components listing children etc. All these methods should normally be sent to the contentPane instead of to the JDialog. The contentPane is always non-null. Attempting to set it to null generates an exception. The default contentPane has a BorderLayout manager set on it.

Please see the JRootPane documentation for a complete description of the contentPane glassPane and layeredPane components.

NOTE: For 1.1 Modal dialogs are currently constrained to only allow lightweight popup menus (JPopupMenu JComboBox JMenuBar) because of window ownership limitations in AWT1.1. This creates the further limitation of not being able to mix Swing popup components with AWT heavyweight components in a modal dialog since the heavyweight components would always overlap the lightweights potentially obscuring the popup menu. (A heavyweight component uses a native-platform component (peer) component for its implementation -- AWT components are heavyweight components.) For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JDialog key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JOptionPane @see JRootPane @beaninfo attribute: isContainer true attribute: containerDelegate getContentPane description: A toplevel window for creating dialog boxes. @version 1.43 0451 03/2214/9900 @author David Kloba @author James Gosling @author Scott Violet


Class JDialog.AccessibleJDialog

TheThis class usedimplements toaccessibility support obtainfor the AccessibleRoleJDialog forclass. It provides an implementation of the Java Accessibility API appropriate to dialog thisuser-interface objectelements.
Class JDialog.AccessibleJDialog, AccessibleComponent getAccessibleComponent()

Get the AccessibleComponent associated with this object if one exists. Otherwise return null. @return the component
Class JDialog.AccessibleJDialog, void setBackground(Color)

Set the background color of this object. (For transparency see isOpaque.) @param c the new Color for the background @see Component#isOpaque

Class JDialog, constructor JDialog()

Creates a non-modal dialog without a title and without a specified Frame owner. A shared hidden frame will be set as the owner of the Dialogdialog.
Class JDialog, constructor JDialog(Dialog)

Creates a non-modal dialog without a title with the specifed Dialog as its owner. @param owner the Dialog from which the dialog is displayed
Class JDialog, constructor JDialog(Dialog, String)

Creates a non-modal dialog with the specified title and with the specified owner dialog. @param owner the Dialog from which the dialog is displayed @param title the String to display in the dialog's title bar
Class JDialog, constructor JDialog(Dialog, String, boolean)

Creates a modal or non-modal dialog with the specified title and the specified owner frame. @param owner the dialogDialog from which the dialog is displayed @param title the String to display in the dialog's title bar @param modal true for a modal dialog false for one that allows othersother windows to be active at the same time
Class JDialog, constructor JDialog(Dialog, boolean)

Creates a modal or non-modal dialog without a title and with the specified owner dialog.

@param owner the Dialog from which the dialog is displayed @param modal true for a modal dialog false for one that allows othersother windows to be active at the same time

Class JDialog, constructor JDialog(Frame)

Creates a non-modal dialog without a title with the specifed Frame as its owner. @param owner the Frame from which the dialog is displayed
Class JDialog, constructor JDialog(Frame, String)

Creates a non-modal dialog with the specified title and with the specified owner frame. @param owner the Frame from which the dialog is displayed @param title the String to display in the dialog's title bar
Class JDialog, constructor JDialog(Frame, String, boolean)

Creates a modal or non-modal dialog with the specified title and the specified owner frameFrame. All constructors defer to this one.

NOTE: Any popup components (JComboBox JPopupMenu JMenuBar) created within a modal dialog will be forced to be lightweight. @param owner the frameFrame from which the dialog is displayed @param title the String to display in the dialog's title bar @param modal true for a modal dialog false for one that allows othersother windows to be active at the same time

Class JDialog, constructor JDialog(Frame, boolean)

Creates a modal or non-modal dialog without a title and with the specified owner frameFrame. @param owner the Frame from which the dialog is displayed @param modal true for a modal dialog false for one that allows others windows to be active at the same time
Class JDialog, void addImpl(Component, Object, int)

By default children may not be added directly to a this component they must be added to its contentPane instead. For example:
 thisComponent.getContentPane().add(child) 
An attempt to add to directly to this component will cause an runtime exception to be thrown if rootPaneCheckingEnabled is true. Subclasses can disable this behavior. @param comp the Component to be enhanced @param constraints the constraints to be respected @param index the index (an integer) @see #setRootPaneCheckingEnabled @exception Error if called with rootPaneCheckingrootPaneCheckingEnabled true
Class JDialog, JRootPane createRootPane()

Called by the constructor methods to create the default rootPane.
Class JDialog, void dialogInit()

Called by the constructors to init the JDialog properly.
Class JDialog, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JDialog. For JDialogs the AccessibleContext takes the form of an AccessibleJDialog. A new AccessibleJDialog instance is created if necessary. @return an AccessibleJDialog that serves as the AccessibleContext of this JDialog
Class JDialog, Container getContentPane()

Returns the contentPane object for this dialog. @return the contentPane property @see #setContentPane @see RootPaneContainer#getContentPane
Class JDialog, int getDefaultCloseOperation()

Returns the operation which occurs when the user initiates a "close" on this dialog. @return an intinteger indicating the window-close operation @see #setDefaultCloseOperation
Class JDialog, Component getGlassPane()

Returns the glassPane object for this dialog. @return the glassPane property @see #setGlassPane @see RootPaneContainer#getGlassPane
Class JDialog, JLayeredPane getLayeredPane()

Returns the layeredPane object for this dialog. @return the layeredPane property @see #setLayeredPane @see RootPaneContainer#getLayeredPane
Class JDialog, JRootPane getRootPane()

Returns the rootPane object for this dialog. @see #setRootPane @see RootPaneContainer#getRootPane
Class JDialog, boolean isRootPaneCheckingEnabled()

Returns true if the methods add and setLayout should be checked. @return true if add and setLayout should be checked @see #addImpl @see #setLayout @see #setRootPaneCheckingEnabled
Class JDialog, String paramString()

Returns a string representation of this JDialog. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JDialog.
Class JDialog, void setContentPane(Container)

Sets the contentPane property. This method is called by the constructor. @param contentPane the contentPane object for this dialog @exception java.awt.IllegalComponentStateException (a runtime exception) if the content pane parameter is null @see #getContentPane @see RootPaneContainer#setContentPane @beaninfo hidden: true description: The client area of the dialog where child components are normally inserted.
Class JDialog, void setDefaultCloseOperation(int)

Sets the operation which will happen by default when the user initiates a "close" on this dialog. The possible choices are:
  • DO_NOTHING_ON_CLOSE - do not do anything - require the program to handle the operation in the windowClosing method of a registered WindowListener object.
  • HIDE_ON_CLOSE - automatically hide the dialog after invoking any registered WindowListener objects
  • DISPOSE_ON_CLOSE - automatically hide and dispose the dialog after invoking any registered WindowListener objects EXIT_ON_CLOSE - Exit the application by way of System.exit. Only use this in applications.

The value is set to HIDE_ON_CLOSE by default. @see #addWindowListener @see #getDefaultCloseOperation @beaninfo preferred: true description: The dialog's default close operation.

Class JDialog, void setGlassPane(Component)

Sets the glassPane property. This method is called by the constructor. @param glassPane the glassPane object for this dialog @see #getGlassPane @see RootPaneContainer#setGlassPane @beaninfo hidden: true description: A transparent pane used for menu rendering.
Class JDialog, void setLayeredPane(JLayeredPane)

Sets the layeredPane property. This method is called by the constructor. @param layeredPane the layeredPane object fornew thislayeredPane dialogproperty @exception java.awt.IllegalComponentStateException (a runtime exception) if the layered pane parameter is null @see #getLayeredPane @see RootPaneContainer#setLayeredPane @beaninfo hidden: true description: The pane which holds the various dialog layers.
Class JDialog, void setLayout(LayoutManager)

By default the layout of this component may not be set the layout of its contentPane should be set instead. For example:
 thisComponent.getContentPane().setLayout(new BorderLayout()) 
An attempt to set the layout of this component will cause an runtime exception to be thrown if rootPaneCheckingEnabled is true. Subclasses can disable this behavior. @see #setRootPaneCheckingEnabled @param manager the LayoutManager @exception Error if called with rootPaneChecking true
Class JDialog, void setRootPane(JRootPane)

Sets the rootPane property. This method is called by the constructor. @param root the rootPane object for this dialog @see #getRootPane @beaninfo hidden: true description: the RootPane object for this dialog.
Class JDialog, void setRootPaneCheckingEnabled(boolean)

If true then calls to add() and setLayout() will cause an exception to be thrown. @see #addImpl @see #setLayout @see #isRootPaneCheckingEnabled @beaninfo hidden: true description: Whether the add and setLayout methods throw exceptions when invoked.
Class JDialog, void update(Graphics)

JustCalls calls paint(g). This method was overridden to prevent an unneccessary call to clear the background.

Class JEditorPane

A text component to edit various kinds of content. You can find how-to information and examples of using editor panes in Using Text Components a section in The Java Tutorial.

This component uses implementations of the EditorKit to accomplish its behavior. It effectively morphs into the proper kind of text editor for the kind of content it is given. The content type that editor is bound to at any given time is determined by the EditorKit currently installed. If the content is set to a new URL its type is used to determine the EditorKit that should be used to load the content.

By default the following types of content are known:

text/plain
Plain text which is the default the type given isn't recognized. The kit used in this case is an extension of DefaultEditorKit that produces a wrapped plain text view.
text/html
HTML text. The kit used in this case is the class javax.swing.text.html.HTMLEditorKit which provides htmlHTML 3.2 support.
text/rtf
RTF text. The kit used in this case is the class javax.swing.text.rtf.RTFEditorKit which provides a limited support of the Rich Text Format.

There are several ways to load content into this component.

  1. The setText method can be used to initialize the component from a string. In this case the current EditorKit will be used and the content type will be expected to be of this type.
  2. The read method can be used to initialize the component from a Reader. Note that if the content type is htmlHTML relative references (e.g. for things like images) can't be resolved unless the <base> tag is used or the Base property on HTMLDocument is set. In this case the current EditorKit will be used and the content type will be expected to be of this type.
  3. The setPage method can be used to initialize the component from a URL. In this case the content type will be determined from the URL and the registered EditorKit for that content type will be set.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JEditorPane key assignments.

Some kinds of content may provide hyperlink support by generating hyperlink events. The htmlHTML EditorKit will generate hyperlink events if the JEditorPane is not editable (i.e. JEditorPane.setEditable(false); has been called). If htmlHTML frames are embedded in the document the typical response would be to change a portion of the current document. The following code fragment is a possible hyperlink listener implementation that treats htmlHTML frame events specially and simply displays any other activated hyperlinks.

   class Hyperactive implements HyperlinkListener {     public void hyperlinkUpdate(HyperlinkEvent e) {   if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {   JEditorPane pane = (JEditorPane) e.getSource();   if (e instanceof HTMLFrameHyperlinkEvent) {   HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e;   HTMLDocument doc = (HTMLDocument)pane.getDocument();   doc.processHTMLFrameHyperlinkEvent(evt);   } else {   try {   pane.setPage(e.getURL());   } catch (Throwable t) {   t.printStackTrace();   }   }   }   }   } 

Culturally dependent information in some documents is handled through a mechanism called character encoding. Character encoding is an unambiguous mapping of the members of a character set (letters ideographs digits symbols or control functions) to specific numeric code values. It represents the way the file is stored. Example character encodings are ISO-8859-1 ISO-8859-5 Shift-jis Euc-jp and UTF-8. When the file is passed to an user agent (JEditorPane) it is converted to the document character set (ISO-10646 aka Unicode).

There are multiple ways to get a character set mapping to happen with JEditorPane.

  1. One way is to specify the character set as a parameter of the MIME type. This will be established by a call to the setContentType method. If the content is loaded by the setPage method the content type will have been set according to the specification of the URL. It the file is loaded directly the content type would be expected to have been set prior to loading.
  2. Another way the character set can be specified is in the document itself. This requires reading the document prior to determining the character set that is desired. To handle this it is expected that the EditorKit.read operation throw a ChangedCharSetException which will be caught. The read is then restarted with a new Reader that uses the character set specified in the ChangedCharSetException (which is an IOException).

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A text component to edit various types of content. @author Timothy Prinzing @version 1.76 0496 03/2214/9900


Class JEditorPane.AccessibleJEditorPane

TheThis class usedimplements toaccessibility support obtainfor the accessibleJEditorPane class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to editor pane user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JEditorPane.AccessibleJEditorPaneHTML

This class provides support for AccessibleHypertext and is used in instances where the EditorKit installed in this JEditorPane is an instance of HTMLEditorKit.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for baseline for serialized form of Swing objects.


Class JEditorPane.JEditorPaneAccessibleHypertextSupport

What's returned by AccessibleJEditorPaneHTML.getAccessibleText(). Provides support for AccessibleHypertext in case there is an HTML document being displayed in this JEditorPane.

Class JEditorPane, constructor JEditorPane()

ConstructsCreates a new JEditorPane. The document model is set to null.
Class JEditorPane, constructor JEditorPane(String)

Creates a JEditorPane based on a string containing a URL specification. @param url the URL @exception IOException if the URL is null or cannot be accessed
Class JEditorPane, constructor JEditorPane(String, String)

Creates a JEditorPane that has been initialized to the given text. This is a convenience constructor that calls the setContentType and setText methods. @param type mime type of the given text. @param text the text to initialize with.
Class JEditorPane, constructor JEditorPane(URL)

Creates a JEditorPane based on a specified URL for input. @param initialPage the URL @exception IOException if the URL is null or cannot be accessed
Class JEditorPane, EditorKit createDefaultEditorKit()

Creates the default editor kit (PlainEditorKit) for when the component is first created. @return the editor kit
Class JEditorPane, EditorKit createEditorKitForContentType(String)

CreateCreates a handler for the given type from the default registry of editor kits. The registry is created if necessary. If the registered class has not yet been loaded an attempt is made to dynamically load the prototype of the kit for the given type. If the type was registered with a ClassLoader that ClassLoader will be used to load the prototype. If there was no registered ClassLoader Class.forName will be used to load the prototype.

Once a prototype EditorKit instance is successfully located it is cloned and the clone is returned. @param type the content type @return the editor kit or null if there is nothing registered for the given type.

Class JEditorPane, void fireHyperlinkUpdate(HyperlinkEvent)

Notifies all listeners that have registered interest for notification on this event type. This is normally called by the currently installed EditorKit if a content type that supports hyperlinks is currently active and there was activity with a link. The listener list is processed last to first. @param e the event @see EventListenerList
Class JEditorPane, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JEditorPane. For editor panes the AccessibleContext takes the form of an AccessibleJEditorPane. A new contextAccessibleJEditorPane instance is created if necessary. @return an AccessibleJEditorPane that serves as the AccessibleContext of this JEditorPane
Class JEditorPane, String getContentType()

Gets the type of content that this editor is currently set to deal with. This is defined to be the type associated with the currently installed EditorKit. @return the content type null if no editor kit set
Class JEditorPane, EditorKit getEditorKit()

Fetches the currently installed kit for handling content. createDefaultEditorKit() is called to set up a default if necessary. @return the editor kit
Class JEditorPane, EditorKit getEditorKitForContentType(String)

Fetches the editor kit to use for the given type of content. This is called when a type is requested that doesn't match the currently installed type. If the component doesn't have an EditorKit registered for the given type it will try to create an EditorKit from the default EditorKit registry. If that fails a PlainEditorKit is used on the assumption that all text documents can be represented as plain text.

This method can be reimplemented to use some other kind of type registry. This can be reimplemented to use the Java Activation Framework for example. @param type the non-null content type @return the editor kit

Class JEditorPane, URL getPage()

Gets the current urlURL being displayed. If a URL was not specified in the creation of the document this will return null and relative URL's will not be resolved. @return the URL or null if none
Class JEditorPane, Dimension getPreferredSize()

Returns the preferred size for the JEditorPane. The preferred size for JEditorPane is slightly altered from the preferred size of the superclass. If the size of the viewport has become smaller than the minimum size of the component the Scrollablescrollable definition for tracking width or height will turn to false. The default viewport layout will give the preferred size and that is not desired in the case where the scrollable is tracking. In that case the normal preferred size is adjusted to the minimum size. This allows things like htmlHTML tables to shrink down to their minimum size and then be laid out at their minimum size refusing to shrink any further. @return a Dimension containing the preferred size
Class JEditorPane, boolean getScrollableTracksViewportHeight()

Returns true if a viewport should always force the height of this Scrollable to match the height of the viewport. @return true if a viewport should force the ScrollablesScrollable's height to match its own. false otherwise
Class JEditorPane, boolean getScrollableTracksViewportWidth()

Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport. @return true if a viewport should force the Scrollables width to match its own. false otherwise
Class JEditorPane, InputStream getStream(URL)

FetchFetches a stream for the given urlURL which is about to be loaded by the setPage method. By default this simply opens the urlURL and returns the stream. This can be reimplemented to do useful things like fetch the stream from a cache monitor the progress of the stream etc.

This method is expected to have the the side effect of establisingestablishing the content type and therefore setting the appropriate EditorKit to use for loading the stream.

If this the stream was an http connection redirects will be followed and the resulting URL will be set as the Document.StreamDescriptionProperty so that relative URL's can be properly resolved. @param page the URL of the page

Class JEditorPane, String getText()

Returns the text contained in this TextComponent in terms of the content type of this editor. If an exception is thrown while attempting to retrieve the text null will be returned. This is implemented to call JTextComponent.write with a StringWriter. @return the text @see #setText
Class JEditorPane, String getUIClassID()

Gets the class ID for the UI. @return the IDstring ("EditorPaneUI") @see JComponent#getUIClassID @see UIDefaults#getUI
Class JEditorPane, boolean isFocusCycleRoot()

OverrideMakes thisJEditorPane method and returnbe the root trueof a focus cycle. This if your component ismeans that by default tabbing within the rooteditor pane will move between components of the pane such as form controls but not out of athe pane. component

Note tree with its own focus cyclethat this method always returns true. @see JComponent#isFocusCycleRoot @return true

Class JEditorPane, boolean isManagingFocus()

Turns off tab traversal once focus is gained. @return true to indicate that the focus is being managed; or false otherwise
Class JEditorPane, String paramString()

Returns a string representation of this JEditorPane. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JEditorPane.
Class JEditorPane, void processComponentKeyEvent(KeyEvent)

Make sure that TABOverridden to handle processing of tab/shift tab. If e identifies a tab the editor pane is not editable and Shift-TABhas events get consumedcomponents then the soFocusManager that awtis asked doesn'tto attemptpass focus traversalto the next/previous component. @param e the current key event
Class JEditorPane, void processKeyEvent(KeyEvent)

Override processKeyEvent to processMake sure that TAB and Shift-TAB events get consumed so that awt doesn't attempt focus traversal. @param e the current key event
Class JEditorPane, void read(InputStream, Object)

This method initializes from a stream. If the kit is set to be of type HTMLEditorKit and the desc parameter is an HTMLDocument then it invokes the HTMLEditorKit to initiate the read. Otherwise it calls the superclass method which loads the model as plain text. @param in Thethe stream from which to read from @param desc Anan object describing the stream. @exception IOException as thrown by the stream being used to initialize. @see JTextComponent#read @see #setDocument
Class JEditorPane, void registerEditorKitForContentType(String, String)

Establishes the default bindings of type to nameclassname. The class will be dynamically loaded later when actually needed and can be safely changed before attempted uses to avoid loading unwanted classes. The prototype EditorKit will be loaded with Class.forName when registered with this method. @param type the non-null content type @param classname the class to load later
Class JEditorPane, void registerEditorKitForContentType(String, String, ClassLoader)

Establishes the default bindings of type to nameclassname. The class will be dynamically loaded later when actually needed using the given ClassLoader and can be safely changed before attempted uses to avoid loading unwanted classes. @param type the non-null content type @param classname the class to load later @param loader the ClassLoader to use to load the name
Class JEditorPane, void replaceSelection(String)

Replaces the currently selected content with new content represented by the given string. If there is no selection this amounts to an insert of the given text. If there is no replacement text (i.e. the content string is empty or null) this amounts to a removal of the current selection. The replacement text will have the attributes currently defined for input. If the documentcomponent is not editable beep and return. Then if the document is null do nothing. If the content to insert is null or empty ignore it.

This method is thread safe although most Swing methods are not. Please see Threads and Swing for more information. @param content the content to replace the selection with. This value can be null

Class JEditorPane, void scrollToReference(String)

ScrollScrolls the view to the given reference location (i.e.that is the value returned by the UL.getRef method for the urlURL being displayed). By default this method only knows how to locate a reference in an HTMLDocument. The implementation calls the scrollRectToVisible method to accomplish the actual scrolling. If scrolling to a reference location is needed for document types other than htmlHTML this method should be reimplemented. This method will have no effect if the component is not visible. @param reference the named location to scroll to.
Class JEditorPane, void setContentType(String)

Sets the type of content that this editor handles. This calls getEditorKitForContentType and then setEditorKit if an editor kit can be successfully located. This is mostly convenience method that can be used as an alternative to calling setEditorKit directly.

If there is a charset definition specified as a parameter of the content type specification it will be used when loading input streams using the associated EditorKit. For example if the type is specified as text/html; charset=EUC-JP the content will be loaded using the EditorKit registered for text/html and the Reader provided to the EditorKit to load unicode into the document will use the EUC-JP charset for translating to unicode. @param type the non-null mime type for the content editing support. @see #getContentType @beaninfo description: the type of content

Class JEditorPane, void setEditorKit(EditorKit)

Sets the currently installed kit for handling content. This is the bound property that establishes the content type of the editor. Any old kit is first deinstalled then if kit is non-null the new kit is installed and a default document created for it. A PropertyChange event ("editorKit") is always fired when setEditorKit() is called.

NOTE: This has the side effect of changing the model because the EditorKit is the source of how a particular type of content is modeled. This method will cause setDocument to be called on behalf of the caller to insureensure integrity of the internal state. @param kit the desired editor behavior. @see #getEditorKit @beaninfo description: the currently installed kit for handling content bound: true expert: true

Class JEditorPane, void setEditorKitForContentType(String, EditorKit)

Directly setsets the editor kit to use for the given type. A look-and-feel implementation might use this in conjunction with createEditorKitForContentType to install handlers for content types with a look-and-feel bias. @param type the non-null content type @param k the editor kit to be set
Class JEditorPane, void setPage(String)

Sets the current urlURL being displayed. @param url the URL for display @exception IOException for a null or invalid URL specification
Class JEditorPane, void setPage(URL)

Sets the current urlURL being displayed. The content type of the pane is set and if the editor kit for the pane is non-null then a new default document is created and the URL is read into it. If the urlURL contains and reference location the location will be scrolled to by calling the scrollToReference method. If the desired URL is not the one currently being displayed the getStream method is called to give subclasses control over the stream provided.

This may load either synchronously or asynchronously depending upon the document returned by the EditorKit. If the Document is of type AbstractDocument and has a value returned by AbstractDocument.getAsynchronousLoadPriority that is greater than or equal to zero the page will be loaded on a seperateseparate thread using that priority.

If the document is loaded synchronously it will be filled in with the stream prior to being installed into the editor with a call to setDocument which is bound and will fire a property change event. If an IOException is thrown the partially loaded document will be discarded and neither the document or page property change events will be fired. If the document is successfully loaded and installed a view will be built for it by the UI which will then be scrolled if necessary and then the page property change event will be fired.

If the document is loaded asynchronously the document will be installed into the editor immediately using a call to setDocument which will fire a document property change event then a thread will be created which will begin doing the actual loading. In this case the page property change event will not be fired by the call to this method directly but rather will be fired when the thread doing the loading has finished. Since the calling thread can not throw an IOException in the event of failure on the other thread the page property change event will be fired when the other thread is done whether the load was successful or not. @param page the URL of the page @exception IOException for a null or invalid page specification or exception from the stream being read. @see #getPage @beaninfo description: the URL used to set content bound: true expert: true

Class JEditorPane, void setText(String)

Sets the text of this TextComponent to the specified content which is expected to be in the format of the content type of this editor. For example if the type is set to text/html the string should be specified in terms of htmlHTML.

This is implemented to remove the contents of the current document and replace them by parsing the given string using the current EditorKit. This gives the semantics of the superclass by not changing out the model while supporting the content type currently set on this component. The assumption is that the previous content is relatively small and that the previous content doesn't have side effects. Both of those assumptions can be violated and cause undesirable results. To avoid this create a new document getEditorKit().createDefaultDocument() and replace the existing Document with the new one. You are then assured the previous Document won't have any lingering state.

  1. Leaving the existing model in place means that the old view will be torn down and a new view created where replacing the document would avoid the tear down of the old view.
  2. Some formats (such as htmlHTML) can install things into the document that can influence future contents. HTML can have style information embedded that would influence the next content installed unexpectedly.

An alternative way to load this component with a string would be to create a StringReader and call the read method. In this case the model would be replaced after it was initialized with the contents of the string.

This method is thread safe although most Swing methods are not. Please see Threads and Swing for more information. @param t the new text to be set @see #getText @beaninfo description: the text of this component


Class JFileChooser

JFileChooser provides a simple mechanism for the user to chooserchoose a file. For information about using JFileChooser see How to Use File Choosers a section in The Java Tutorial.

The following code pops up a file chooser infor the usersuser's home directory that only sees only .jpg and .gif images:

 JFileChooser chooser = new JFileChooser(); // Note: source for ExtensionFileFilterExampleFileFilter can be found in theFileChooserDemo // under SwingSetthe demo/jfc directory in ExtensionFileFilterthe Java 2 SDK Standard Edition. ExampleFileFilter filter = new ExtensionFileFilterExampleFileFilter(); filter.addExtension("jpg"); filter.addExtension("gif"); filter.setDescription("JPG & GIF Images"); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(parent); if(returnVal == JFileChooser.APPROVE_OPTION) { System.out.println("You chose to open this file: " + chooser.getSelectedFile().getName()); } 
@beaninfo attribute: isContainer false description: A component which allows for the interactive selection of a font. @version 1.49 0465 03/2214/9900 @author Jeff Dinkins

Class JFileChooser.AccessibleJFileChooser

TheThis class usedimplements toaccessibility support obtainfor the accessibleJFileChooser class. It contextprovides foran implementation of the Java Accessibility API appropriate to file chooser thisuser-interface objectelements.
Class JFileChooser.AccessibleJFileChooser, AccessibleRole getAccessibleRole()

GetGets the role of this object. @return an instance of AccessibleRole describing the role of the object @see AccessibleRole

Class JFileChooser, constructor JFileChooser()

CreatesConstructs a JFileChooser pointing to the user's home directory.
Class JFileChooser, constructor JFileChooser(File)

CreatesConstructs a JFileChooser using the given File as the path. Passing in a null file causes the file chooser to point to the usersuser's home directory. @param directorycurrentDirectory a File object specifying the path to a file or directory
Class JFileChooser, constructor JFileChooser(File, FileSystemView)

CreatesConstructs a JFileChooser using the given current directory and FileSystemView.
Class JFileChooser, constructor JFileChooser(FileSystemView)

CreatesConstructs a JFileChooser using the given FileSystemView.
Class JFileChooser, constructor JFileChooser(String)

CreatesConstructs a JFileChooser using the given path. Passing in a null string causes the file chooser to point to the usersuser's home directory. @param pathcurrentDirectoryPath a String giving the path to a file or directory
Class JFileChooser, constructor JFileChooser(String, FileSystemView)

CreatesConstructs a JFileChooser using the given current directory path and FileSystemView.
Class JFileChooser, boolean accept(File)

Returns true if the file should be displayed. @param f the File @return true if the file should be displayed otherwise false @see FileFilter#accept
Class JFileChooser, void addActionListener(ActionListener)

addsAdds an ActionListener to the button. @param l the listener to be added
Class JFileChooser, void addChoosableFileFilter(FileFilter)

Adds a filter to the list of user choosable file filters. @param filter the FileFilter to add to the choosable file filter list @beaninfo preferred: true bound: true description: Adds a filter to the list of user choosable file filters. @ see #getChoosableFileFilters @ see #removeChoosableFileFilter @ see #resetChoosableFileFilter
Class JFileChooser, void approveSelection()

Called by the UI when the user hits the approveApprove button (AKAlabeled "Open" or "Save") buttonby default). This can also bybe called by the programmer.
Class JFileChooser, void cancelSelection()

Called by the UI when the user hitschooses the cancelCancel button. This can also be called by the programmer.
Class JFileChooser, void ensureFileIsVisible(File)

MakeMakes sure that the specified file is viewable and not hidden. @param f a File object
Class JFileChooser, void fireActionPerformed(String)

NotifyNotifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. @see EventListenerList
Class JFileChooser, FileFilter getAcceptAllFileFilter()

Returns the AcceptAll file filter (e.g. (For example on Win32 this would be All Files (*.*) on windows).
Class JFileChooser, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JFileChooser. For file choosers the AccessibleContext takes the form of an AccessibleJFileChooser. A new AccessibleJFileChooser instance is created if necessary. @return an AccessibleJFileChooser that serves as the AccessibleContext of this JFileChooser
Class JFileChooser, JComponent getAccessory()

ReturnReturns the accessory component. @return this JFileChooser's accessory component or null @see #setAccessory
Class JFileChooser, int getApproveButtonMnemonic()

Returns the approve button's mnemonic. @return an intinteger value for the mnemonic key @see #setApproveButtonMnemonic
Class JFileChooser, String getApproveButtonText()

Returns the text used in the ApproveButton in the FileChooserUI. If null the UI object will determine the button's text. Typically this would be "Open" or "Save". @return the text used in the ApproveButton @see #setApproveButtonText @see #setDialogType @see #showDialog
Class JFileChooser, String getApproveButtonToolTipText()

Returns the tooltip text used in the ApproveButton. If null the UI object will determine the button's text. @return the text used in the ApproveButton @see #setApproveButtonText @see #setDialogType @see #showDialog
Class JFileChooser, FileFilter[] getChoosableFileFilters()

Gets the list of user choosable file filters. @return a FileFilter array containing all the choosable file filters @ see #addChoosableFileFilter @ see #removeChoosableFileFilter @ see #resetChoosableFileFilter
Class JFileChooser, String getDescription(File)

Returns the file description. @param f the File @return the String containing the file description for f @see FileView#getDescription
Class JFileChooser, String getDialogTitle()

Gets the string that goes in the FileChooserJFileChooser's titlebar. @see #setDialogTitle
Class JFileChooser, int getDialogType()

Returns the type of this dialog. The default is JFileChooser.OPEN_DIALOG. @return the type of dialog to be displayed:
  • JFileChooser.OPEN_DIALOG
  • JFileChooser.SAVE_DIALOG
  • JFileChooser.CUSTOM_DIALOG
@see #setDialogType
Class JFileChooser, FileFilter getFileFilter()

Returns the currently selected file filter. @return the current file filter. @see #setFileFilter @see #addChoosableFileFilter
Class JFileChooser, int getFileSelectionMode()

Returns the current file-selection mode. @paramThe default anis intJFilesChooser.FILES_ONLY. indicating@return the type of dialogfiles to be displayed one of the following:
  • JFileChooser.FILES_ONLY
  • JFileChooser.DIRECTORIES_ONLY
  • JFileChooser.FILES_AND_DIRECTORIES
@see #setFileSelectionMode
Class JFileChooser, FileSystemView getFileSystemView()

Returns the file system view. @return the FileSystemView object @see #setFileSystemView
Class JFileChooser, Icon getIcon(File)

Returns the icon for this file or type of file depending on the system. @param f the File @return the Icon for this file or type of file @see FileView#getIcon
Class JFileChooser, String getName(File)

Returns the file namefilename. @param f the File @return the String containing the filename for f @see FileView#getName
Class JFileChooser, File getSelectedFile()

Returns the selected file. This can be set either by the programmer via setFile() or by a user action such as either typing the filename intinto the UI or selecting the file from a list in the UI. @see #setSelectedFile @return the selected file
Class JFileChooser, File[] getSelectedFiles()

Returns a list of selected files if the filechooserfile chooser is set to allow multi-multiple selection.
Class JFileChooser, String getTypeDescription(File)

Returns the file type. @param f the File @return the String containing the file type description for f @see FileView#getTypeDescription
Class JFileChooser, String getUIClassID()

Returns a string that specifies the name of the L&F class that renders this component. @return the string "ButtonUIFileChooserUI" @see JComponent#getUIClassID @see UIDefaults#getUI @beaninfo expert: true description: A string that specifies the name of the L&F class.
Class JFileChooser, boolean isDirectorySelectionEnabled()

Convenience call that determines if directories are selectable based on the current file selection mode. @see #setFileSelectionMode @see #getFileSelectionMode
Class JFileChooser, boolean isFileHidingEnabled()

IfReturns true if hidden files are not shown in the filechooserfile chooser; otherwise returns false. @return the status of the file hiding property @see #setFileHidingEnabled
Class JFileChooser, boolean isFileSelectionEnabled()

Convenience call that determines if files are selectable based on the current file selection mode. @see #setFileSelectionMode @see #getFileSelectionMode
Class JFileChooser, boolean isMultiSelectionEnabled()

Returns true if multiple files can be selected. @return true if multiple files can be selected. @see #setMultiSelectionEnabled
Class JFileChooser, boolean isTraversable(File)

Returns true if the file (directory) can be visited. Returns false if the directory cannot be traversed. @param f the File @return true if the file/directory can be traversed otherwise false @see FileView#isTraversable
Class JFileChooser, String paramString()

Returns a string representation of this JFileChooser. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JFileChooser.
Class JFileChooser, void removeActionListener(ActionListener)

removesRemoves an ActionListener from the button. @param l the listener to be removed
Class JFileChooser, boolean removeChoosableFileFilter(FileFilter)

Removes a filter from the list of user choosable file filters. Returns true if the file filter was removed;. @ see #addChoosableFileFilter @ see #getChoosableFileFilters @ see #resetChoosableFileFilter
Class JFileChooser, void rescanCurrentDirectory()

Tells the UI to rescan it'sits files list from the current directory.
Class JFileChooser, void resetChoosableFileFilters()

Resets the choosable file filter list to its starting state. Normally this removes all added file filters while leaving the AcceptAll file filter. @see #addChoosableFileFilter @see #getChoosableFileFilters @see #removeChoosableFileFilter
Class JFileChooser, void setAccessory(JComponent)

Sets the accessory component. An accessory is often used to show a preview image of the selected file; however it can be used for anything that the programmer wishes - such as extra custom file chooser controls.

Note: if there was a previous accessory you should unregister any listeners that the accessory might have registered with the file chooser. @beaninfo preferred: true bound: true description: Sets the accessory component on the FileChooserJFileChooser.

Class JFileChooser, void setApproveButtonMnemonic(char)

Sets the approve button's mnemonic using a character. @param anmnemonic a charcharacter value for the mnemonic key @see #getApproveButtonMnemonic
Class JFileChooser, void setApproveButtonMnemonic(int)

Sets the approve button's mnemonic using a numeric keycode. @param mnemonic an intinteger value for the mnemonic key @beaninfo preferred: true bound: true description: The mnemonic key accelerator for the ApproveButton. @see #getApproveButtonMnemonic
Class JFileChooser, void setApproveButtonText(String)

Sets the text used in the ApproveButton in the FileChooserUI. @beaninfo preferred: true bound: true description: The text that goes in the AprroveButtonApproveButton. @param approveButtonText the text used in the ApproveButton @see #getApproveButtonText @see #setDialogType @see #showDialog
Class JFileChooser, void setApproveButtonToolTipText(String)

Sets the tooltip text used in the ApproveButton. If null the UI object will determine the button's text. @beaninfo preferred: true bound: true description: The tooltip text for the ApproveButton. @return the text used in the ApproveButton @see #setApproveButtonText @see #setDialogType @see #showDialog
Class JFileChooser, void setCurrentDirectory(File)

Sets the current directory. Passing in null sets the filechooserfile chooser to point to the usersuser's home directory. If the file passed in as currentDirectory is not a directory the parent of the file will be used as the currentDirectory. If the parent is not traversable then it will walk up the parent tree until it finds a traversable direcotrydirectory or hits the root of the file system. @beaninfo preferred: true bound: true description: theThe directory that the FileChooserJFileChooser is showing files of. @param currentDirectorydir the current directory to point to @see #getCurrentDirectory
Class JFileChooser, void setDialogTitle(String)

Sets the string that goes in the FileChooserJFileChooser window's title bar. @param dialogTitle the new String for the title bar @beaninfo preferred: true bound: true description: The title of the FileChooserJFileChooser dialog window. @see #getDialogTitle
Class JFileChooser, void setDialogType(int)

Sets the type of this dialog. Use OPEN_DIALOG when you want to bring up a filechooserfile chooser that the user can use to open a file. Likewise use SAVE_DIALOG for letting the user choose a file for saving. Use CUSTOM_DIALOG when you want to use the filechooserfile chooser in a context other than "Open" or "Save". For instance you might want to bring up a filechooserfile chooser that allows the user to choose a file to execute. Note that you normally would not need to set the FileChooserJFileChooser to use CUSTOM_DIALOG since a call to setApproveButtonText does this for you. The default dialog type is JFileChooser.OPEN_DIALOG. @param dialogType the type of dialog to be displayed:
  • JFileChooser.OPEN_DIALOG
  • JFileChooser.SAVE_DIALOG
  • JFileChooser.CUSTOM_DIALOG
@exception IllegalArgumentException if dialogType is not legal @beaninfo preferred: true bound: true description: The type (open save custom) of the FileChooserJFileChooser. enum: OPEN_DIALOG JFileChooser.OPEN_DIALOG SAVE_DIALOG JFileChooser.SAVE_DIALOG CUSTOM_DIALOG JFileChooser.CUSTOM_DIALOG @see #getDialogType @see #setApproveButtonText
Class JFileChooser, void setFileFilter(FileFilter)

Sets the current File Filterfile filter. The file filter is used by the filechooserfile chooser to filter out files from view from the user's view. @beaninfo preferred: true bound: true description: Sets the File Filter used to filter out files of type. @param filter the new current file filter to use @see #getFileFilter
Class JFileChooser, void setFileHidingEnabled(boolean)

Sets file hiding on or off. If true hidden files are not shown in the filechooserfile chooser. The job of determining which files are showshown is done by the FileView. @beaninfo preferred: true bound: true description: Sets file hiding on or off. @param b the boolean value that determines whether file hiding is turned on or not. @see #isFileHidingEnabled
Class JFileChooser, void setFileSelectionMode(int)

Sets the FileChooserJFileChooser to allow the user to just select files just select directories or select both files and directories. The default is JFilesChooser.FILES_ONLY. @param mode the type of files to be displayed:
  • JFileChooser.FILES_ONLY
  • JFileChooser.DIRECTORIES_ONLY
  • JFileChooser.FILES_AND_DIRECTORIES
@exception IllegalArgumentException if mode is an illegal Dialog mode
@beaninfo preferred: true bound: true description: Sets the types of files that the FileChooserJFileChooser can choose. enum: FILES_ONLY JFileChooser.FILES_ONLY DIRECTORIES_ONLY JFileChooser.DIRECTORIES_ONLY FILES_AND_DIRECTORIES JFileChooser.FILES_AND_DIRECTORIES @param dialogType the type of dialog to be displayed: FILES_ONLY DIRECTORIES_ONLY FILES_AND_DIRECTORIES @see #getFileSelectionMode
Class JFileChooser, void setFileSystemView(FileSystemView)

Sets the file system view whichthat the JFileChooser uses to accessfor accessing and createcreating file system resoucesresources such as finding the floppy drive and getting a list of root drives. @param fsv the new FileSystemView @beaninfo expert: true bound: true description: Sets the FileSytemView used to get filesystem information. @see FileSystemView
Class JFileChooser, void setFileView(FileView)

Sets the file view to used to retrieve UI information such as the icon that represents a file or the type description of a file. @beaninfo preferred: true bound: true description: Sets the File View used to get file type information. @see #getFileView
Class JFileChooser, void setMultiSelectionEnabled(boolean)

Sets the filechooserfile chooser to allow multiple file selections.

NOTE: this functionality is not yet implemented in the current L&Fs. @beaninfo bound: true description: Sets multiple file selection mode. @see #isMultiSelectionEnabled

Class JFileChooser, void setSelectedFile(File)

Sets the selected file. If the file's parent directory is not the current directory changes the current directory to be the file's parent directory. @beaninfo preferred: true bound: true @see #getSelectedFile @param selectedFilefile the selected file
Class JFileChooser, void setSelectedFiles(File[])

Sets the list of selected files if the filechooserfile chooser is set to allow multi-multiple selection. @beaninfo bound: true description: theThe list of selected files if the chooser is in multi-multiple selection mode.
Class JFileChooser, void setup(FileSystemView)

PerformPerforms common constructor initialization and setup.
Class JFileChooser, int showDialog(Component, String)

Pops a custom file chooser dialog with a custom ApproveButton.approve e.gbutton. filechooser.showDialog(parentWindowFor "Runexample Application");the wouldfollowing code poppops up a filechooserfile chooser with a "Run Application" button (instead of the normal "Save" or "Open" button):
 filechooser.showDialog(parentFrame "Run Application"); 
Alternatively the following code willdoes do the same thing:
 JFileChooser chooser = new JFileChooser(null); chooser.setApproveButtonText("Run Application"); chooser.showDialog(thisparentFrame null); 
<--PENDING(jeff) - the following method should be added to the api: showDialog(Component parent);--> <--PENDING(kwalrath) - should specify modality and what "depends" means.-->

The parent argument determines two things: the frame on which the open dialog depends and the component whose position the look and feel should consider when placing the dialog. If the parent is a Frame object (such as a JFrame) then the dialog depends on the frame and the look and feel positions the dialog relative to the frame (for example centered over the frame). If the parent is a component then the dialog depends on the frame containing the component and is positioned relative to the component (for example centered over the component). If the parent is null then the dialog depends on no visible window and it's placed in a look-and-feel-dependent position such as the center of the screen. @param parent the parent component of the dialog; can be null @param approveButtonText the text of the ApproveButton @return the return state of the filechooserfile chooser on popdown:

  • JFileChooser.CANCEL_OPTION
  • JFileChooser.APPROVE_OPTION
  • JFileCHooser.ERROR_OPTION if an error occurs or the dialog is dismissed
Class JFileChooser, int showOpenDialog(Component)

Pops up an "Open File" file chooser dialog. Note that the text that appears in the approve button is determined by the L&F. @param parent the parent component of the dialog can be null; see showDialog for details @return the return state of the filechooserfile chooser on popdown:
  • JFileChooser.CANCEL_OPTION
  • JFileChooser.APPROVE_OPTION
  • JFileCHooser.ERROR_OPTION if an error occurs or the dialog is dismissed
@see #showDialog
Class JFileChooser, int showSaveDialog(Component)

Pops up a "Save File" file chooser dialog. Note that the text that appears in the approve button is determined by the L&F. @param parent the parent component of the dialog can be null; see showDialog for details @return the return state of the filechooserfile chooser on popdown:
  • JFileChooser.CANCEL_OPTION
  • JFileChooser.APPROVE_OPTION
  • JFileCHooser.ERROR_OPTION if an error occurs or the dialog is dismissed
@see #showDialog
Class JFileChooser, void updateUI()

Notification from the UIFactory that the L&F has changed. @see JComponent#updateUI
Class JFileChooser, String ACCESSORY_CHANGED_PROPERTY

Says that a different accessory component is in use. (Forfor example to preview files.).
Class JFileChooser, String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY

Identifies change in the mnemonic for the approve (yes ok) button .
Class JFileChooser, String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY

Identifies change in the tooltip text for the approve (yes ok) button .
Class JFileChooser, String APPROVE_SELECTION

Instruction to approve the current selection (Samesame as pressing yes or ok.).
Class JFileChooser, String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY

Identifies a change in the list of predefined file filters the user can choose from.
Class JFileChooser, int CUSTOM_DIALOG

Type value indicating that the FileChooserJFileChooser supports a developer-specified sepcified file operation.
Class JFileChooser, String DIALOG_TYPE_CHANGED_PROPERTY

Identifies a change in the type of files displayed (files only directories only or both files and directories).
Class JFileChooser, int OPEN_DIALOG

Type value indicating that the FileChooserJFileChooser supports an "Open" file operation.
Class JFileChooser, int SAVE_DIALOG

Type value indicating that the FileChooserJFileChooser supports a "Save" file operation.
Class JFileChooser, String SELECTED_FILES_CHANGED_PROPERTY

IdentifesIdentifies change in user's multiple-file selection.
Class JFileChooser, String SELECTED_FILE_CHANGED_PROPERTY

IdentifesIdentifies change in user's single-file selection.

Class JFrame

An extended version of java.awt.Frame that adds support for interposing input and painting behavior in frontthe ofJFC/Swing thecomponent frame'sarchitecture. childrenYou (seecan glassPane)find supporttask-oriented for special childrendocumentation about using thatJFrame arein managedThe byJava aTutorial LayeredPanein (seethe rootPane)section andHow for Swingto Make MenuBarsFrames.

The JFrame class is slightly incompatible with java.awt.Frame. Like all other JFC/Swing top-level containers a JFrame contains a JRootPane as it'sits only child. The contentPanecontent pane should beprovided by the parentroot of any childrenpane should as ofa rule contain all the non-menu components displayed by the JFrame. This is different thanfrom java.awt.the AWT Frame e.gcase. For example to add a child to an AWT Frameframe you'd write:

 frame.add(child); 
However using JFrame you need to add the child to the JFramesJFrame's contentPanecontent pane instead:
 frame.getContentPane().add(child); 
The same is true for setting LayoutManagerslayout managers removing components listing children etcand so on. All these methods should normally be sent to the contentPane()content pane instead of the JFrame itself. The contentPane()content pane will always be non-null. Attempting to set it to null will cause the JFrame to throw an exception. The default contentPane()content pane will have a BorderLayout manager set on it.

Please see the JRootPane documentation for a complete description of the contentPane glassPane and layeredPane properties. Unlike its parent classa java.awt.Frame youa canJFrame tell ahas some JFramenotion of how to respond when the user attempts to close the window. The default behavior is to simply hide the JFrame when the user closes the window. To change the default behavior you invoke the method #setDefaultCloseOperation. To make the JFrame remain open unless you handlebehave the window-closing event andsame explicitly invokeas a dispose()Frame (or exit the appinstance which is also pretty effective) use setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE). That makes the JFrame behave the same as

For more information on content panes and java.awt.Frameother features that root panes provide see Using Top-Level Containers in The Java Tutorial. A

In thirda optionmulti-screen letsenvironment you completelycan dispose ofcreate a theJFrame window when it closeson a different screen insteaddevice. ofSee java.awt.Frame merely hiding itfor more information.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JFrame key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JRootPane @see #setDefaultCloseOperation @see java.awt.event.WindowListener#windowClosing @beaninfo attribute: isContainer true attribute: containerDelegate getContentPane description: A toplevel window which can be minimized to an icon. @version 1.6577 0403/2214/9900 @author Jeff Dinkins @author Georges Saab @author David Kloba


Class JFrame.AccessibleJFrame

TheThis class usedimplements toaccessibility support obtainfor the AccessibleRoleJFrame forclass. It provides an implementation of the Java Accessibility API appropriate to frame thisuser-interface objectelements.
Class JFrame.AccessibleJFrame, AccessibleComponent getAccessibleComponent()

Get the AccessibleComponent associated with this object if one exists. Otherwise return null. @return the component
Class JFrame.AccessibleJFrame, void setBackground(Color)

Set the background color of this object. (For transparency see isOpaque.) @param c the new Color for the background @see Component#isOpaque

Class JFrame, constructor JFrame()

Constructs a new Frameframe that is initially invisible. @see Component#setSize @see Component#setVisible
Class JFrame, constructor JFrame(String)

ConstructsCreates a new initially invisible Frame with the specified title. @param title the title for the frame @see Component#setSize @see Component#setVisible
Class JFrame, void addImpl(Component, Object, int)

By default children may not be added directly to a this component they must be added to its contentPane instead. For example:
 thisComponent.getContentPane().add(child) 
An attempt to add to directly to this component will cause an runtime exception to be thrown. Subclasses can disable this behavior. @seeparam #setRootPaneCheckingEnabledcomp the component to be enhanced @param constraints the constraints to be respected @param index the index @exception Error if called with rootPaneChecking true @see #setRootPaneCheckingEnabled
Class JFrame, JRootPane createRootPane()

Called by the constructor methods to create the default rootPane.
Class JFrame, void frameInit()

Called by the constructors to init the JFrame properly.
Class JFrame, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JFrame. For JFrames the AccessibleContext takes the form of an AccessibleJFrame. A new AccessibleJFrame instance is created if necessary. @return an AccessibleJFrame that serves as the AccessibleContext of this JFrame
Class JFrame, Container getContentPane()

Returns the contentPane object for this frame. @return the contentPane property @see #setContentPane @see RootPaneContainer#getContentPane
Class JFrame, int getDefaultCloseOperation()

Returns the operation whichthat occurs when the user initiates a "close" on this frame. @return an intinteger indicating the window-close operation @see #setDefaultCloseOperation
Class JFrame, Component getGlassPane()

Returns the glassPane object for this frame. @return the glassPane property @see #setGlassPane @see RootPaneContainer#getGlassPane
Class JFrame, JMenuBar getJMenuBar()

Returns the menubar set on this frame. @return the menubar for this frame @see #setJMenuBar
Class JFrame, JLayeredPane getLayeredPane()

Returns the layeredPane object for this frame. @return the layeredPane property @see #setLayeredPane @see RootPaneContainer#getLayeredPane
Class JFrame, JRootPane getRootPane()

Returns the rootPane object for this frame. @return the rootPane property @see #setRootPane @see RootPaneContainer#getRootPane
Class JFrame, boolean isRootPaneCheckingEnabled()

Returns whether calls to add and setLayout cause an exception to be thrown. @return true if add and setLayout are checked; false otherwise @see #addImpl @see #setLayout @see #setRootPaneCheckingEnabled
Class JFrame, String paramString()

Returns a string representation of this JFrame. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JFrame.
Class JFrame, void setContentPane(Container)

Sets the contentPane property. This method is called by the constructor. @param contentPane the contentPane object for this frame @exception java.awt.IllegalComponentStateException (a runtime exception) if the content pane parameter is null @see #getContentPane @see RootPaneContainer#setContentPane @beaninfo hidden: true description: The client area of the frame where child components are normally inserted.
Class JFrame, void setDefaultCloseOperation(int)

Sets the operation whichthat will happen by default when the user initiates a "close" on this frame. The possibleYou choices are defined inmust specify one of the WindowConstantsfollowing interfacechoices:

  • DO_NOTHING_ON_CLOSE -(defined doin WindowConstants): notDon't do anything -; require the program to handle the operation in the windowClosing method of a registered WindowListener object.
  • HIDE_ON_CLOSE -(defined in WindowConstants): automaticallyAutomatically hide the frame after invoking any registered WindowListener objects.
  • DISPOSE_ON_CLOSE (defined in -WindowConstants): automaticallyAutomatically hide and dispose the frame after invoking any registered WindowListener objects.
  • EXIT_ON_CLOSE (defined in -JFrame): Exit the application by wayusing ofthe System. exit. Onlymethod. useUse this only in applications.

The value is set to HIDE_ON_CLOSE by default. @see #addWindowListener @see #getDefaultCloseOperation @see WindowConstants @beaninfo preferred: true enum: DO_NOTHING_ON_CLOSE WindowConstants.DO_NOTHING_ON_CLOSE HIDE_ON_CLOSE WindowConstants.HIDE_ON_CLOSE DISPOSE_ON_CLOSE WindowConstants.DISPOSE_ON_CLOSE EXIT_ON_CLOSE 3JFrame.EXIT_ON_CLOSE description: The frame's default close operation.

Class JFrame, void setGlassPane(Component)

Sets the glassPane property. This method is called by the constructor. @param glassPane the glassPane object for this frame @see #getGlassPane @see RootPaneContainer#setGlassPane @beaninfo hidden: true description: A transparent pane used for menu rendering.
Class JFrame, void setLayeredPane(JLayeredPane)

Sets the layeredPane property. This method is called by the constructor. @param layeredPane the layeredPane object for this frame @exception java.awt.IllegalComponentStateException (a runtime exception) if the layered pane parameter is null @see #getLayeredPane @see RootPaneContainer#setLayeredPane @beaninfo hidden: true description: The pane whichthat holds the various frame layers.
Class JFrame, void setLayout(LayoutManager)

By default the layout of this component may not be set the layout of its contentPane should be set instead. For example:
 thiComponent.getContentPane().setLayout(new BorderLayout()) 
An attempt to set the layout of this component will cause an runtime exception to be thrown. Subclasses can disable this behavior. @seeparam #setRootPaneCheckingEnabledmanager the LayoutManager @exception Error if called with rootPaneChecking true @see #setRootPaneCheckingEnabled
Class JFrame, void setRootPane(JRootPane)

Sets the rootPane property. This method is called by the constructor. @param root the rootPane object for this frame @see #getRootPane @beaninfo hidden: true description: the RootPane object for this frame.
Class JFrame, void setRootPaneCheckingEnabled(boolean)

Determines whether calls to add and setLayout will cause an exception to be thrown. @param enabled a boolean value true if checking is to be enabled which causecauses the exceptions to be thrown @see #addImpl @see #setLayout @see #isRootPaneCheckingEnabled @beaninfo hidden: true description: Whether the add and setLayout methods throw exceptions when invoked.
Class JFrame, void update(Graphics)

Just calls paint(g). This method was overridden to prevent an unneccessaryunnecessary call to clear the background. @param g the Graphics context in which to paint
Class JFrame, AccessibleContext accessibleContext

The accessible context property.
Class JFrame, JRootPane rootPane

The JRootPane instance that manages the contentPane and optional menuBar for this frame as well as the glassPane. @see JRootPane @see RootPaneContainer
Class JFrame, boolean rootPaneCheckingEnabled

If true then calls to add and setLayout will cause an exception to be thrown. The default is false. @see #isRootPaneCheckingEnabled @see #setRootPaneCheckingEnabled

Class JInternalFrame

A lightweight object that provides many of the features of a native frame including dragging closing becoming an icon resizing title display and support for a menu bar. GenerallyFor youtask-oriented create an instance anddocumentation and examples of addusing internal frames itsee How to Use Internal Frames a JDesktopPane.section Lookin andThe feelJava specific-actionsTutorial. are then

Generally (automaticallyyou )add delegatedJInternalFrames to thea DesktopManagerJDesktopPane. object maintained byThe UI delegates the JDesktopPanelook-and-feel-specific (asactions to the DesktopManager setobject maintained by the UI)JDesktopPane.

The JInternalFrame contentPane is where you add child components. So to create a JInternalFrame that has a number of buttons arranged with a BorderLayout object you might do something like this:

 JComponent c = (JComponent) frame.getContentPane(); c.setLayout(new BorderLayout()); c.add(new JButton() BorderLayout.NORTH); c.add(new JButton() BorderLayout.CENTER); 
The contentPane is actually managed by an instance of JRootPane which also manages a layoutPane glassPane and optional menuBar for the frame. Please see the JRootPane documentation for a complete description of these components.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JInternalFrame key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JDesktopPane @see DesktopManager @see JInternalFrame.JDesktopIcon @see JRootPane @version 1.93112 03/0814/00 @author David Kloba @author Rich Schiavi @beaninfo attribute: isContainer true attribute: containerDelegate getContentPane description: A frame container which is contained within another window.


Class JInternalFrame.AccessibleJInternalFrame

TheThis class usedimplements toaccessibility support obtainfor the accessibleJInternalFrame class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to internal frame user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JInternalFrame.AccessibleJInternalFrame, String getAccessibleName()

Get the accessible name of this object. This should almost never return java.awt.Component.getName() as that generally isn't a localized name and doesn't have meaning for the user. If the object is fundamentally a text object (e.g. a menu item) the accessible name should be the text of the object (e.g. "save"). If the object has a tooltip the tooltip text may also be an appropriate String to return. @return the localized name of the object -- can be null if this object does not have a name @see #setAccessibleName
Class JInternalFrame.AccessibleJInternalFrame, AccessibleValue getAccessibleValue()

Get the AccessibleValue associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object

Class JInternalFrame.JDesktopIcon.AccessibleJDesktopIcon

TheThis class usedimplements toaccessibility support obtainfor the accessibleJInternalFrame.JDesktopIcon class. role forIt provides thisan implementation of the Java Accessibility API appropriate to desktop icon user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JInternalFrame.JDesktopIcon.AccessibleJDesktopIcon, AccessibleValue getAccessibleValue()

Get the AccessibleValue associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object

Class JInternalFrame.JDesktopIcon, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJDesktopIcon. For desktop icons the AccessibleContext takes the form of an AccessibleJDesktopIcon. A new AccessibleJDesktopIcon instance is created if necessary. @return an AccessibleJDesktopIcon that serves as the AccessibleContext of this JComponentJDesktopIcon

Class JInternalFrame, constructor JInternalFrame()

Creates a non-resizable non-closable non-maximizable non-iconifiable JInternalFrame with no title.
Class JInternalFrame, constructor JInternalFrame(String)

Creates a non-resizable non-closable non-maximizable non-iconifiable JInternalFrame with the specified title. @param title the String to display in the title bar.
Class JInternalFrame, constructor JInternalFrame(String, boolean)

Creates a non-closable non-maximizable non-iconifiable JInternalFrame with the specified title and with resizability specified. @param title the String to display in the title bar. @param resizable if true the frame can be resized
Class JInternalFrame, constructor JInternalFrame(String, boolean, boolean)

Creates a non-maximizable non-iconifiable JInternalFrame with the specified title and with resizability and closability specified. @param title the String to display in the title bar. @param resizable if true the frame can be resized @param closable if true the frame can be closed
Class JInternalFrame, constructor JInternalFrame(String, boolean, boolean, boolean)

Creates a non-iconifiable JInternalFrame with the specified title and with resizability closability and maximizability specified. @param title the String to display in the title bar. @param resizable if true the frame can be resized @param closable if true the frame can be closed @param maximizable if true the frame can be maximized
Class JInternalFrame, constructor JInternalFrame(String, boolean, boolean, boolean, boolean)

Creates a JInternalFrame with the specified title and with resizability closability maximizability and iconifiability specified. All constructors defer to this one. @param title the String to display in the title bar. @param resizable if true the frame can be resized @param closable if true the frame can be closed @param maximizable if true the frame can be maximized @param iconifiable if true the frame can be iconified
Class JInternalFrame, void addImpl(Component, Object, int)

By default children may not be added directly to a this component they must be added to its contentPane instead. For example:
 thisComponent.getContentPane().add(child) 
An attempt to add to directly to this component will cause an runtime exception to be thrown. Subclasses can disable this behavior. @see #setRootPaneCheckingEnabled @exception Error if called with rootPaneCheckingisRootPaneChecking true
Class JInternalFrame, JRootPane createRootPane()

Called by the constructor to set up the JRootPane. @return a new JRootPane @see JRootPane
Class JInternalFrame, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJInternalFrame. For internal frames the AccessibleContext takes the form of an AccessibleJInternalFrame. A new AccessibleJInternalFrame instance is created if necessary. @return an AccessibleJInternalFrame that serves as the AccessibleContext of this JComponentJInternalFrame
Class JInternalFrame, Component getGlassPane()

Returns the glassPane object for this frame. @return the glassPane object @see RootPaneContainer#setGlassPane
Class JInternalFrame, JMenuBar getJMenuBar()

Returns the current JMenuBar for this JInternalFrame or null if no menu bar has been set. @return the JMenuBar used by this frame @see #setJMenuBar
Class JInternalFrame, JLayeredPane getLayeredPane()

Returns the layeredPane object for this frame. @return the layeredPane object @see RootPaneContainer#setLayeredPane @see RootPaneContainer#getLayeredPane
Class JInternalFrame, JMenuBar getMenuBar()

Returns the current JMenuBar for this JInternalFrame or null if no menu bar has been set. @return the current menubar or null if none has been set @deprecated As of Swing version 1.0.3 replaced by getJMenuBar().
Class JInternalFrame, JRootPane getRootPane()

Returns the rootPane object for this frame. @return the rootPane property @see RootPaneContainer#getRootPane
Class JInternalFrame, String getTitle()

Returns the title of the JInternalFrame. @return a String containing the frame's title @see #setTitle
Class JInternalFrame, InternalFrameUI getUI()

Returns the L&F object that renders this component. @return the InternalFrameUI object that renders this component
Class JInternalFrame, String getUIClassID()

Returns the name of the L&F class thatwhich renders this component. @return the string "InternalFrameUI" @see JComponent#getUIClassID @see UIDefaults#getUI @beaninfo description: UIClassID
Class JInternalFrame, boolean isClosable()

Returns whether this JInternalFrame be closed by some user action. @return true if the frame can be closed
Class JInternalFrame, boolean isClosed()

Returns whether this JInternalFrame is currently closed. @return true if the frame is closed
Class JInternalFrame, boolean isIcon()

Returns whether the JInternalFrame is currently iconified. @return true if the frame is iconified
Class JInternalFrame, boolean isIconifiable()

Returns whether the JInternalFrame can be iconified by some user action. @return true if the frame can be iconified
Class JInternalFrame, boolean isMaximizable()

Returns whether the JInternalFrame can be maximized by some user action. @return true if the frame can be maximized
Class JInternalFrame, boolean isMaximum()

Returns whether the JInternalFrame is currently maximized. @return true if the frame is maximized
Class JInternalFrame, boolean isResizable()

Returns whether the JInternalFrame can be resized by some user action. @return true if the frame can be resized
Class JInternalFrame, void moveToBack()

Convenience method that moves this component to position -1 if it'sits parent is a JLayeredPane.
Class JInternalFrame, void moveToFront()

Convenience method that moves this component to position 0 if it'sits parent is a JLayeredPane.
Class JInternalFrame, void setClosable(boolean)

SetSets that this JInternalFrame can be closed by some user action. @param b a boolean value where true means the frame can be closed @beaninfo preferred: true bound: true description: Indicates whether this frame can be closed.
Class JInternalFrame, void setClosed(boolean)

Calling this method with a value of true to close the frame. @param b a boolean where true means "close the frame" @exception PropertyVetoException when the attempt to set the property is vetoed by the receiver.JInternalFrame @beaninfo bound: true constrained: true description: Indicates that the frame has been closed.
Class JInternalFrame, void setContentPane(Container)

Sets this JInternalFrame's content pane. @param contentPanec the contentPane object for this frame @exception java.awt.IllegalComponentStateException (a runtime exception) if the content pane parameter is null @see RootPaneContainer#getContentPane @beaninfo bound: true hidden: true description: The client area of the frame where child components are normally inserted.
Class JInternalFrame, void setDefaultCloseOperation(int)

Sets the operation which will happen by default when the user initiates a "close" on this window. The possible choices are:

  • DO_NOTHING_ON_CLOSE - do not do anything - require the program to handle the operation in the windowClosing method of a registered InternalFrameListener object.
  • HIDE_ON_CLOSE - automatically hide the window after invoking any registered InternalFrameListener objects
  • DISPOSE_ON_CLOSE - automatically hide and dispose the window after invoking any registered InternalFrameListener objects EXIT_ON_CLOSE - Exit the application by way of System.exit. Only use this in applications.

The value is set to HIDEDISPOSE_ON_CLOSE by default. @see #addInternalFrameListener @see #getDefaultCloseOperation

Class JInternalFrame, void setGlassPane(Component)

Sets this JInternalFrame's glassPane property. @param glassPane the glassPane object for this frame @see RootPaneContainer#getGlassPane @beaninfo bound: true hidden: true description: A transparent pane used for menu rendering.
Class JInternalFrame, void setIcon(boolean)

Iconizes and deconizesde-iconizes the frame. @param b a boolean where true means to iconify the frame and false means to deiconifyde-iconify it @exception PropertyVetoException when the attempt to set the property is vetoed by the receiver.JInternalFrame @beaninfo bound: true constrained: true description: The image displayed when this frame is minimized.
Class JInternalFrame, void setIconifiable(boolean)

SetSets that the JInternalFrame can be made an icon by some user action. @param b a boolean where true means the frame can be iconified @beaninfo: preferred: true bound: true description: Determines whether this frame can be iconified.
Class JInternalFrame, void setJMenuBar(JMenuBar)

Sets the JMenuBar for this JInternalFrame. @param m the JMenuBar to use in this frame @see #getJMenuBar @beaninfo bound: true preferred: true description: The menubar for accessing pulldown menus from this frame.
Class JInternalFrame, void setLayeredPane(JLayeredPane)

Sets this JInternalFrame's layeredPane property. @param layeredPanelayered the layeredPane object for this frame @exception java.awt.IllegalComponentStateException (a runtime exception) if the layered pane parameter is null @see RootPaneContainer#setLayeredPane @beaninfo hidden: true bound: true description: The pane which holds the various desktop layers.
Class JInternalFrame, void setLayout(LayoutManager)

By default the layout of this component may not be set the layout of its contentPane should be set instead. For example:
 thiComponentthisComponent.getContentPane().setLayout(new BorderLayout()) 
An attempt to set the layout of this component will cause an runtime exception to be thrown. Subclasses can disable this behavior. @param manager the LayoutManager @see #setRootPaneCheckingEnabled @exception Error if called with rootPaneCheckingisRootPaneChecking true
Class JInternalFrame, void setMaximizable(boolean)

SetSets that the JInternalFrame can be maximized by some user action. @param b a boolean where true means the frame can be maximized @beaninfo bound: true preferred: true description: Determines whether this frame can be maximized.
Class JInternalFrame, void setMaximum(boolean)

Maximizes and restores the frame. A maximized frame is resized to fully fit the JDesktopPane area associated with the JInternalFrame. A restored frame's size is set to the JInternalFrame's actual size. @param b a boolean where true maximizes the frame and false restores it @exception PropertyVetoException when the attempt to set the property is vetoed by the receiver.JInternalFrame @beaninfo bound: true constrained: true description: Indicates whether the frame is maximized.
Class JInternalFrame, void setMenuBar(JMenuBar)

Sets the JMenuBar for this JInternalFrame. @param m the JMenuBar to use in this frame @see #getJMenuBar @deprecated As of Swing version 1.0.3 replaced by setJMenuBar(JMenuBar m).
Class JInternalFrame, void setResizable(boolean)

SetSets that the JInternalFrame can be resized by some user action. @param b a boolean where true means the frame can be resized @beaninfo preferred: true bound: true description: Determines whether the frame can be resized by the user.
Class JInternalFrame, void setRootPane(JRootPane)

SetSets the rootPane property. This method is called by the constructor. @param root the new rootPane object @beaninfo bound: true hidden: true beaninfodescription: The rootPane used by this frame.
Class JInternalFrame, void setSelected(boolean)

Selects and deselects the JInternalFrame. A JInternalFrame normally draws it'sits title bar differently if it is the selected frame which indicates to the user that this internalFrame has the focus. @param selected a boolean where true means the frame is selected (currently active) and false means it is not @exception PropertyVetoException when the attempt to set the property is vetoed by the receiver. @beaninfo constrained: true bound: true description: Indicates whether this frame is currently the active frame.
Class JInternalFrame, void setTitle(String)

Sets the JInternalFrame title. title may have a null value. @see #getTitle @param title the String to display in the title bar @beaninfo: preferred: true bound: true description: The text displayed in the title bar.
Class JInternalFrame, void setUI(InternalFrameUI)

Sets the UI delegate for this JInternalFrame. @beaninfo expert: true description: The InternalFrameUI implementation that defines the labels look and feel.
Class JInternalFrame, void setVisible(boolean)

SetMakes the component visible stateor ofinvisible. theOverrides objectComponent.setVisible. @param b ifaFlag true showsto make thisthe component visible object;@beaninfo otherwiseattribute: hides itvisualUpdate true
Class JInternalFrame, void updateUI()

Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager. @see JComponent#updateUI
Class JInternalFrame, JRootPane rootPane

The JRootPane instance that manages the contentPane and optional menuBar for this frame as well as the glassPane. @see JRootPane @see RootPaneContainer

Class JLabel

A display area for a short text string or an image or both. A label does not react to input events. As a result it cannot get the keyboard focus. A label can however display a keyboard alternative as a convenience for a nearby component that has a keyboard alternative but can't display it.

A JLabel object can display either text an image or both. You can specify where in the label's display area the label's contents are aligned by setting the vertical and horizontal alignment. By default labels are vertically centered in their display area. Text-only labels are leading edge aligned by default; image-only labels are horizontally centered by default.

You can also specify the position of the text relative to the image. By default text is on the trailing edge of the image with the text and image vertically aligned.

A label's leading and trailing edge are determined from the value of its java.awt.ComponentOrientation property. At present the default ComponentOrientation setting maps the leading edge to left and the trailing edge to right.

Finally you can use the setIconTextGap method to specify how many pixels should appear between the text and the image. The default is 4 pixels.

See How to Use Labels in The Java Tutorial for further documentation.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A component that displays a short string and an icon. @version 1.89 04100 02/2202/9900 @author Hans Muller

Class JLabel, boolean imageUpdate(Image, int, int, int, int, int)

Repaints the component when the image has changed. This imageUpdate method of an ImageObserver is called when more information about an image which had been previously requested using an asynchronous routine such as the drawImage method of Graphics becomes available. See the definition of imageUpdate for more information on this method and its arguments. The imageUpdate method of Component incrementally draws an image on the component as more of the bits of the image are available. If the system property awt.image.incrementalDraw is missing or has the value true the image is incrementally drawn If the system property has any other value then the image is not drawn until itoverriden has been completely loaded.to Alsoreturn false if incremental drawing is in effect the valuecurrent ofIcon's the system property awt.image.redrawrateImage is interpreted as annot integerequal to give the maximumpassed redraw rate in milliseconds. If the system property is missing or cannot be interpreted as an integer the redraw rate is once every 100ms. The interpretation of the x y width and height arguments depends on the value of theImage infoflags argument. @param img the image being observed. @param infoflags see imageUpdate for more information. @param x the x coordinate. @param y the y coordinate. @param width the width. @param height the height. @return true if the flags indicate that the image is completely loaded; false otherwise. @see java.awt.image.ImageObserver @see java.awt.Graphics#drawImage(java.awt.Image int int java.awt.Color java.awt.image.ImageObserver) @see java.awt.Graphics#drawImage(java.awt.Image int int java.awt.image.ImageObserver) @see java.awt.Graphics#drawImage(java.awt.Image int int int int java.awt.Color java.awt.image.ImageObserver) @see java.awt.Graphics#drawImage(java.awt.Image int int int int java.awt.image.ImageObserver) @see java.awt.image.ImageObserverComponent#imageUpdate(java.awt.Image int int int int int) @since JDK1.0
Class JLabel, void setDisabledIcon(Icon)

Set the icon to be displayed if this JLabel is "disabled" i.e. (JLabel.setEnabled(false)).

The default value of this property is null. @param disabledIcon the Icon to display when the component is disabled @see #getDisabledIcon @see #setEnabled @beaninfo bound: true attribute: visualUpdate true description: The icon to display if the label is disabled.


Class JLayeredPane

JLayeredPane adds depth to a JFC/Swing container allowing components to overlap each other when needed. An Integer object specifies each component's depth in the container where higher-numbered components sit "on top" of other components. For task-oriented documentation and examples of using layered panes see How to Use a Layered Pane a section in The Java Tutorial.

For convenience JLayeredPane divides the depth-range into several different layers. Putting a component into one of those layers makes it easy to ensure that components overlap properly without having to worry about specifying numbers for specific depths:

DEFAULT_LAYER
The standard layer where most components go. This the bottommost layer.
PALETTE_LAYER
The palette layer sits over the default layer. Useful for floating toolbars and palettes so they can be positioned above other components.
MODAL_LAYER
The layer used for modal dialogs. They will appear on top of any toolbars palettes or standard components in the container.
POPUP_LAYER
The popup layer displays above dialogs. That way the popup windows associated with combo boxes tooltips and other help text will appear above the component palette or dialog that generated them.
DRAG_LAYER
When dragging a component reassigning it to the drag layer ensures that it is positioned over every other component in the container. When finished dragging it can be reassigned to its normal layer.
The JLayeredPane methods moveToFront(Component) moveToBack(Component) and setPosition can be used to reposition a component within its layer. The setLayer method can also be used to change the component's current layer.

Details

JLayeredPane manages it's list of children like Container but allows for the definition of a several layers within itself. Children in the same layer are managed exactly like the normal Container object with the added feature that when children components overlap children in higher layers display above the children in lower layers.

Each layer is a distinct integer number. The layer attribute can be set on a Component by passing an Integer object during the add call.
For example:

 layeredPane.add(child JLayeredPane.DEFAULT_LAYER); or layeredPane.add(child new Integer(10)); 
The layer attribute can also be set on a Component by calling
 layeredPaneParent.setLayer(child 10)
on the JLayeredPane that is the parent of component. The layer should be set before adding the child to the parent.

Higher number layers display above lower number layers. So using numbers for the layers and letters for individual components a representative list order would look like this:

 5a 5b 5c 2a 2b 2c 1a 
where the leftmost components are closest to the top of the display.

A component can be moved to the top or bottom position within its layer by calling moveToFront or moveToBack.

The position of a component within a layer can also be specified directly. Valid positions range from 0 up to one less than the number of components in that layer. A value of -1 indicates the bottommost position. A value of 0 indicates the topmost position. Unlike layer numbers higher position values are lower in the display.

Note: This sequence (defined by java.awt.Container) is the reverse of the layer numbering sequence. Usually though you will use moveToFront moveToBack and setLayer.
Here are some examples using the method add(Component layer position): Calling add(5x 5 -1) results in:
 5a 5b 5c 5x 2a 2b 2c 1a 
Calling add(5z 5 2) results in:
 5a 5b 5z 5c 5x 2a 2b 2c 1a 
Calling add(3a 3 7) results in:
 5a 5b 5z 5c 5x 3a 2a 2b 2c 1a 
Using normal paint/event mechanics results in 1a appearing at the bottom and 5a being above all other components.

Note: that these layers are simply a logical construct and LayoutManagers will affect all child components of this container without regard for layer settings.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.33 0937 03/0114/9800 @author David Kloba


Class JLayeredPane.AccessibleJLayeredPane

TheThis class usedimplements toaccessibility support obtainfor the accessibleJLayeredPane class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to layered pane user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JLayeredPane, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJLayeredPane. For layered panes the AccessibleContext takes the form of an AccessibleJLayeredPane. A new AccessibleJLayeredPane instance is created if necessary. @return an AccessibleJLayeredPane that serves as the AccessibleContext of this JComponentJLayeredPane

Class JList

A component that allows the user to select one or more objects from a list. A separate model ListModel represents the contents of the list. It's easy to display an array or vector of objects using a JList constructor that builds ana ListModel instance for you:
 // Create a JList that displays the strings in data[] String[] data = {"one" "two" "freethree" "four"}; JList dataList = new JList(data); // The value of the JList model property is an object that provides // a read-only view of the data. It was constructed automatically. for(int i = 0; i  

JList doesn't support scrolling directly. To create a scrolling list you make the JList the viewport view of a JScrollPane e.g. For example:

 JScrollPane scrollPane = new JScrollPane(dataList); // Or in two steps: JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().setView(dataList); 

By default the JList supports single selection i.e.model zero or one indexallows any combination of canitems to be selected at a time using the constant MULTIPLE_INTERVAL_SELECTION. The selection state is actually managed by a separate delegate object an implementationinstance of ListSelectionModel. howeverHowever JList provides convenient properties for managing the selection.

 String[] data = {"one" "two" "freethree" "four"}; JList dataList = new JList(data); dataList.setSelectedIndex(1); // select "two" dataList.getSelectedValue(); // returns "two" 

The contents of a JList can be dynamic i.e.in other words the list elements can change value and the size of the list can change after the JList has been created. The JList observes changes in its model with a swing.event.ListDataListener implementation. A correct implementation of ListModel notifies it's listeners each time a change occurs. The changes are characterized by a swing.event.ListDataEvent which identifies the range of Listlist indices that have been modified added or removed. Simple dynamic-content JList applications can use the DefaultListModel class to store list elements. This class implements the ListModel interface and provides the java.util.Vector API as well. Applications that need to provide custom ListModel implementations can subclass AbstractListModel which provides basic ListDataListener support. For example:

 // This list model has about 2^16 elements. Enjoy scrolling.  ListModel bigData = new AbstractListModel() { public int getSize() { return Short.MAX_VALUE; } public Object getElementAt(int index) { return "Index " + index; } }; JList bigDataList = new ListJList(bigData); // We don't want the JList implementation to compute the width // or height of all of the list cells so we give it a Stringstring // that's as big as we'll need for any cell. It uses this to // compute values for the fixedCellWidth and fixedCellHeight // properties. bigDataList.setPrototypeCellValue("Index 1234567890"); 

JList uses a java.awt.Component provided by a delegate called the cellRendererer to paint the visible cells in the list. The cell renderer component is used like a "rubber stamp" to paint each visible row. Each time the JList needs to paint a cell it asks the cell renderer for the component moves it into place using setBounds() and then draws it by calling its paint method. The default cell renderer uses a JLabel component to render the string value of each component. You can substitute your own cell renderer using code like this:

 // Display an icon and a string for each object in the list.  class MyCellRenderer extends JLabel implements ListCellRenderer { final static ImageIcon longIcon = new ImageIcon("long.gif"); final static ImageIcon shortIcon = new ImageIcon("short.gif"); // This is the only method defined by ListCellRenderer. // We just // reconfigure the JlabelJLabel each time we're called. public Component getListCellRendererComponent( JList list Object value // value to display int index // cell index boolean isSelected // is the cell selected boolean cellHasFocus) // the list and the cell have the focus { String s = value.toString(); setText(s); setIcon((s.length() > 10) longIcon : shortIcon); if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } setEnabled(list.isEnabled()); setFont(list.getFont()); return this; } } String[] data = {"one" "two" "freethree" "four"}; JList dataList = new JList(data); dataList.setCellRenderer(new MyCellRenderer()); 

JList doesn't provide any special support for handling double or triple (or N) mouse clicks however it's easy to handle them using a MouseListener. Use the JList method locationToIndex() to determine what cell was clicked. For example:

 final JList list = new JList(dataModel); MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int index = list.locationToIndex(e.getPoint()); System.out.println("Double clicked on Item " + index); } } }; list.addMouseListener(mouseListener); 
Note that in this example the JList variabledataList is final because it's referred to by the anonymous MouseListener class.

For the keyboard keys used by this component in the standard Looklook and Feelfeel (L&F) renditions see the JList key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

See How to Use Lists in The Java Tutorial for further documentation. Also see the article Advanced JList Programming in The Swing Connection.

@see ListModel @see AbstractListModel @see DefaultListModel @see ListSelectionModel @see DefaultListSelectionModel @see ListCellRenderer @beaninfo attribute: isContainer false description: A component which allows for the selection of one or more objects from a list. @version 1.65 0473 03/2214/9900 @author Hans Muller


Class JList.AccessibleJList

TheThis class usedimplements toaccessibility support obtainfor the accessibleJList class. role forIt provides thisan implementation of the Java Accessibility API appropriate to list user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JList.AccessibleJList, AccessibleSelection getAccessibleSelection()

Get the AccessibleSelection associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleSelection interface on behalf of itself. @return this object

Class JList, constructor JList()

Constructs a JList with an empty model.
Class JList, constructor JList(ListModel)

ConstructConstructs a JList that displays the elements in the specified non-null model. All JList constructors delegate to this one. @param dataModel the data model for this list @exception IllegalArgumentException if dataModel is null
Class JList, constructor JList(Object[])

ConstructConstructs a JList that displays the elements in the specified array. This constructor just delegates to the ListModel constructor. @param listData the array of Objects to be loaded into the data model
Class JList, constructor JList(Vector)

ConstructConstructs a JList that displays the elements in the specified Vector. This constructor just delegates to the ListModel constructor. @param listData the Vector to be loaded into the data model
Class JList, void addListSelectionListener(ListSelectionListener)

AddAdds a listener to the list that's notified each time a change to the selection occurs. Listeners added directly to the JList will have their ListSelectionEvent.getSource() == this JList (instead of the ListSelectionModel). @param listener Thethe ListSelectionListener to add. @see #getSelectionModel
Class JList, void addSelectionInterval(int, int)

SetSets the selection to be the union of the specified interval with current selection. Both the anchor and lead indices are included. It's not neccessary for anchor to be less than lead. This is a convenience method that just delegates to the selectionModel. @param anchor Thethe first index to add to the selection @param lead Thethe last index to add to the selection @see ListSelectionModel#addSelectionInterval @see #setSelectionInterval @see #removeSelectionInterval @see #addListSelectionListener
Class JList, void clearSelection()

Clears the selection - after calling this method isSelectionEmpty() will return true. This is a convenience method that just delegates to the selectionModel. @see ListSelectionModel#clearSelection @see #isSelectionEmpty @see #addListSelectionListener
Class JList, ListSelectionModel createSelectionModel()

Returns an instance of DefaultListSelectionModel. This method is used by the constructor to initialize the selectionModel property. @return Thethe ListSelectionModel used by this JList. @see #setSelectionModel @see DefaultListSelectionModel
Class JList, void ensureIndexIsVisible(int)

IfScrolls this JList is being displayed withinthe a JViewport andviewport to make the specified cell isn't completely visible. Note for this method to scrollwork the viewportJList must be displayed within a JViewport. @param an int --index the index of the cell to make visible @see JComponent#scrollRectToVisible @see #getVisibleRect
Class JList, void fireSelectionValueChanged(int, int, boolean)

ThisNotifies method notifies JList ListSelectionListenersListSelectionListeners that the selection model has changed. It's used to forward ListSelectionEvents from the selectionModel to the ListSelectionListenersListSelectionListeners added directly to the JList. @param firstIndex the first selected index @param lastIndex the last selected index @param isAdjusting true if multiple changes are being made @see #addListSelectionListener @see #removeListSelectionListener @see EventListenerList
Class JList, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJList. For JLists the AccessibleContext takes the form of an AccessibleJList. A new AccessibleJList instance is created if necessary. @return an AccessibleJList that serves as the AccessibleContext of this JComponentJList
Class JList, int getAnchorSelectionIndex()

Returns the first index argument from the most recent addSelectionIntervaladdSelectionModel or setSelectionInterval call. This is a convenience method that just delegates to the selectionModel. @return Thethe index that most recently anchored an interval selection. @see ListSelectionModel#getAnchorSelectionIndex @see #addSelectionInterval @see #setSelectionInterval @see #addListSelectionListener
Class JList, Rectangle getCellBounds(int, int)

Returns the bounds of the specified range of items in JList coordinates. Returns null if index isn't valid. @param index1index0 the index of the first JList cell in the range @param index2index1 the index of the last JList cell in the range @return the bounds of the indexed cells in pixels
Class JList, ListCellRenderer getCellRenderer()

Returns the object that renders the list items. @return the ListCellRenderer @see #setCellRenderer
Class JList, int getFirstVisibleIndex()

ReturnReturns the index of the cell in the upper left corner of the JList or -1 if nothing is visible or the list is empty. Note that this cell may only be partially visible. @return an int -- the index of the first visible cell. @see #getLastVisibleIndex @see JComponent#getVisibleRect
Class JList, int getFixedCellHeight()

Returns the fixed cell widthheight value -- the value specified by setting the fixedCellHeight property rather than that calculated from the list elements. @return the fixed cell height in pixels @see #setFixedCellHeight
Class JList, int getFixedCellWidth()

Returns the fixed cell width value -- the value specified by setting the fixedCellWidth property rather than that calculated from the list elements. @return the fixed cell width @see #setFixedCellWidth
Class JList, int getLastVisibleIndex()

ReturnReturns the index of the cell in the lower right corner of the JList or -1 if nothing is visible or the list is empty. Note that this cell may only be partially visible. @return an int -- the index of the last visible cell. @see #getLastVisibleIndex @see JComponent#getVisibleRect
Class JList, int getLeadSelectionIndex()

Returns the second index argument from the most recent addSelectionInterval or setSelectionInterval call. This is a convenience method that just delegates to the selectionModel. @return Thethe index that most recently ended a interval selection. @see ListSelectionModel#getLeadSelectionIndex @see #addSelectionInterval @see #setSelectionInterval @see #addListSelectionListener @beaninfo description: The lead selection index.
Class JList, int getMaxSelectionIndex()

Returns the largest selected cell index. This is a convenience method that just delegates to the selectionModel. @return Thethe largest selected cell index. @see ListSelectionModel#getMaxSelectionIndex @see #addListSelectionListener
Class JList, int getMinSelectionIndex()

Returns the smallest selected cell index. This is a convenience method that just delegates to the selectionModel. @return Thethe smallest selected cell index. @see ListSelectionModel#getMinSelectionIndex @see #addListSelectionListener
Class JList, ListModel getModel()

Returns the data model that holds the list of items displayed by the JList component. @return the ListModel that provides the displayed list of items @see #setModel
Class JList, Dimension getPreferredScrollableViewportSize()

ComputeComputes the size of the viewport needed to display visibleRowCount rows. This is trivial if fixedCellWidth and fixedCellHeight were specified. Note that they can be specified implicitly with the prototypeCellValue property. If fixedCellWidth wasn't specified it's computed by finding the widest list element. If fixedCellHeight wasn't specified then we resort to heuristics:
  • If the model isn't empty we just multiply the height of the first row by visibleRowCount.
  • If the model is empty i.e. (JList.getModel().getSize() == 0) then we just allocate 16 pixels per visible row and 256 pixels for the width (unless fixedCellWidth was set) and hope for the best.
@return a dimension containing the size of the viewport needed to display visibleRowCount rows @see #getPreferredScrollableViewportSize @see #setPrototypeCellValue
Class JList, Object getPrototypeCellValue()

Returns the cell width of the "prototypical cell" -- a cell used for the calculation of cell widths because it has the same value as all other list items instead of forcing the calculation to inspect every item in the list. @return the value of the prototypeCellValue property @see #setPrototypeCellValue
Class JList, int getScrollableBlockIncrement(Rectangle, int, int)

Returns the block increment amount. @param visibleRect the visible rectangle @param orientation HORIZONTAL or VERTICAL @param direction if < 0 then scroll UP; if > 0 then scroll DOWN @return Thethe visibleRect.height or visibleRect.width per the orientation. @see Scrollable#getScrollableUnitIncrement @throws IllegalArgumentException if visibleRect is null or orientation isn't one of SwingConstants.VERTICAL SwingConstants.HORIZONTAL.
Class JList, boolean getScrollableTracksViewportHeight()

IfReturns true if this JList is displayed in a JViewport don'tand the viewport is taller than changeJList's itspreferred height; otherwise returns false. If whenfalse then don't track the viewportsviewport's height changes. This allows vertical scrolling if the JViewport is itself embedded in a JScrollPane. @return False -true if donviewport is taller than Jlist't track the viewportss preferred height otherwise width.false @see Scrollable#getScrollableTracksViewportWidthgetScrollableTracksViewportHeight
Class JList, boolean getScrollableTracksViewportWidth()

IfReturns true if this JList is displayed in a JViewport don'tand the viewport is change itswider than JList's preferred width; otherwise returns false. If false whenthen don't track the viewportsviewport's width changes. This allows horizontal scrolling if the JViewport is itself embedded in a JScrollPane. @return False -true if don'tviewport trackis wider than the viewportsJList's preferred width. otherwise false @see Scrollable#getScrollableTracksViewportWidth
Class JList, int getScrollableUnitIncrement(Rectangle, int, int)

HorizontalReturns the distance to scroll to expose the next or previous row (for vertical scrolling) or character (for horizontal scrolling). For horizontal scrolling: return the lists font size or 1 if the font is null. We're using the font size instead of the width of some canonical string e.g. "m" because it's cheaper.

VerticalFor verticaL scrolling: if we're scrolling downwards (direction is greater than 0) and the first row is completely visible with respect to visibleRect then return its height. If we're scrolling downwards and the first row is only partially visible return the height of the visible part of the first row. Similarly if we're scrolling upwards we return the height of the row above the first row unless the first row is partially visible.

Note that the value of visibleRect must be the equal to this.getVisibleRect(). @param visibleRect the visible rectangle @param orientation HORIZONTAL or VERTICAL @param direction if < 0 then scroll UP; if > 0 then scroll DOWN @return Thethe distance in pixels to scroll to expose the next or previous row.unit @see Scrollable#getScrollableUnitIncrement @throws IllegalArgumentException if visibleRect is null or orientation isn't one of SwingConstants.VERTICAL SwingConstants.HORIZONTAL.

Class JList, int getSelectedIndex()

A convenience method that returnsReturns the first selected index. Returns; returns -1 if there is no selected item. @return Thethe first selectedvalue of index.getMinSelectionIndex @see #getMinSelectionIndex @see #addListSelectionListener
Class JList, int[] getSelectedIndices()

ReturnReturns an array of all of the selected indices in increasing order. @return Allall of the selected indices in increasing order. @see #removeSelectionInterval @see #addListSelectionListener
Class JList, Object getSelectedValue()

AReturns convenience method that returns the first selected value or null if the selection is empty. @return Thethe first selected value. @see #getMinSelectionIndex @see #getModel @see #addListSelectionListener
Class JList, Object[] getSelectedValues()

ReturnReturns an array of the values for the selected cells. The returned values are sorted in increasing index order. @return the selected values @see #isSelectedIndex @see #getModel @see #addListSelectionListener
Class JList, Color getSelectionBackground()

Returns the background color for selected cells. @return the Color used for the background of selected list items @see #setSelectionBackground @see #setSelectionForeground
Class JList, Color getSelectionForeground()

Returns the selection foreground color. @return the Color object for the foreground property @see #setSelectionForeground @see #setSelectionBackground
Class JList, int getSelectionMode()

Returns whether single-item or multiple-item selections are allowed. @return Thethe value of the selectionMode property. @see #setSelectionMode
Class JList, ListSelectionModel getSelectionModel()

Returns the value of the current selection model. The selection model handles the task of making single selections selections of contiguous ranges and non-contiguous selections. @return the ListSelectionModel that implements list selections @see #setSelectionModel @see ListSelectionModel
Class JList, ListUI getUI()

Returns the look and feel (L&F) object that renders this component. @return the ListUI object that renders this component
Class JList, String getUIClassID()

Returns the name of the UIFactory class that generatessuffix used to construct the name of the look and feel for(L&F) class used to render this component. @return the string "ListUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JList, boolean getValueIsAdjusting()

Returns the value of the data model's isAdjusting property. This value is true if multiple changes are being made. @return true if multiple selection-changes are occuringoccurring as when the mouse is being dragged over the list @see ListSelectionModel#getValueIsAdjusting
Class JList, int getVisibleRowCount()

ReturnReturns the preferred number of visible rows. @return an intinteger indicating the preferred number of rows to display without using a scrollbarscroll bar @see #setVisibleRowCount
Class JList, Point indexToLocation(int)

Returns the origin of the specified item in JList coordinates. Returns null if index isn't valid. @param index Thethe index of the JList cell. @return Thethe origin of the index'th cell.
Class JList, boolean isSelectedIndex(int)

Returns true if the specified index is selected. This is a convenience method that just delegates to the selectionModel. @param index index to be queried for selection state @return Truetrue if the specified index is selected. @see ListSelectionModel#isSelectedIndex @see #setSelectedIndex @see #addListSelectionListener
Class JList, boolean isSelectionEmpty()

Returns true if nothing is selected. This is a convenience method that just delegates to the selectionModel. @return Truetrue if nothing is selected @see ListSelectionModel#isSelectionEmpty @see #clearSelection @see #addListSelectionListener
Class JList, int locationToIndex(Point)

ConvertConverts a point in JList coordinates to the index of the cell at that location. Returns -1 if there's no cell at the specified location. @param location The JList relativethe coordinates of the cell relative to JList @return an intinteger -- the index of the cell at the given location or -1.
Class JList, String paramString()

Returns a string representation of this JList. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JList.
Class JList, void removeListSelectionListener(ListSelectionListener)

RemoveRemoves a listener from the list that's notified each time a change to the selection occurs. @param listener Thethe ListSelectionListener to remove. @see #addListSelectionListener @see #getSelectionModel
Class JList, void removeSelectionInterval(int, int)

SetSets the selection to be the set difference of the specified interval and the current selection. Both the anchor and lead indices are removed. It's not neccessary for anchor to be less than lead. This is a convenience method that just delegates to the selectionModel. @param anchor Thethe first index to remove from the selection @param lead Thethe last index to remove from the selection @see ListSelectionModel#removeSelectionInterval @see #setSelectionInterval @see #addSelectionInterval @see #addListSelectionListener
Class JList, void setCellRenderer(ListCellRenderer)

Sets the delegate that's used to paint each cell in the list. If prototypeCellValue was set then the fixedCellWidth and fixedCellHeight properties are set as well. Only one PropertyChangeEvent is generated however - for the "cellRenderer" property.

The default value of this property is provided by the ListUI delegate i.e. by the look and feel implementation.

To see an example which sets the cell renderer see the class description above.

This is a JavaBeans bound property. @param cellRenderer the ListCellRenderer that paints list cells @see #getCellRenderer @beaninfo bound: true attribute: visualUpdate true description: The component used to draw the cells.

Class JList, void setFixedCellHeight(int)

If this value is greater than zero it definesSets the height of every cell in the list. OtherwiseIf height is -1 cell heights are computed by applying getPreferredSize() to the cellRenderer component for each list element.

The default value of this property is -1.

This is a JavaBeans bound property. @param height an intinteger giving the height in pixels for all cells in this list @see #getPrototypeCellValue @see #setFixedCellWidth @see JComponent#addPropertyChangeListener @beaninfo bound: true attribute: visualUpdate true description: Defines a fixed cell height when greater than zero.

Class JList, void setFixedCellWidth(int)

If this value is greater than zero itSets defines the width of every cell in the list. OtherwiseIf width is -1 cell widths are computed by applying getPreferredSize() to the cellRenderer component for each list element.

The default value of this property is -1.

This is a JavaBeans bound property. @param width the width in pixels for all cells in this list @see #getPrototypeCellValue @see #setFixedCellWidth @see JComponent#addPropertyChangeListener @beaninfo bound: true attribute: visualUpdate true description: Defines a fixed cell width when greater than zero.

Class JList, void setListData(Object[])

AConstructs convenience method that constructs a ListModel from an array of Objectsobjects and then applies setModel to it. @param listData an array of Objects containing the items to display in the list @see #setModel
Class JList, void setListData(Vector)

AConstructs convenience method that constructs a ListModel from a Vector and then applies setModel to it. @param listData a Vector containing the items to display in the list @see #setModel
Class JList, void setModel(ListModel)

Sets the model that represents the contents or "value" of the list and clears the list selection after notifying PropertyChangeListeners.

This is a JavaBeans bound property. @param model the ListModel that provides the list of items for display @exception IllegalArgumentException if model is null @see #getModel @beaninfo bound: true attribute: visualUpdate true description: The object that contains the data to be drawn by this JList.

Class JList, void setPrototypeCellValue(Object)

IfComputes this value is non-null it's used to computethe fixedCellWidth and fixedCellHeight properties by configuring the cellRenderer atto index equals zero for the specified value and then computing the renderer componentscomponent's preferred size. This property isThese properties are useful when the list is too long to allow JList to just compute the width/height of each cell and there's is a single cell value that's is known to occupy as much space as any of the others.

The default value of thisNote that we do set propertythe fixedCellWidth and fixedCellHeight properties here but only a prototypeCellValue PropertyChangeEvent is nullfired.

ThisTo is a JavaBeanssee an example boundwhich sets this property. Note thatsee the weclass dodescription setabove. the fixedCellWidth and fixedCellHeight properties here but only

The default value of this property is anull. prototypeCellValue PropertyChangeEvent

This is fireda JavaBeans bound property. @param prototypeCellValue the value on which to base fixedCellWidth and fixedCellHeight on @see #getPrototypeCellValue @see #setFixedCellWidth @see #setFixedCellHeight @see JComponent#addPropertyChangeListener @beaninfo bound: true attribute: visualUpdate true description: The cell prototype value used to compute cell width and height.

Class JList, void setSelectedIndex(int)

SelectSelects a single cell. @param index Thethe index of the one cell to select @see ListSelectionModel#setSelectionInterval @see #isSelectedIndex @see #addListSelectionListener @beaninfo description: The index of the selected cell.
Class JList, void setSelectedIndices(int[])

SelectSelects a set of cells. @param indices Thean array of the indices of the cells to select @see ListSelectionModel#addSelectionInterval @see #isSelectedIndex @see #addListSelectionListener
Class JList, void setSelectedValue(Object, boolean)

Selects the specified object from the list. @param anObject the Objectobject to select @param shouldScroll true if the list should scroll to display the selected object if one exists; otherwise false
Class JList, void setSelectionBackground(Color)

SetSets the background color for selected cells. Cell renderers can use this color to the fill selected cells.

The default value of this property is defined by the look and feel implementation.

This is a JavaBeans bound property. @param selectionBackground the Color to use for the background of selected cells @see #getSelectionBackground @see #setSelectionForeground @see #setForeground @see #setBackground @see #setFont @beaninfo bound: true attribute: visualUpdate true description: The background color of selected cells.

Class JList, void setSelectionForeground(Color)

SetSets the foreground color for selected cells. Cell renderers can use this color to render text and graphics for selected cells.

The default value of this property is defined by the look and feel implementation.

This is a JavaBeans bound property. @param selectionForeground the Color to use in the foreground for selected list items @see #getSelectionForeground @see #setSelectionBackground @see #setForeground @see #setBackground @see #setFont @beaninfo bound: true attribute: visualUpdate true description: The foreground color of selected cells.

Class JList, void setSelectionInterval(int, int)

SelectSelects the specified interval. Both the anchor and lead indices are included. It's not neccessary for anchor to be less than lead. This is a convenience method that just delegates to the selectionModel. @param anchor Thethe first index to select @param lead Thethe last index to select @see ListSelectionModel#setSelectionInterval @see #addSelectionInterval @see #removeSelectionInterval @see #addListSelectionListener
Class JList, void setSelectionMode(int)

Determines whether single-item or multiple-item selections are allowed. The following selectionMode values are allowed:
  • SINGLE_SELECTION Only one list index can be selected at a time. In this mode the setSelectionInterval and addSelectionInterval methods are equivalent and they only the firstsecond index argument is used.
  • SINGLE_INTERVAL_SELECTION One contiguous index interval can be selected at a time. In this mode setSelectionInterval and addSelectionInterval are equivalent.
  • MULTIPLE_INTERVAL_SELECTION In this mode there's no restriction on what can be selected. This is the default.
@param selectionMode an intinteger specifying the type of selections that are permissible @see #getSelectionMode @beaninfo description: The selection mode. enum: SINGLE_SELECTION ListSelectionModel.SINGLE_SELECTION SINGLE_INTERVAL_SELECTION ListSelectionModel.SINGLE_INTERVAL_SELECTION MULTIPLE_INTERVAL_SELECTION ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
Class JList, void setSelectionModel(ListSelectionModel)

SetSets the selectionModel for the list to a non-null ListSelectionModel implementation. The selection model handles the task of making single selections selections of contiguous ranges and non-contiguous selections.

This is a JavaBeans bound property. @returnparam selectionModel the ListSelectionModel that implements listthe selections @exception IllegalArgumentException if selectionModel is null @see #getSelectionModel @beaninfo bound: true description: The selection model recording which cells are selected.

Class JList, void setUI(ListUI)

Sets the look and feel (L&F) object that renders this component. @param ui the ListUI L&F object @see UIDefaults#getUI
Class JList, void setValueIsAdjusting(boolean)

Sets the data model's isAdjusting property to true so that a single event will be generated when all of the selection events have finished (for example when the mouse is being dragged over the list in selection mode). @param b the boolean value for the property value @see ListSelectionModel#setValueIsAdjusting
Class JList, void setVisibleRowCount(int)

SetSets the preferred number of rows in the list that can be displayed without a scollbar as determined by the nearest JViewport ancestor if any. The value of this property only affects the value of the JListsJList's preferredScrollableViewportSize.

The default value of this property is 8.

This is a JavaBeans bound property. @param visibleRowCount an intinteger specifying the preferred number of visible rows @see #getVisibleRowCount @see JComponent#getVisibleRect @see JViewport @beaninfo bound: true attribute: visualUpdate true description: The preferred number of cells that can be displayed without a scrollbarscroll bar.

Class JList, void updateUI()

SetSets the UI property with the "ListUI" from the current default UIFactory. This method is called by the JList constructor and to update the Listslist's look and feel at runtime. @see UIManager#getUI

Class JMenu

An implementation of a menu -- a popup window containing JMenuItems that is displayed when the user selects an item on the JMenuBar. In addition to JMenuItemsJMenuItems a JMenu can also contain JSeparators.

In essence a menu is a button with an associated JPopupMenu. When the "button" is pressed the JPopupMenu appears. If the "button" is on the JMenuBar the menu is a top-level window. If the "button" is another menu item then the JPopupMenu is "pull-right" menu.

For information and examples of using menus see How to Use Menus a section in The Java Tutorial. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JMenu key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer true description: A popup window containing menu items displayed in a menu bar. @version 1.124 09144 01/2221/0001 @author Georges Saab @author David Karlton @author Arnaud Weber @see JMenuItem @see JSeparator @see JMenuBar @see JPopupMenu


Class JMenu.AccessibleJMenu

TheThis class usedimplements toaccessibility support obtainfor the accessibleJMenu class. role forIt provides thisan implementation of the Java Accessibility API appropriate to menu user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JMenu.AccessibleJMenu, void addAccessibleSelection(int)

Selects the nthith menu in the menu. If that item is a sub-menusubmenu it will pop up in response. If a different item is already popped up this will force it to close. If this is a sub-menu that is already poppoedpopped up (selected) this method has no effect. @param i the zero-based index of selectablethe item to be itemsselected @see #getAccessibleStateSet
Class JMenu.AccessibleJMenu, Accessible getAccessibleChild(int)

ReturnReturns the nth Accessible child of the object. @param i zero-based index of child @return the nth Accessible child of the object
Class JMenu.AccessibleJMenu, AccessibleSelection getAccessibleSelection()

Get the AccessibleSelection associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleSelection interface on behalf of itself. @return this object
Class JMenu.AccessibleJMenu, boolean isAccessibleChildSelected(int)

Returns true if the current child of this object is selected. (i.e.that is if this child is a poppopped-ed up sub-menusubmenu). @param i the zero-based index of the child in this Accessible object. @see AccessibleContext#getAccessibleChild

Class JMenu, constructor JMenu()

CreatesConstructs a new JMenu with no text.
Class JMenu, constructor JMenu(String)

CreatesConstructs a new JMenu with the supplied string as its text. @param s Thethe text for the menu label
Class JMenu, constructor JMenu(String, boolean)

CreatesConstructs a new JMenu with the supplied string as its text and specified as a tear-off menu or not. @param s Thethe text for the menu label @param b can the menu be torn off (not yet implemented)
Class JMenu, Component add(Component)

Appends a component to the end of this menu. Returns the component added. @param c the Component to add @return the Component added
Class JMenu, void addMenuListener(MenuListener)

AddAdds a listener for menu events. @param l the listener to be added
Class JMenu, void addSeparator()

AppendAppends a new separator to the end of the menu.
Class JMenu, WinListener createWinListener(JPopupMenu)

CreateCreates a window-closing listener for the popup. @param p the JPopupMenu @return the new window-closing listener @see WinListener
Class JMenu, void doClick(int)

Programatically performperforms a "click". This overrides the method AbstractButton.doClick(int) in order to make the menu pop up. @param pressTime indicates the number of milliseconds the button was pressed for
Class JMenu, void fireMenuCanceled()

NotifyNotifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. @exception Error if there is a null listener @see EventListenerList
Class JMenu, void fireMenuDeselected()

NotifyNotifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. @exception Error if there is a null listener @see EventListenerList
Class JMenu, void fireMenuSelected()

NotifyNotifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. @exception Error if there is a null listener @see EventListenerList
Class JMenu, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJMenu. For JMenus the AccessibleContext takes the form of an AccessibleJMenu. A new AccessibleJMenu instance is created if necessary. @return an AccessibleJMenu that serves as the AccessibleContext of this JComponentJMenu
Class JMenu, Component getComponent()

ThisReturns method returns the java.awt.Component used to paint this MenuElement. The returned component is used to convert events and detect if an event is inside a menu component.
Class JMenu, int getDelay()

Returns the suggested delay before thein milliseconds menu'sbefore PopupMenu issubmenus are popped up or down. Each look and feel (L&F) may determine its own policy for observing the delay property. In most cases the delay is not observed for top level menus or while dragging. @returnThe an intdefault for --delay theis 0. numberThis method is a property of millisecondsthe look and feel code and is used to manage the idiosyncracies of the various UI implementations. @return the delay property
Class JMenu, JMenuItem getItem(int)

Returns the JMenuItem at the specified position. If the specifiedcomponent positionat pos is containsnot a separatormenu thisitem JMenunull is returned. This method is included for AWT compatibility. @param pos an int givinginteger specifying the position @exception IllegalArgumentException if the value of indexpos <0 @return the menu item at the specified position; or null if the item as the specified position is lessnot a thanmenu 0.item
Class JMenu, int getItemCount()

Returns the number of items on the menu including separators. This method is included for AWT compatibility. @return an intinteger equal to the number of items on the menu @see #getMenuComponentCount
Class JMenu, Component getMenuComponent(int)

Returns the component at position n. @param n the position of the component to be returned @return the component requested or null if there is no popup menu
Class JMenu, int getMenuComponentCount()

Returns the number of components on the menu. @return an intinteger --containing the number of components on the menu
Class JMenu, Component[] getMenuComponents()

Returns an array of Components of the menu's subcomponents. Note that this returns all Components in the popup menu including separators. @return an array of ComponentsComponents or an empty array if there is no popup menu
Class JMenu, JPopupMenu getPopupMenu()

Returns the popupmenu associated with this menu. If there is no popupmenu it will create one.
Class JMenu, MenuElement[] getSubElements()

Returns an array of MenuElements containing the sub-menu componentssubmenu for this menu component. If popup menu is null returns an empty array. This method is required to conform to the MenuElement interface. Note that since JSeparators do not conform to the MenuElement interface this array will only contain JMenuItems. @return an array of MenuElement objects
Class JMenu, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "MenuUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JMenu, JMenuItem insert(Action, int)

InsertInserts a new menuitemmenu item attached to the specified Action object at a given position. @param a the Action object for the menuitemmenu item to add @param pos an int givinginteger specifying the position at which to add the new menuitemmenu item @exception IllegalArgumentException if the value of pos <0
Class JMenu, JMenuItem insert(JMenuItem, int)

InsertInserts the specified JMenuitem at a given position. @param mi the JMenuitem to add @param pos an int givinginteger specifying the position at which to add the new JMenuitem @return the new menu item @exception IllegalArgumentException if the value of pos <0
Class JMenu, void insert(String, int)

InsertInserts a new menuitemmenu item with the specified text at a given position. @param s the text for the menuitemmenu item to add @param pos an int givinginteger specifying the position at which to add the new menuitemmenu item @exception IllegalArgumentException when the value of pos <0
Class JMenu, void insertSeparator(int)

Inserts a separator at the specified position. @param index an int givinginteger specifying the position at which to insert the menu separator @exception IllegalArgumentException if the value of index is less than <0.
Class JMenu, boolean isMenuComponent(Component)

Returns true if the specified component exists in the submenu hierarchy. @param c the Component to be tested @return true if the componentComponent exists false otherwise
Class JMenu, boolean isSelected()

Returns true if the menu is currently selected (popped uphighlighted). @return true if the menu is openselected else false
Class JMenu, boolean isTearOff()

Returns true if the menu can be torn off. This method is not yet implemented. @return true if the menu can be torn off else false @exception Error if invoked -- this method is not yet implemented
Class JMenu, boolean isTopLevelMenu()

Returns true if the menu is a 'top-level menu' that is if it is the direct child of a menubar. @return true if the menu is activated from the menu bar; false if the menu is activated from a menu item on another menu
Class JMenu, String paramString()

Returns a string representation of this JMenu. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JMenu.
Class JMenu, void remove(Component)

Removes the Componentcomponent c from this menu. @param c the component to be removed
Class JMenu, void remove(JMenuItem)

Removes the specified menu item from this menu. If there is no popup menu this method will have no effect. @param item the JMenuItem to be removed from the menu
Class JMenu, void remove(int)

Removes the menu item at the specified index from this menu. @param indexpos the position of the item to be removed. @exception IllegalArgumentException if the value of indexpos <0 or if pos is lessgreater than 0.the number of menu items
Class JMenu, void removeAll()

RemoveRemoves all menu items from this menu.
Class JMenu, void removeMenuListener(MenuListener)

RemoveRemoves a listener for menu events. @param l the listener to be removed
Class JMenu, void setAccelerator(KeyStroke)

setAccelerator() is not defined for JMenu. Use setMnemonic() instead. @param keyStroke the keystroke combination which will invoke the JMenuItem's actionlisteners without navigating the menu hierarchy @exception Error if invoked -- this method is not defined for JMenu. Use setMnemonic instead @beaninfo description: The keystroke combination which will invoke the JMenuItem's actionlisteners without navigating the menu hierarchy hidden: true
Class JMenu, void setDelay(int)

Sets the suggested delay before the menu's PopupMenu is popped up or down. Each look and feel (L&F) may determine itsit's own policy for observing the delay property. In most cases the delay is not observed for top level menus or while dragging. This method is a property of the look and feel code and is used to manage the idiosyncracies of the various UI implementations. @param d the number of milliseconds to delay @exception IllegalArgumentException if the value of d is less than 0. @beaninfo description: The delay between menu selection and making the popup menu visible expert: true
Class JMenu, void setMenuLocation(int, int)

SetSets the location of the popup component. @param x the x coordinate of the popup's new position @param y the y coordinate of the popup's new position
Class JMenu, void setModel(ButtonModel)

SetSets the data model for the "menu button" -- the label that the user clicks to open or close the menu. @param mnewModel the ButtonModel @see #getModel @beaninfo description: The menu's model bound: true expert: true hidden: true
Class JMenu, void setPopupMenuVisible(boolean)

SetSets the visibility of the Menumenu's popup portion. The popup may only beIf made visible if the menu is itself showing onnot enabled this themethod will have no screeneffect. @param b a boolean value -- true to make the menu visible false to hide it @beaninfo description: The popup menu's visibility expert: true hidden: true
Class JMenu, void setSelected(boolean)

Sets the selection status of the menu. @param b a boolean value -- true to select (highlight) the menu and; open it false to unselectde-select the menu and close it @beaninfo description: When the menu is selected its popup child is shown. expert: true hidden: true
Class JMenu, void updateUI()

Notification from the UIFactory that the L&F has changed. Called to replace the UI with the latest version from the UIFactory. @see JComponent#updateUI

Class JMenuBar

An implementation of a MenuBarmenu bar. You add JMenu objects to the menu bar to construct a menu. When the user selects a JMenu object its associated JPopupMenu is displayed allowing the user to select one of the JMenuItems on it.

For information and examples of using menu bars see How to Use Menus a section in The Java Tutorial. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JMenuBar key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer true description: A container for holding and displaying menus. @version 1.52 0484 03/0914/9800 @author Georges Saab @author David Karlton @author Arnaud Weber @see JMenu @see JPopupMenu @see JMenuItem


Class JMenuBar.AccessibleJMenuBar

TheThis class usedimplements toaccessibility support obtainfor the accessibleJMenuBar class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to menu bar user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JMenuBar.AccessibleJMenuBar, AccessibleSelection getAccessibleSelection()

Get the AccessibleSelection associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleSelection interface on behalf of itself. @return this object

Class JMenuBar, JMenu add(JMenu)

Appends the specified menu to the end of the menu bar. @param c the JMenu component to add @return the menu component
Class JMenuBar, void addNotify()

Overrides JComponent.addNotify to register this menu bar with the current KeyboardManagerkeyboard manager.
Class JMenuBar, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJMenuBar. For JMenuBars the AccessibleContext takes the form of an AccessibleJMenuBar. A new AccessibleJMenuBar instance is created if necessary. @return an AccessibleJMenuBar that serves as the AccessibleContext of this JComponentJMenuBar
Class JMenuBar, Component getComponent()

Implemented to be a MenuElement. Returns this object. @return the current Component (this) @see #getSubElements
Class JMenuBar, Component getComponentAtIndex(int)

Returns the component at the specified index. This method is obsolete please use getComponent(int i) instead. @param i an intinteger specifying the position where 0 =is first @return the Component at the position or null for an invalid index @deprecated replaced by getComponent(int i)
Class JMenuBar, int getComponentIndex(Component)

Returns the index of the specified component. @param c the Component to find @return an intinteger giving the component's position where 0 =is first; or -1 if it can't be found
Class JMenuBar, JMenu getHelpMenu()

Gets the help menu for the menu bar. This method is not yet implemented and will throw an exception. @return the JMenu that delivers help to the user
Class JMenuBar, Insets getMargin()

Returns the margin between the menubar's border and its menus. If there is no previous margin it will create a default margin with zero size. @return an Insets object containing the margin values @see Insets
Class JMenuBar, JMenu getMenu(int)

GetsReturns the menu at the specified position in the menu bar. @param index an intinteger giving the position in the menu bar where 0 is the first position @return the JMenu at that position or null if if there is no JMenu at that position (ie. if it is a JMenuItem)
Class JMenuBar, SingleSelectionModel getSelectionModel()

Returns the model object that handles single selections. @return the SingleSelectionModel inproperty use @see SingleSelectionModel
Class JMenuBar, MenuElement[] getSubElements()

Implemented to be a MenuElement -- returns the menus in this menu bar. This is the reason for implementing the MenuElement interface -- so that the menu bar can be treated the same as other menu elements. @return an array of menu items in the menu bar.
Class JMenuBar, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "MenuBarUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JMenuBar, boolean isBorderPainted()

Returns true if the Menubar'smenu bars border should be painted. @return true if the border should be painted else false
Class JMenuBar, boolean isSelected()

Returns true if the MenuBarmenu bar currently has a component selected. @return true if a selection has been made else false
Class JMenuBar, void menuSelectionChanged(boolean)

Implemented to be a MenuElementMenuElement -- does nothing. @see #getSubElements
Class JMenuBar, void paintBorder(Graphics)

PaintPaints the menubar's border if BorderPainted property is true. @param g the Graphics context to use for painting @see JComponent#paint @see JComponent#setBorder
Class JMenuBar, String paramString()

Returns a string representation of this JMenuBar. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JMenuBar.
Class JMenuBar, void processKeyEvent(KeyEvent, MenuElement[], MenuSelectionManager)

Implemented to be a MenuElement -- does nothing. @see #getSubElements
Class JMenuBar, void processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)

Implemented to be a MenuElement -- does nothing. @see #getSubElements
Class JMenuBar, void removeNotify()

Overrides JComponent.removeNotify to unregister this menu bar with the current KeyboardManagerkeyboard manager.
Class JMenuBar, void setBorderPainted(boolean)

Sets whether the border should be painted. @param b if true and border property is not null the border is painted. @see #isBorderPainted @beaninfo bound: true attribute: visualUpdate true description: Whether the border should be painted.
Class JMenuBar, void setHelpMenu(JMenu)

Sets the help menu that appears when the user selects the "help" option in the menu bar. This method is not yet implemented and will throw an exception. @param menu the JMenu that delivers help to the user
Class JMenuBar, void setMargin(Insets)

Sets the margin between the menubar's border and its menus. Setting to null will cause the menubar to use the default margins. @param margin an Insets object containing the margin values @see Insets @beaninfo bound: true attribute: visualUpdate true description: The space between the menubar's border and its contents
Class JMenuBar, void setSelected(Component)

Sets the currently selected component producing a a change to the selection model. @param sel the Component to select
Class JMenuBar, void setSelectionModel(SingleSelectionModel)

SetSets the model object to handle single selections. @param model the SingleSelectionModel to use @see SingleSelectionModel @beaninfo bound: true description: The selection model recording which child is selected.
Class JMenuBar, void updateUI()

Notification from the UIFactory that the L&F has changed. Called to replace the UI with the latest version from the UIFactory. @see JComponent#updateUI

Class JMenuItem

An implementation of an item in a MenuItemmenu. A menu item is essentially a button sitting in a list. When the user selects the "button" the action associated with the menu item is performed. A JMenuItem contained in a JPopupMenu performs exactly that function.

For further documentation and for examples see How to Use Menus in The Java Tutorial. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JMenuItem key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: An item which can be selected in a menu. @version 1.77 0991 03/2214/00 @author Georges Saab @author David Karlton @see JPopupMenu @see JMenu @see JCheckBoxMenuItem @see JRadioButtonMenuItem


Class JMenuItem.AccessibleJMenuItem

TheThis class usedimplements toaccessibility support obtainfor the accessibleJMenuItem class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to menu item user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JMenuItem, constructor JMenuItem(String, Icon)

Creates a menuItemmenu item with the supplied text and icon. @param text the text of the MenuItem. @param icon the icon of the MenuItem.
Class JMenuItem, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJMenuItem. For JMenuItems the AccessibleContext takes the form of an AccessibleJMenuItem. A new AccessibleJMenuItme instance is created if necessary. @return an AccessibleJMenuItem that serves as the AccessibleContext of this JComponentJMenuItem
Class JMenuItem, void setAccelerator(KeyStroke)

Set the key combination which invokes the Menu Item's action listeners without navigating the menu hierarchy. It is the UIs responsibility to do install the correct action. @param keyStroke the KeyStroke which will serve as an accelerator @beaninfo description: The keystroke combination which will invoke the JMenuItem's actionlisteners without navigating the menu hierarchy bound: true preferred: true
Class JMenuItem, void updateUI()

NotificationResets from the UIFactory that the L&F has changed. CalledUI to replace the UI withproperty with a value from the latest versioncurrent from the UIFactorylook and feel. @see JComponent#updateUI

Class JOptionPane

JOptionPane makes it easy to pop up a standard dialog box that prompts users for a value or informs them of something. For information about using JOptionPane see How to Make Dialogs a section in The Java Tutorial.

While the JOptionPane class may appear complex because of the large number of methods almost all uses of this class are one-line calls to one of the static showXxxDialog methods shown below:

showConfirmDialogAsks a confirming question like yes/no/cancel.
showInputDialogPrompt for some input.
showMessageDialogTell the user about something that has happened.
showOptionDialogThe Grand Unification of the above three.
Each of these methods also comes in a showInternalXXX flavor which uses an internal frame to hold the dialog box (see Multipl convenience methods have also been defined -- overloaded versions of the basic methods that use different parameter lists.

All dialogs are modal. Each showXxxDialog method blocks the current thread until the user's interaction is complete.

icon message
input value
option buttons
The basic appearance of one of these dialog boxes is generally similar to the picture at the right although the various look-and-feels are ultimatly responsible for the final result.

Parameters:
The parameters to these methods follow consistent patterns:

parentComponent
Defines the Component that is to be the parent of this dialog box. It is used in two ways: the Frame that contains it is used as the Frame parent for the dialog box and its screen coordinates are used in the placement of the dialog box. In general the dialog box is placed just below the component. This parameter may be null in which case a default Frame is used as the parent and the dialog will be centered on the screen (depending on the L&F).
message
A descriptive message to be placed in the dialog box. In the most common usage message is just a String or String constant. However the type of this parameter is actually Object. It'sIts interpretation depends on its type:
Object[]
An array of objects is interpreted as a series of messages (one per object) arranged in a vertical stack. The interpretation is recursive -- each object in the array is interpreted according to its type.
Component
The Component is displayed in the dialog.
Icon
The Icon is wrapped in a JLabel and displayed in the dialog.
others
The object is converted to a String by calling its toString method. The result is wrapped in a JLabel and displayed.
messageType
Defines the style of the message. The look&feelLook and Feel manager may lay out the dialog differently depending on this value and will often provide a default icon. The possible values are:
  • ERROR_MESSAGE
  • INFORMATION_MESSAGE
  • WARNING_MESSAGE
  • QUESTION_MESSAGE
  • PLAIN_MESSAGE
optionType
Defines the set of option buttons that appear at the bottom of the dialog box:
  • DEFAULT_OPTION
  • YES_NO_OPTION
  • YES_NO_CANCEL_OPTION
  • OK_CANCEL_OPTION
You aren't limited to this set of option buttons. You can provide any buttons you want using the options parameter.
options
A more detailed description of the set of option buttons that will appear at the bottom of the dialog box. The usual value for the options parameter is an array of StringsStrings. But the parameter type is an array of Objects. A button is created for each object depending on it'sits type:
Component
The component is added to the button row directly.
Icon
A JButton is created with this as its label.
other
The Object is converted to a string using its toString method and the result is used to label a JButton.
icon
A decorative icon to be placed in the dialog box. A default value for this is determined by the messageType parameter.
title
The title for the dialog box.
initialValue
The default selection (input value).

When the selection is changed setValue is invoked which generates a PropertyChangeEvent.

If a JOptionPane has configured to all input setWantsInput the bound property JOptionPane.INPUT_VALUE_PROPERTY can also be listened to to determine when the user has input or selected a value.

When one of the showXxxDialog methods returns an integer the possible values are:

 YES_OPTION NO_OPTION CANCEL_OPTION OK_OPTION or CLOSED_OPTION. 
Examples:
Show an error dialog that displays the message 'alert':
JOptionPane.showMessageDialog(null "alert" "alert" JOptionPane.ERROR_MESSAGE);

Show an internal information dialog with the message 'information':
JOptionPane.showInternalMessageDialog(frame INFORMATION_MESSAGE"information"
      "information" "information"JOptionPane.INFORMATION_MESSAGE);

Show an information panel with the options yes/no and message 'choose one':
JOptionPane.showConfirmDialog(null
      "choose one" "choose one" JOptionPane.YES_NO_OPTION);

Show an internal information dialog with the options yes/no/cancel and message 'please choose one' and title information:
JOptionPane.showInternalConfirmDialog(frame
      "please choose one" "information"
      JOptionPane.YES_NO_CANCEL_OPTION JOptionPane.INFORMATION_MESSAGE);

Show a warning dialog with the options OK CANCEL title 'Warning' and message 'Click OK to continue':
Object[] options = { "OK" "CANCEL" };
JOptionPane.showOptionDialog(null "Click OK to continue" "Warning"
      JOptionPane.DEFAULT_OPTION JOptionPane.WARNING_MESSAGE
      null options options[0]);

Show a dialog asking the user to type in a String:
String inputValue = JOptionPane.showInputDialog("Please input a value");

Show a dialog asking the user to select a String:
Object[] possibleValues = { "First" "Second" "Third" };
Object selectedValue = JOptionPane.showInputDialog(null
      "Choose one" "Input"
      JOptionPane.INFORMATION_MESSAGE null
      possibleValues possibleValues[0]);

Direct Use:
To create and use an JOptionPane directly the standard pattern is roughly as follows:
 JOptionPane pane = new JOptionPane(arguments); pane.set.Xxxx(...); // Configure JDialog dialog = pane.createDialog(parentComponent title); dialog.show(); Object selectedValue = pane.getValue(); if(selectedValue == null) return CLOSED_OPTION; //If there is not an array of option buttons: if(options == null) { if(selectedValue instanceof Integer) return ((Integer)selectedValue).intValue(); return CLOSED_OPTION; } //If there is an array of option buttons: for(int counter = 0 maxCounter = options.length; counter  

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JOptionPane key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JInternalFrame @beaninfo attribute: isContainer true description: A component which implements standard dialog box controls. @version 1.46 0957 03/2914/9800 @author James Gosling @author Scott Violet


Class JOptionPane.AccessibleJOptionPane

AccessiblityThis class implements accessibility support for the JOptionPane class. It provides an implementation of the Java Accessibility API appropriate to option pane user-interface elements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JOptionPane, constructor JOptionPane()

Creates a JOptionPane with a test message.
Class JOptionPane, constructor JOptionPane(Object)

Creates a instance of JOptionPane to display a message using the plain-message message type and the default options delivered by the UI. @param message the Object to display
Class JOptionPane, constructor JOptionPane(Object, int)

Creates an instance of JOptionPane to display a message with the specified message type and the default options @param message the Object to display @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE.
Class JOptionPane, constructor JOptionPane(Object, int, int)

Creates an instance of JOptionPane to display a message with the specified message type and options. @param message the Object to display @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param optionType the options to display in the pane: DEFAULT_OPTION YES_NO_OPTION YES_NO_CANCEL_OPTION OK_CANCEL_OPTION
Class JOptionPane, constructor JOptionPane(Object, int, int, Icon)

Creates an instance of JOptionPane to display a message with the specified message type options and icon. @param message the Object to display @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param optionType the options to display in the pane: DEFAULT_OPTION YES_NO_OPTION YES_NO_CANCEL_OPTION OK_CANCEL_OPTION @param icon the Icon image to display
Class JOptionPane, constructor JOptionPane(Object, int, int, Icon, Object[])

Creates an instance of JOptionPane to display a message with the specified message type icon and options. None of the options is initially selected.

The options objects should contain either instances of ComponentsComponents (which are added directly) or Strings (which are wrapped in a JButton). If you provide ComponentsComponents you must ensure that when the Component is clicked it messages setValue in the created JOptionPane. @param message the Object to display @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param optionType the options to display in the pane: DEFAULT_OPTION YES_NO_OPTION YES_NO_CANCEL_OPTION OK_CANCEL_OPTION. Only; only meaningful if the options parameter is null. @param icon the Icon image to display @param options the choices the user can select

Class JOptionPane, constructor JOptionPane(Object, int, int, Icon, Object[], Object)

Creates an instance of JOptionPane to display a message with the specified message type icon and options with the inititiallyinitially-selected option specified. @param message the Object to display @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param optionType the options to display in the pane: DEFAULT_OPTION YES_NO_OPTION YES_NO_CANCEL_OPTION OK_CANCEL_OPTION. Only; only meaningful if the options parameter is null. @param icon the Icon image to display @param options the choices the user can select @param initialValue the choice that is initially selected
Class JOptionPane, JDialog createDialog(Component, String)

Creates and returns a new JDialog wrapping this centered on the parentComponent in the parentComponent's frame. title is the title of the returned dialog. The returned JDialog will be set up such that once it is closed or the user clicks on the OK button the dialog will be disposed and closed. Re@param parentComponent determines the frame in which the dialog is displayed; if the parentComponent has no Frame a default Frame is used. @param title the title string for the dialog @return a new JDialog containing this instance
Class JOptionPane, JInternalFrame createInternalFrame(Component, String)

Creates and returns an instance of JInternalFrame. The internal frame is created with the specified title and wrapping the JOptionPane. The returned JInternalFrame is added to the JDesktopPane ancestor of parentComponent or components parent if one its ancestors isn't a JDesktopPane or if parentComponent doesn't have a parent then a RuntimeException is thrown. @param parentComponent the parent Component for the internal frame @param title the String to display in the frame's title bar @return a JInternalFrame containing a JOptionPane @exception RuntimeException if parentComponent does not have a valid parent
Class JOptionPane, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJOptionPane. For option panes the AccessibleContext takes the form of an AccessibleJOptionPane. A new AccessibleJOptionPane instance is created if necessary. @return an AccessibleJOptionPane that serves as the AccessibleContext of this JComponentAccessibleJOptionPane @beaninfo expert: true description: The AccessibleContext associated with this option pane
Class JOptionPane, JDesktopPane getDesktopPaneForComponent(Component)

Returns the specified component's desktop pane. @param parentComponent the Component to check for a desktop @return the JDesktopPane that contains the component or null if the component is null or does not have an ancestor that is a JInternalFrame
Class JOptionPane, Frame getFrameForComponent(Component)

Returns the specified component's Frame. @param parentComponent the Component to check for a Frame @return the Frame that contains the component or the default frame if the component is null or does not have a valid Frame parent
Class JOptionPane, Icon getIcon()

Returns the icon this pane displays. @return the Icon that is displayed @see #setIcon
Class JOptionPane, Object getInitialSelectionValue()

Returns the initial-selection value.. @return the initially selected value @see #setInitialSelectionValue @see #setSelectionValues
Class JOptionPane, Object getInitialValue()

Returns the initial value. @return the Object that gets the initial keyboard focus @see #setInitialValue
Class JOptionPane, Object getInputValue()

Returns the value the user has input if wantsInput is true. @return the Object the user specified if it was one of the objects or a String if it was a value typed into a field. @see #setSelectionValues @see #setWantsInput @see #setInputValue
Class JOptionPane, int getMaxCharactersPerLineCount()

Returns the maximum number of characters to place on a line in a message. Default is to return Integer.MAX_VALUE. The value can be changed by overriding this method in a subclassesubclass. @return an intinteger giving the maximum number of characters on a line
Class JOptionPane, Object getMessage()

Returns the message-object this pane displays. @see #setMessage @return the Object that is displayed
Class JOptionPane, int getMessageType()

Returns the message type. @return an intinteger specifying the message type @see #setMessageType
Class JOptionPane, int getOptionType()

Returns the type of options that are displayed. @return an intinteger specifying the user-selectable options @see #setOptionType
Class JOptionPane, Object[] getOptions()

Returns the choices the user can make. @paramreturn the array of Objects that give the user's choices @see #setOptions
Class JOptionPane, Frame getRootFrame()

Returns the Frame to use for the class methods in which a frame is not provided. @return the default Frame to use
Class JOptionPane, Object[] getSelectionValues()

Returns the selection values. @param return the array of Objects the user can select @see #setSelectionValues
Class JOptionPane, OptionPaneUI getUI()

Returns the UI object which implements the L&F for this component. @return the OptionPaneUI object
Class JOptionPane, String getUIClassID()

Returns the name of the UI class that implements the L&F for this component. @return the string "OptionPaneUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JOptionPane, Object getValue()

Returns the value the user has selected. UNINITIALIZED_VALUE implies the user has not yet made a choice null means the user closed the window with out chosingchoosing anything. Otherwise the returned value will be one of the options defined in this object. @return the Object chosen by the user UNINITIALIZED_VALUE if the user has not yet made a choice or null if the user closed the window without making a choice. @see #setValue
Class JOptionPane, boolean getWantsInput()

Returns true if a parentComponent will be provided for the user to input. @return true if a parentComponent will be provided @see #setWantsInput
Class JOptionPane, String paramString()

Returns a string representation of this JOptionPane. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JOptionPane.
Class JOptionPane, void setIcon(Icon)

Sets the icon to display. If non-null the lookLook and feelFeel does not provide an icon. @param icon the Icon to display @see #getIcon @beaninfo preferred: true bound: true description: The option pane's type icon.
Class JOptionPane, void setInitialValue(Object)

Sets the initial value that is to be enabled -- the Component that has the focus when the pane is initially displayed. @param newInitialValue the Object that gets the initial keyboard focus @see #getInitialValue @beaninfo preferred: true bound: true description: The option pane's initial value object.
Class JOptionPane, void setInputValue(Object)

Sets the user's input-value. @param newValue the Object used to initialized the value that the user specified (usually in a text field) @see #setSelectionValues @see #setWantsInput @see #getInputValue @beaninfo preferred: true bound: true description: The option pane's input value object.
Class JOptionPane, void setMessage(Object)

Sets the option pane's message-object. @param newMessage the Object to display @see #getMessage @beaninfo preferred: true bound: true description: The optionpane's message object.
Class JOptionPane, void setMessageType(int)

Sets the option pane's message type. The message type is used by the lookLook and feelFeel to determine the icon to display (if not supplied) as well as potentially how to lay out the parentComponent. @param newType an intinteger specifying the kind of message to display: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @exception Otherwise aRuntimeException if RuntimeEceptionnewType is thrown.not one of the legal values listed above @see #getMessageType @beaninfo preferred: true bound: true description: The option pane's message type.
Class JOptionPane, void setOptionType(int)

Sets the options to display. The option type is used by the lookLook and feelFeel to determine what buttons to show (unless options are supplied). @param newType an intinteger specifying the options the L&F is to display: DEFAULT_OPTION YES_NO_OPTION YES_NO_CANCEL_OPTION or OK_CANCEL_OPTION. Otherwise a@exception RuntimeException if newType is thrown.not one of the legal values listed above @see #getOptionType @see #setOptions @beaninfo preferred: true bound: true description: The option pane's option type.
Class JOptionPane, void setOptions(Object[])

Sets the options this pane displays. If an element in newOptions is a ComonentComponent it is added directly to the pane Otherwiseotherwise a button is created for the element. @param newOptions an array of Objects that create the buttons the user can click on or arbitrary Components to add to the pane @see #getOptions @beaninfo bound: true description: The option pane's options objects.
Class JOptionPane, void setRootFrame(Frame)

Sets the frame to use for class methods in which a frame is not provided. @param newRootFrame the default Frame to use
Class JOptionPane, void setSelectionValues(Object[])

Sets the selection values for a pane that provides the user with a list of items to choose from. (The UI provides a widget for choosing one of the values.)

Sets wantsInput to true. Use setInitialSelectionValue to specify the initially-chosen value. After the pane as been enabled inputValue is set to the value the user has selected. @param newValues an array of Objects the user to be displayed (usually in a list or combo-box) from which the user can make a selection @see #setWantsInput @see #setInitialSelectionValue @see #getSelectionValues @beaninfo bound: true description: The option pane's selection values.

Class JOptionPane, void setUI(OptionPaneUI)

Sets the UI object which implements the L&F for this component. @param ui the OptionPaneUI L&F object @see UIDefaults#getUI @beaninfo bound: true hidden: true description: The UI object that implements the optionpane's LookAndFeel
Class JOptionPane, void setWantsInput(boolean)

If newValue is true a parentComponent is provided to allow the user to input a value. If getSelectionValues returns a non-null the input value is one of the objects in that array. Otherwise the input value is whatever the user inputs.

This is a bound property. @see #setSelectionValues @see #setInputValue @beaninfo preferred: true bound: true description: Flag which allows the user to input a value.

Class JOptionPane, int showConfirmDialog(Component, Object)

Brings up a modal dialog with the options Yes No and Cancel; with the title "Select an Option". @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe Object to display @return an intinteger indicating the option selected by the user
Class JOptionPane, int showConfirmDialog(Component, Object, String, int)

Brings up a modal dialog where the number of choices is determined by the optionType parameter. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe Object to display @param title the title string for the dialog @param optionType an int designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @return an int indicating the option selected by the user
Class JOptionPane, int showConfirmDialog(Component, Object, String, int, int)

Brings up a modal dialog where the number of choices is determined by the optionType parameter where the messageType parameter determines the icon to display. The messageType parameter is primarily used to supply a default icon from the lookLook and feelFeel. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe Object to display @param title the title string for the dialog @param optionType an intinteger designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an intinteger designating the kind of message this is primarily used to determine the icon from the pluggable lookLook and feelFeel: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @return an intinteger indicating the option selected by the user
Class JOptionPane, int showConfirmDialog(Component, Object, String, int, int, Icon)

Brings up a modal dialog with a specified icon where the number of choices is determined by the optionType parameter. The messageType parameter is primarily used to supply a default icon from the lookLook and feelFeel. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message The Object to display @param title the title string for the dialog @param optionType an int designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an int designating the kind of message this is primarily used to determine the icon from the pluggable lookLook and feelFeel: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param icon the icon to display in the dialog @return an int indicating the option selected by the user
Class JOptionPane, String showInputDialog(Component, Object)

Shows a question-message dialog requesting input from the user parented to parentComponent. The dialog is displayed in the Component's frame and is usually positioned below the Component. @param parentComponent the parent Component for the dialog @param message the Object to display
Class JOptionPane, String showInputDialog(Component, Object, String, int)

Shows a dialog requesting input from the user parented to parentComponent with the dialog having the title title and message type messageType. @param parentComponent the parent Component for the dialog @param message the Object to display @param title the String to display in the dialog title bar @param messageType the type of message that is to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE.
Class JOptionPane, Object showInputDialog(Component, Object, String, int, Icon, Object[], Object)

Prompts the user for input in a blocking dialog where the initial selection possible selections and all other options can be specified. The user will able to choose from selectionValues where null implies the user can input whatever they wish usually by means of a JTextField. initialSelectionValue is the initial value to prompt the user with. It is up to the UI to decide how best to represent the selectionValues but usually a JComboBox JList or JTextField will be used. @param parentComponent the parent Component for the dialog @param message the Object to display @param title the String to display in the dialog title bar @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param icon the Icon image to display @param selectionValues an array of ObjectsObjects that gives the possible selections @param initialSelectionValue the value used to initialize the input field @return users input or null meaning the user canceledcancelled the input
Class JOptionPane, String showInputDialog(Object)

Shows a question-message dialog requesting input from the user. The dialog uses the default frame which usually means it is centered on the screen. @param message the Object to display
Class JOptionPane, int showInternalConfirmDialog(Component, Object)

Brings up an internal dialog panel with the options Yes No and Cancel; with the title "Select an Option". @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe Object to display @return an intinteger indicating the option selected by the user
Class JOptionPane, int showInternalConfirmDialog(Component, Object, String, int)

Brings up a internal dialog panel where the number of choices is determined by the optionType parameter. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe object to display in the dialog.; Aa Component object is rendered as a Component.; Aa String object is rendered as a string. Other; other objects are converted to a String using the toString method. @param title the title string for the dialog @param optionType an intinteger designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @return an intinteger indicating the option selected by the user
Class JOptionPane, int showInternalConfirmDialog(Component, Object, String, int, int)

Brings up an internal dialog panel where the number of choices is determined by the optionType parameter where the messageType parameter determines the icon to display. The messageType parameter is primarily used to supply a default icon from the lookLook and feelFeel. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe object to display in the dialog.; Aa Component object is rendered as a Component.; Aa String object is rendered as a string. Other; other objects are converted to a String using the toString method. @param title the title string for the dialog @param optionType an intinteger designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an intinteger designating the kind of message this is primarily used to determine the icon from the pluggable lookLook and feelFeel: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @return an intinteger indicating the option selected by the user
Class JOptionPane, int showInternalConfirmDialog(Component, Object, String, int, int, Icon)

Brings up an internal dialog panel with a specified icon where the number of choices is determined by the optionType parameter. The messageType parameter is primarily used to supply a default icon from the lookLook and feelFeel. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe object to display in the dialog.; Aa Component object is rendered as a Component.; Aa String object is rendered as a string. Other; other objects are converted to a String using the toString method. @param title the title string for the dialog @param optionType an intinteger designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an intinteger designating the kind of message this is primarily used to determine the icon from the pluggable lookLook and feelFeel: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param icon the icon to display in the dialog @return an intinteger indicating the option selected by the user
Class JOptionPane, String showInternalInputDialog(Component, Object)

Shows an internal question-message dialog requesting input from the user parented to parentComponent. The dialog is displayed in the Component's frame and is usually positioned below the Component. @param parentComponent the parent Component for the dialog @param message the Object to display
Class JOptionPane, String showInternalInputDialog(Component, Object, String, int)

Shows an internal dialog requesting input from the user parented to parentComponent with the dialog having the title title and message type messageType. @param parentComponent the parent Component for the dialog @param message the Object to display @param title the String to display in the dialog title bar @param messageType the type of message that is to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE.
Class JOptionPane, Object showInternalInputDialog(Component, Object, String, int, Icon, Object[], Object)

Prompts the user for input in a blocking internal dialog where the initial selection possible selections and all other options can be specified. The user will able to choose from selectionValues where null implies the user can input whatever they wish usually by means of a JTextField. initialSelectionValue is the initial value to prompt the user with. It is up to the UI to decide how best to represent the selectionValues but usually a JComboBox JList or JTextField will be used. @param parentComponent the parent Component for the dialog @param message the Object to display @param title the String to display in the dialog title bar @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param icon the Icon image to display @param selectionValues an array of Objects that gives the possible selections @param initialSelectionValue the value used to initialize the input field @return users input or null meaning the user canceledcancelled the input
Class JOptionPane, void showInternalMessageDialog(Component, Object)

Brings up an internal confirmation dialog panel. The dialog is a modal information-message dialog titled "Message". @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe object to display
Class JOptionPane, void showInternalMessageDialog(Component, Object, String, int)

Brings up an internal dialog panel that displays a message using a default icon determined by the messageType parameter. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe Object to display @param title the title string for the dialog @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE.
Class JOptionPane, void showInternalMessageDialog(Component, Object, String, int, Icon)

Brings up an internal dialog panel displaying a message specifying all parameters. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe Object to display @param title the title string for the dialog @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param icon an icon to display in the dialog that helps the user identify the kind of message that is being displayed.
Class JOptionPane, int showInternalOptionDialog(Component, Object, String, int, int, Icon, Object[], Object)

Brings up an internal dialog panel with a specified icon where the initial choice is dermined by the initialValue parameter and the number of choices is determined by the optionType parameter.

If optionType is YES_NO_OPTION or YES_NO_CANCEL_OPTION and the options parameter is null then the options are supplied by the lookLook and feelFeel.

The messageType parameter is primarily used to supply a default icon from the lookLook and feelFeel. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe object to display in the dialog.; Aa Component object is rendered as a Component.; Aa String object is rendered as a string. Other objects are converted to a String using the toString method. @param title the title string for the dialog @param optionType an intinteger designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an intinteger designating the kind of message this is primarily used to determine the icon from the pluggable lookLook and feelFeel: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param icon the icon to display in the dialog @param options an array of objects indicating the possible choices the user can make. If; if the objects are components they are rendered properly.; Nonnon-String objects are rendered using their toString methods. If; if this parameter is null the options are determined by the lookLook and feel.Feel @param initialValue the object that represents the default selection for the dialog @return an intinteger indicating the option chosen by the user or CLOSED_OPTION if the user closed the Dialog

Class JOptionPane, void showMessageDialog(Component, Object)

Brings up a confirmation dialog -- a modal information-message dialog titled "ConfirmMessage". @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe Object to display
Class JOptionPane, void showMessageDialog(Component, Object, String, int)

Brings up a dialog that displays a message using a default icon determined by the messageType parameter. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe Object to display @param title the title string for the dialog @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE.
Class JOptionPane, void showMessageDialog(Component, Object, String, int, Icon)

Brings up a dialog displaying a message specifying all parameters. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe Object to display @param title the title string for the dialog @param messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param icon an icon to display in the dialog that helps the user identify the kind of message that is being displayed.
Class JOptionPane, int showOptionDialog(Component, Object, String, int, int, Icon, Object[], Object)

Brings up a modal dialog with a specified icon where the initial choice is dermined by the initialValue parameter and the number of choices is determined by the optionType parameter.

If optionType is YES_NO_OPTION or YES_NO_CANCEL_OPTION and the options parameter is null then the options are supplied by the lookLook and feelFeel.

The messageType parameter is primarily used to supply a default icon from the lookLook and feelFeel. @param parentComponent Determinesdetermines the Frame in which the dialog is displayed. If; if null or if the parentComponent has no Frame a default Frame is used. @param message Thethe Object to display @param title the title string for the dialog @param optionType an intinteger designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an intinteger designating the kind of message this is primarily used to determine the icon from the pluggable lookLook and feelFeel: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE. @param icon the icon to display in the dialog @param options an array of objects indicating the possible choices the user can make. If; if the objects are components they are rendered properly.; Nonnon-String objects are rendered using their toString methods. If; if this parameter is null the options are determined by the lookLook and feelFeel. @param initialValue the object that represents the default selection for the dialog @return an intinteger indicating the option chosen by the user or CLOSED_OPTION if the user closed the Dialog

Class JOptionPane, void updateUI()

Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager. @see JComponent#updateUI
Class JOptionPane, int DEFAULT_OPTION

Type meaning lookLook and feelFeel should not supply any options -- only use the options from the JOptionPane.
Class JOptionPane, Object value

Currently selected value will be a valid option or UNINITIALIZED_VALUE or null.

Class JPanel

JPanel is a generic lightweight container. For examples and task-oriented documentation for JPanel see How to Use Panels a section in The Java Tutorial.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see Mixing Heavy and Light Components @beaninfo description: A generic lightweight container. @version 1.30 0936 03/0114/9800 @author Arnaud Weber @author Steve Wilson


Class JPanel.AccessibleJPanel

TheThis class usedimplements toaccessibility support obtainfor the accessibleJPanel class. role forIt provides thisan implementation of the Java Accessibility API appropriate to panel user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JPanel, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJPanel. For JPanels the AccessibleContext takes the form of an AccessibleJPanel. A new AccessibleJPanel instance is created if necessary. @return an AccessibleJPanel that serves as the AccessibleContext of this JComponentJPanel

Class JPasswordField

JPasswordField is a lightweight component that allows the editing of a single line of text where the view indicates something was typed but does not show the original characters. ItYou can find further information and examples in How to Use Text Fields a section in The Java Tutorial.

JPasswordField is intended to be source-compatible with java.awt.TextField used with echoChar set. It is provided seperately to make it easier to safely change the ui for the JTextField without affecting password entries.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JPasswordField key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: Allows the editing of a line of text but doesn't show the characters. @author Timothy Prinzing @version 1.31 0941 03/1114/9800


Class JPasswordField.AccessibleJPasswordField

TheThis class usedimplements toaccessibility support obtainfor the accessibleJPasswordField class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to password field user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JPasswordField, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JPasswordField. For password fields the AccessibleContext takes the form of an AccessibleJPasswordField. A new contextAccessibleJPasswordField instance is created asif necessary. @return an AccessibleJPasswordField that serves as the AccessibleContext of this JPasswordField
Class JPasswordField, String getText()

Returns the text contained in this TextComponent. If the underlying document is null will give a NullPointerException.

For security reasons this method is deprecated. Use the getPassword method instead. @deprecated As of JDKJava version2 platform 1v1.2 replaced by getPassword(). @return the text

Class JPasswordField, String getText(int, int)

Fetches a portion of the text represented by the component. Returns an empty string if length is 0.

For security reasons this method is deprecated. Use the getPassword method instead. @deprecated As of JDKJava version2 platform 1v1.2 replaced by getPassword(). @param offs the offset >= 0 @param len the length >= 0 @return the text @exception BadLocationException if the offset or length are invalid


Class JPopupMenu

An implementation of a Popup Menupopup menu -- a small window whichthat pops up and displays a series of choices. A JPopupMenu is used for the menu that appears when the user selects an item on the menu bar. It is also used for "pull-right" menu that appears when the selects a menu item that activates it. Finally a JPopupMenu can also be used anywhere else you want a menu to appear --. forFor example when the user right-clicks in a specified area.

For information and examples of using popup menus see How to Use Menus in The Java Tutorial. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JPopupMenu key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A small window that pops up and displays a series of choices. @version 1.131 05149 11/0327/9900 @author Georges Saab @author David Karlton @author Arnaud Weber


Class JPopupMenu.Separator

A popupmenupopup menu-specific separator.
Class JPopupMenu.Separator, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "PopupMenuSeparatorUI" @see JComponent#getUIClassID @see UIDefaults#getUI

Class JPopupMenu, constructor JPopupMenu()

CreateConstructs a JPopupMenu without an "invoker".
Class JPopupMenu, constructor JPopupMenu(String)

CreateConstructs a JPopupMenu with the specified title. @param label Thethe string that a UI may use to display as a title for the popup menu.
Class JPopupMenu, JMenuItem add(Action)

AppendAppends a new menuitemmenu item to the end of the menu which dispatches the specified Action object. As of JDK 1.3 this is no longer the preferred method for adding Actions to a container. Instead it is recommended to configure a control with an action using setAction and then add that control directly to the Container. @param a the Action to add to the menu @return the new menu item @see Action
Class JPopupMenu, JMenuItem add(JMenuItem)

Appends the specified menu item to the end of this menu. @param c the JMenuItem to add @return the JMenuItem added.
Class JPopupMenu, JMenuItem add(String)

Creates a new menuitemmenu item with the specified text and appends it to the end of this menu. @param s the string for the menuitemmenu item to be added
Class JPopupMenu, void addPopupMenuListener(PopupMenuListener)

AddAdds a PopupMenu listener. @param l the PopupMenuListener to add
Class JPopupMenu, void firePopupMenuCanceled()

Notifies PopupMenuListeners that this popup menu is canceledcancelled.
Class JPopupMenu, void firePopupMenuWillBecomeInvisible()

Notifies PopupMenuListenersPopupMenuListeners that this popup menu will become invisible.
Class JPopupMenu, void firePopupMenuWillBecomeVisible()

Notifies PopupMenuListenersPopupMenuListeners that this popup menu will become visible.
Class JPopupMenu, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJPopupMenu. For JPopupMenus the AccessibleContext takes the form of an AccessibleJPopupMenu. A new AccessibleJPopupMenu instance is created if necessary. @return an AccessibleJPopupMenu that serves as the AccessibleContext of this JComponentJPopupMenu
Class JPopupMenu, Component getComponentAtIndex(int)

Returns the component at the specified index. This method is obsolete please use getComponent(int i) instead. @param i the index of the component where 0 is the first @return the Component at that index @deprecated replaced by getComponent(int i)
Class JPopupMenu, int getComponentIndex(Component)

Returns the index of the specified component. @param the Component to find @return the index of the component where 0 is the first; or -1 if the component is not found
Class JPopupMenu, boolean getDefaultLightWeightPopupEnabled()

ReturnReturns thetrue if this is a light weight default value forpopup component false otherwise. @return the lightWeightPopupEnabled property. @see #setDefaultLightWeightPopupEnabled
Class JPopupMenu, Component getInvoker()

Returns the component which is the 'invoker' of this popup menu. @return the Component in which the popup menu is displayed
Class JPopupMenu, String getLabel()

Returns the popup menu's label @return a Stringstring containing the popup menu's label @see #setLabel
Class JPopupMenu, Insets getMargin()

Returns the margin in pixels between the popupmenupopup menu's border and its containees. @return an Insets object containing the margin values.
Class JPopupMenu, SingleSelectionModel getSelectionModel()

Returns the model object that handles single selections. @return the SingleSelectionModel inselectionModel useproperty @see SingleSelectionModel
Class JPopupMenu, PopupMenuUI getUI()

Returns the look and feel (L&F) object that renders this component. @return the PopupMenuUI object that renders this component
Class JPopupMenu, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "PopupMenuUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JPopupMenu, void insert(Action, int)

Inserts a menu item for the specified Action object at a given position. @param componenta the Action object to insert @param index an int specifyingspecifies the position at which to insert the Action where 0 is the first @see Action
Class JPopupMenu, void insert(Component, int)

Inserts the specified component into the menu at a given position. @param component the Component to insert @param index anspecifies int specifying the position at which to insert the component where 0 is the first @exception IllegalArgumentException if index <0
Class JPopupMenu, boolean isBorderPainted()

Checks whether the border should be painted. @return true if the border is painted false otherwise @see #setBorderPainted
Class JPopupMenu, boolean isLightWeightPopupEnabled()

Returns true if lightweightlight weight (all-Java) popups are in use or false if heavyweightheavy weight (native peer) popups are being used. @return true if lightweightlight weight popups are in use false otherwise
Class JPopupMenu, boolean isVisible()

Returns true if the popupmenupopup menu is visible (currently being displayed).
Class JPopupMenu, void pack()

LayoutLays out the container so that it uses the minimum space needed to display its contents.
Class JPopupMenu, void paintBorder(Graphics)

PaintPaints the popup menu's border if BorderPainted property is true. @param g the Graphics object @see JComponent#paint @see JComponent#setBorder
Class JPopupMenu, String paramString()

Returns a string representation of this JPopupMenu. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JPopupMenu.
Class JPopupMenu, void remove(int)

Removes the component at the specified index from this popup menu. @param indexpos the position of the item to be removed. @exception IllegalArgumentException if the value of indexpos <0 or if the value of pos is lessgreater than 0.the number of items
Class JPopupMenu, void removePopupMenuListener(PopupMenuListener)

RemoveRemoves a PopupMenu listener. @param l the PopupMenuListener to remove
Class JPopupMenu, void setDefaultLightWeightPopupEnabled(boolean)

SetSets the default value for the lightWeightPopupEnabled property. Lightweight popup windows are more efficient than heavy weight windows but light weight and heavy weight components do not mix well in a GUI and in that situation a heavy weight may be required. @param aFlag true if the popup is to be light weight otherwise false @see #getDefaultLightWeightPopupEnabled
Class JPopupMenu, void setInvoker(Component)

Sets the invoker of this popupmenupopup menu -- the component in which the popupmenupopup menu menu is to be displayed. @param invoker the Component in which the popup menu is displayed @beaninfo description: The invoking component for the popup menu expert: true
Class JPopupMenu, void setLabel(String)

Sets the popup menu's label. Different Looklook and Feelsfeels may choose to display or not display this. @param label a Stringstring specifying the label for the popup menu @see #setLabel @beaninfo description: The label for the popup menu. bound: true
Class JPopupMenu, void setLightWeightPopupEnabled(boolean)

When displaying the popup JPopupMenu choosechooses to use a light weight popup if it fits. This method allows you to disable this feature. You have to do disable it if your application mixes light weight and heavy weights components. @param aFlag true if the popup is to be light weight otherwise false @beaninfo description: Determines whether lightweight popups are used when possible expert: true
Class JPopupMenu, void setLocation(int, int)

SetSets the location of the upper left corner of the popup menu using x y coordinates. @param x the x coordinate of the popup's new position @param y the y coordinate of the popup's new position @beaninfo description: The location of the popup menu.
Class JPopupMenu, void setPopupSize(Dimension)

Sets the size of the Popup window using a Dimension object. @paramThis is equivalent to setPreferredSize(d). The@param d the dimensionDimension specifying the new size of this component. @beaninfo description: The size of the popup menu
Class JPopupMenu, void setPopupSize(int, int)

Sets the size of the Popup window to the specified width and height. This is equivalent to setPreferredSize(new Dimension(width height)). @param width Thethe new width of the Popup in pixels. @param height Thethe new height of the Popup in pixels. @beaninfo description: The size of the popup menu
Class JPopupMenu, void setSelected(Component)

Sets the currently selected component This will result in a change to the selection model. @param sel the Component to select @beaninfo description: The selected component on the popup menu expert: true hidden: true
Class JPopupMenu, void setSelectionModel(SingleSelectionModel)

SetSets the model object to handle single selections. @param model the SingleSelectionModel tonew useSingleSelectionModel @see SingleSelectionModel @beaninfo description: The selection model for the popup menu expert: true
Class JPopupMenu, void setUI(PopupMenuUI)

Sets the L&F object that renders this component. @param ui the new PopupMenuUI L&F object @see UIDefaults#getUI @beaninfo descriptionbound: The popup menu UI delegatetrue boundhidden: true expertattribute: visualUpdate true hiddendescription: trueThe UI object that implements the Component's LookAndFeel.
Class JPopupMenu, void setVisible(boolean)

SetSets the visibility of the popup menu. @param b true to make the popup visible or false to hide it @beaninfo bound: true description: Makes the popup visible
Class JPopupMenu, void show(Component, int, int)

DisplayDisplays the popupmenupopup menu at the position x y in the coordinate space of the component invoker. @param invoker Thethe component in whose space the popupmenupopup menu is to appear @param x the x coordinate in invoker's coordinate space at which the popup menu is to be displayed @param y the y coordinate in invoker's coordinate space at which the popup menu is to be displayed
Class JPopupMenu, void updateUI()

NotificationResets from the UIFactory that the L&F has changed.UI Calledproperty to replace thea UI withvalue from the latest versioncurrent from the UIFactorylook and feel. @see JComponent#updateUI

Class JProgressBar

A component that displays an integer value within a bounded interval. A progress bar typically communicates the progress of an event by displaying its percentage of completion and possibly a textual display of this percentage.

For further documentation and examples see How to Monitor Progress a section in The Java Tutorial.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A component that displays an integer value. @version 1.71 0976 03/0114/9800 @author Michael C. Albers


Class JProgressBar.AccessibleJProgressBar

TheThis class usedimplements toaccessibility support obtainfor the accessibleJProgressBar class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to progress bar user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JProgressBar.AccessibleJProgressBar, AccessibleValue getAccessibleValue()

Get the AccessibleValue associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object

Class JProgressBar, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJProgressBar. For progress bars the AccessibleContext takes the form of an AccessibleJProgressBar. A new AccessibleJProgressBar instance is created if necessary. @return an AccessibleJProgressBar that serves as the AccessibleContext of this JComponentJProgressBar @beaninfo expert: true description: The AccessibleContext associated with this ProgressBar.

Class JRadioButton

An implementation of a radio button -- an item that can be selected or deselected and which displays its state to the user. Used with a ButtonGroup object to create a group of buttons in which only one button at a time can be selected. (Create a ButtonGroup object and use its add method to include the JRadioButton objects in the group.)
Note: The ButtonGroup object is a logical grouping -- not a physical grouping. Tocreate a button panel you should still create a JPanel or similar container-object and add a javax.swing.border.Border to it to set it off from surrounding components.

See How to Use Buttons Check Boxes and Radio Buttons in The Java Tutorial for further documentation.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JRadioButton key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A component which can display it's state as selected or deselected. @see ButtonGroup @see JCheckBox @version 1.52 0963 03/0114/9800 @author Jeff Dinkins


Class JRadioButton.AccessibleJRadioButton

TheThis class usedimplements toaccessibility support obtainfor the accessibleJRadioButton class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to radio button user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JRadioButton, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJRadioButton. For JRadioButtons the AccessibleContext takes the form of an AccessibleJRadioButton. A new AccessibleJRadioButton instance is created if necessary. @return an AccessibleJRadioButton that serves as the AccessibleContext of this JComponentJRadioButton @beaninfo expert: true description: The AccessibleContext associated with this Button

Class JRadioButtonMenuItem

An implementation of a RadioButtonMenuItemradio button menu item. A RadioButtonMenuItemJRadioButtonMenuItem is a menu item that is part of a group of menu items in which only one item in the group can be selected. The selected item displays its selected state. Selecting it causes any other selected item to switch to the unselected state. Used withTo acontrol ButtonGroupthe object to createselected state of a group of menu items in whichradio only one item atbutton menu items use a time can beButtonGroup selectedobject. (Create

a ButtonGroup objectFor further documentation and use itsexamples addsee methodHow to includeUse theMenus JRadioButtonMenuItem objectsa section in theThe group.)Java Tutorial. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JRadioButtonMenuItem key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A component within a group of menu items which can be selected. @version 1.33 1141 03/0214/9800 @author Georges Saab @author David Karlton @see ButtonGroup


Class JRadioButtonMenuItem.AccessibleJRadioButtonMenuItem

TheThis class usedimplements toaccessibility support obtainfor the accessibleJRadioButtonMenuItem class. role forIt provides thisan implementation of the Java Accessibility API appropriate to JRadioButtonMenuItem user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JRadioButtonMenuItem, constructor JRadioButtonMenuItem()

Creates a JRadioButtonMenuItem with no set text or icon.
Class JRadioButtonMenuItem, constructor JRadioButtonMenuItem(Icon)

Creates a JRadioButtonMenuItem with an icon. @param icon the Icon to display on the RadioButtonMenuItem.JRadioButtonMenuItem
Class JRadioButtonMenuItem, constructor JRadioButtonMenuItem(String)

Creates a JRadioButtonMenuItem with text. @param text the text of the RadioButtonMenuItem.JRadioButtonMenuItem
Class JRadioButtonMenuItem, constructor JRadioButtonMenuItem(String, Icon)

Creates a JRadioButtonMenuItemradio button menu item with the specified text and Icon. @param text the text of the RadioButtonMenuItemJRadioButtonMenuItem @param icon the icon to display on the RadioButtonMenuItemJRadioButtonMenuItem
Class JRadioButtonMenuItem, constructor JRadioButtonMenuItem(String, Icon, boolean)

Creates a radio button menu item that has the specified text image and selection state. All other constructors defer to this one. @param text the string displayed on the radio button @param icon the image that the button should display
Class JRadioButtonMenuItem, constructor JRadioButtonMenuItem(String, boolean)

Creates a radiobuttonradio button menu item with the specified text and selection state. @param text the text of the CheckBoxMenuItem. @param bselected the selected state of the checkboxmenuitemCheckBoxMenuItem
Class JRadioButtonMenuItem, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJRadioButtonMenuItem. For JRadioButtonMenuItems the AccessibleContext takes the form of an AccessibleJRadioButtonMenuItem. A new AccessibleJRadioButtonMenuItem instance is created if necessary. @return an AccessibleJRadioButtonMenuItem that serves as the AccessibleContext of this JComponentJRadioButtonMenuItem
Class JRadioButtonMenuItem, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "RadioButtonMenuItemUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JRadioButtonMenuItem, String paramString()

Returns a string representation of this JRadioButtonMenuItem. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JRadioButtonMenuItem.
Class JRadioButtonMenuItem, void requestFocus()

OverrideOverrides Component.requestFocus() to not grab focus.

Class JRootPane

The fundamental component inA thelightweight container hierarchy. In the same way that JComponent is fundamentalused tobehind the JFC/Swing components JRootPane is fundamentalscenes to theby JFrame JFC/SwingJDialog window frameJWindow JApplet and pane containersJInternalFrame. However while other classes use inheritance toFor taketask-oriented advantage ofinformation on JComponent'sfunctionality capabilities the container classes delegateprovided by root panes see operationsHow to a JRootPane instance.Use Those containersRoot arePanes the heavyweighta section containers:in JFrameThe JDialogJava JWindowTutorial. and JApplet as well as

The following image shows the lightweight container JInternalFrame.relationships The following image shows thesebetween the classes that use root relationships:panes.

The "heavyweight" components (those that delegate to a peer or native component on the host system) are shown with a darker heavier box. The four heavyweight JFC/Swing containers (JFrame JDialog JWindow and JApplet) are shown in relation to the AWT classes they extend. These four components are the only heavyweight containers in the Swing library. The lightweight container JInternalPane is also shown. All 5 of these JFC/Swing containers implement the RootPaneContainer interface and they all delegate their operations to a JRootPane (shown with a little "handle" on top).
Note: The JComponent method getRootPane can be used to obtain the JRootPane that contains a given component.
The diagram at right shows the structure of a JRootPane. A JRootpane is made up of a glassPane an optional menuBar and a contentPane. (The JLayeredPane manages the menuBar and the contentPane.) The glassPane sits over the top of everything where it is in a position to intercept mouse movements. Since the glassPane (like the contentPane) can be an arbitrary component it is also possible to set up the glassPane for drawing. Lines and images on the glassPane can then range over the frames underneath without being limited by their boundaries.

Although the menuBar component is optional the layeredPane contentPane and glassPane always exist. Attempting to set them to null generates an exception.

The contentPane must be the parent of any children of the JRootPane. Rather than adding directly to a JRootPane like this:

 rootPane.add(child); 
You instead add to the contentPane of the JRootPane like this:
 rootPane.getContentPane().add(child); 
The same priniciple holds true for setting layout managers removing components listing children etc. All these methods are invoked on the contentPane instead of on the JRootPane.
Note: The default layout manager for the contentPane is a BorderLayout manager. However the JRootPane uses a custom LayoutManager. So when you want to change the layout manager for the components you added to a JRootPane be sure to use code like this:
 rootPane.getContentPane().setLayout(new BoxLayout()); 
If a JMenuBar component is set on the JRootPane it is positioned along the upper edge of the frame. The contentPane is adjusted in location and size to fill the remaining area. (The JMenuBar and the contentPane are added to the layeredPane component at the JLayeredPane.FRAME_CONTENT_LAYER layer.)

The layeredPane is the parent of all children in the JRootPane. It is an instance of JLayeredPane which provides the ability to add components at several layers. This capability is very useful when working with menu popups dialog boxes and dragging -- situations in which you need to place a component on top of all other components in the pane.

The glassPane sits on top of all other components in the JRootPane. That provides a convenient place to draw above all other components and makes it possible to intercept mouse events which is useful both for dragging and for drawing. Developers can use setVisible on the glassPane to control when the glassPane displays over the other children. By default the glassPane is not visible.

The custom LayoutManager used by JRootPane ensures that:

  1. The glassPane if present fills the entire viewable area of the JRootPane (bounds - insets).
  2. The layeredPane fills the entire viewable area of the JRootPane. (bounds - insets)
  3. The menuBar is positioned at the upper edge of the layeredPane().
  4. The contentPane fills the entire viewable area minus the MenuBar if present.
Any other views in the JRootPane view hierarchy are ignored.

If you replace the LayoutManager of the JRootPane you are responsible for managing all of these views. So ordinarily you will want to be sure that you change the layout manager for the contentPane rather than for the JRootPane itself

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JLayeredPane @see JMenuBar @see JWindow @see JFrame @see JDialog @see JApplet @see JInternalFrame @see JComponent @see BoxLayout @see Mixing Heavy and Light Components @version 1.47 0465 03/2214/9900 @author David Kloba


Class JRootPane.AccessibleJRootPane

TheThis class usedimplements toaccessibility support obtainfor the accessibleJRootPane class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to root pane user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JRootPane, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJRootPane. For root panes the AccessibleContext takes the form of an AccessibleJRootPane. A new AccessibleJRootPane instance is created if necessary. @return an AccessibleJRootPane that serves as the AccessibleContext of this JComponentJRootPane
Class JRootPane, String getUIClassID()

ReturnReturns the UIDefaults key useda to look upstring that specifies the name of the swing.plaf.ComponentUIl&f class that defines the look and feelrenders for this component. Most applications will never need to call this method. Subclasses of JComponent that support pluggable look and feel should override this method to return a UIDefaults key that maps to the ComponentUI subclass that defines their look and feel. @return The UIDefaults key forString a"RootPaneUI" ComponentUI@see subclass.JComponent#getUIClassID @see UIDefaults#getUI @beaninfo expert: true description: UIClassID
Class JRootPane, boolean isOptimizedDrawingEnabled()

Returns true if this component tiles its childrenThe GlassPane and ContentPane have the same bounds i.e.which if it can guarantee that themeans JRootPane does not tiles its children willand notthis overlapshould return false. TheOn the repainting systemother hand the GlassPane is substantiallynormally not more efficient invisible and so this commoncan case.return true JComponent subclasses that canif the GlassPane isn't makevisible. Therefore this guaranteethe return e.g.value JLayeredPane should override this method to return falsehere depends upon the visiblity of the GlassPane. @return true if this componentscomponent's children don't overlap
Class JRootPane, void removeNotify()

Unregister ourselves from SystemEventQueueUtils. @see #addNotify
Class JRootPane, void setDefaultButton(JButton)

Sets the current default button for this JRootPane. The default button is the button which will be activated when a UI-defined activation event (typically the Enter key) occurs in the RootPane regardless of whether or not the button has keyboard focus (unless there is another component within the RootPane which consumes the activation event such as a JTextPane). For default activation to work the button must be an enabled descendent of the RootPane when activation occurs. To remove a default button from this RootPane set this property to null. @see JButton#isDefaultButton @param default the JButton which is to be the default button
Class JRootPane, void updateUI()

ResetsNotification the UI property to a value from the current look and feel. JComponent subclasses must override this method likeUIFactory this:that public voidthe updateUI()L&F {has setUI((SliderUI)UIManagerchanged.getUI(this); } @see #setUI @see UIManager#getLookAndFeel @see UIManagerJComponent#getUIupdateUI
Class JRootPane, DefaultAction defaultPressAction

The action to take whenAs of Java 2 platform thev1.3 defaultButtonthis unusable field is pressedno longer used. To override the default button you should replace the Action in the JRootPane's ActionMap. Please refer to the key bindings specification for further details. @deprecated As of Java 2 platform v1.3. @see #defaultButton
Class JRootPane, DefaultAction defaultReleaseAction

The action to take whenAs of Java 2 platform thev1.3 defaultButtonthis unusable field is releasedno longer used. To override the default button you should replace the Action in the JRootPane's ActionMap. Please refer to the key bindings specification for further details. @deprecated As of Java 2 platform v1.3. @see #defaultButton

Class JScrollBar

An implementation of a scrollbar. The user positions the knob in the scrollbar to determine the contents of the viewing area. The program typically adjusts the display so that the end of the scrollbar represents the end of the displayable contents or 100% of the contents. The start of the scrollbar is the beginning of the displayable contents or 0%. The postion of the knob within those bounds then translates to the corresponding percentage of the displayable contents.

Typically as the position of the knob in the scrollbar changes a corresponding change is made to the position of the JViewport on the underlying view changing the contents of the JViewport.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JScrollPane @beaninfo attribute: isContainer false description: A component that helps determine the visible content range of an area. @version 1.60 0464 03/2214/9900 @author David Kloba


Class JScrollBar.AccessibleJScrollBar

TheThis class usedimplements toaccessibility support obtainfor the accessibleJScrollBar class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to scroll bar user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JScrollBar.AccessibleJScrollBar, AccessibleValue getAccessibleValue()

Get the AccessibleValue associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object

Class JScrollBar, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJScrollBar. For JScrollBar the AccessibleContext takes the form of an AccessibleJScrollBar. A new AccessibleJScrollBar instance is created if necessary. @return an AccessibleJScrollBar that serves as the AccessibleContext of this JComponentJScrollBar
Class JScrollBar, boolean isFocusTraversable()

Identifies whether or not this component can receive the focus. A disabled button forThis returns false as exampleJScrollBar's would returndo not falsewant to participate in focus traversal. @return true if this component can receive the focus

Class JScrollPane

A specialized containerProvides a scrollable thatview of a component. A JScrollPane manages a viewport optional vertical and horizontal scrollbarsscroll bars and optional row and column heading viewports. You can find task-oriented documentation of JScrollPane in How to Use Scroll Panes a section in The Java Tutorial.

The JViewport provides a window or "viewport" onto a data source -- for example a text file. That data source is the "scrollable client" (aka data model) displayed by the JViewport view. A JScrollPane basically consists of JScrollBarsJScrollBars a JViewport and the wiring between them as shown in the diagram at right.

In addition to the scroll bars and viewport a JScrollPane can have a column header and a row header. Each of these is a JViewport object that you specify with setRowHeaderView and setColumnHeaderView. The column header viewport automatically scrolls left and right tracking the left-right scrolling of the main viewport. (It never scrolls vertically however.) The row header acts in a similar fashion.

By default the corners are empty. You can put a component into a corner using setCorner in case you there is some function or decoration you would like to add to the scroll pane. The size of corner components is entirely determined by the size of the headers and scroll bars that surround them.

To add a border around the main viewport you can use setViewportBorder. (Of course you can also add a border around the whole scroll pane using setBorder.)

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JScrollPane key assignments.

A common operation to want to do is to set the background color that will be used if the main viewport view is smaller than the viewport or is not opaque. This can be accomplished by setting the background color of the viewport via scrollPane.getViewport().setBackground(). The reason for setting the color of the viewport and not the scrollpane is that by default JViewport is opaque which among other things means it will completely fill in its background using its background color. Therefore when JScrollPane draws its background the viewport will usually draw over it.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JScrollBar @see JViewport @see #setViewportView @see #setRowHeaderView @see #setColumnHeaderView @see #setCorner @see #setViewportBorder @beaninfo attribute: isContainer true attribute: containerDelegate getViewport description: A specialized container that manages a viewport optional scrollbars and headers @version 1.61 0474 03/2214/9900 @author Hans Muller


Class JScrollPane.AccessibleJScrollPane

TheThis class usedimplements toaccessibility support obtainfor the accessibleJScrollPane class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to scroll pane user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JScrollPane.ScrollBar

By default JScrollPane creates scrollbars that are instances of this class. Scrollbar overrides the getUnitIncrement and getBlockIncrement methods so that if the viewportsviewport's view is a Scrollable the view is asked to compute these values. Unless the unit/block increment have been explicitly set.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see Scrollable @see JScrollPane#createVerticalScrollBar @see JScrollPane#createHorizontalScrollBar

Class JScrollPane.ScrollBar, constructor JScrollPane.ScrollBar(JScrollPane, int)

CreateCreates a scrollbar with the specified orientation where the options are:
  • JScrollPane.VERTICAL_SCROLLBAR
  • JScrollPane.HORIZONTAL_SCROLLBAR
@param orientation an intinteger specifying one of the legal orientation values shown above
Class JScrollPane.ScrollBar, int getBlockIncrement(int)

IfComputes the viewports view isblock a Scrollable then askincrement for scrolling if the viewviewport's to compute theview is a blockScrollable incrementobject. Otherwise the blockIncrement equals the viewportsviewport's width or height. If there's no viewport reuurnreturn super.getBlockIncrement(). @param direction less than zero to scroll up/left greater than zero for down/right @return an integer in pixels containing the block increment @see Scrollable#getScrollableBlockIncrement
Class JScrollPane.ScrollBar, int getUnitIncrement(int)

IfComputes the viewports view isunit a Scrollable then askincrement for scrolling if the viewviewport's to compute theview is a unitScrollable incrementobject. Otherwise return super.getUnitIncrement(). @param direction less than zero to scroll up/left greater than zero for down/right @return an integer in pixels containing the unit increment @see Scrollable#getScrollableUnitIncrement
Class JScrollPane.ScrollBar, void setBlockIncrement(int)

Messages super to set the value and resets the blockIncrementSet instance variable to true. @param blockIncrement the new block increment value in pixels
Class JScrollPane.ScrollBar, void setUnitIncrement(int)

Messages super to set the value and resets the unitIncrementSet instance variable to true. @param unitIncrement the new unit increment value in pixels

Class JScrollPane, constructor JScrollPane()

CreateCreates an empty (no viewport view) JScrollPane where both horizontal and vertical scrollbars appear when needed.
Class JScrollPane, constructor JScrollPane(Component)

CreateCreates a JScrollPane that displays the contents of the specified component where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view. @see #setViewportView @param view the Componentcomponent to display in the scrollpanesscrollpane's viewport
Class JScrollPane, constructor JScrollPane(Component, int, int)

CreateCreates a JScrollPane that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars. The scrollbar policies specify when the scrollbars are displayed e.g.For example if vsbPolicy is VERTICAL_SCROLLBAR_AS_NEEDED then the vertical scrollbar only appears if the view doesn't fit vertically. The available policiespolicy settings are listed at #setVerticalScrollBarPolicy and #setHorizontalScrollBarPolicy @see #setViewportView @param view the Componentcomponent to display in the scrollpanes viewport @param vsbPolicy an intinteger that specifies the vertical scrollbar policy @param hsbPolicy an intinteger that specifies the horizontal scrollbar policy
Class JScrollPane, constructor JScrollPane(int, int)

CreateCreates an empty (no viewport view) JScrollPane with specified scrollbar policies. The available policiespolicy settings are listed at #setVerticalScrollBarPolicy and #setHorizontalScrollBarPolicy @see #setViewportView @param vsbPolicy an intinteger that specifies the vertical scrollbar policy @param hsbPolicy an intinteger that specifies the horizontal scrollbar policy
Class JScrollPane, JScrollBar createHorizontalScrollBar()

Used by ScrollPaneUI implementations to create the horizontal scrollbar. Returns a JScrollPane.ScrollBar by default. Subclasses may override this method to force ScrollPaneUI implementations to use a JScrollBar subclass. Used by ScrollPaneUI implementations to create the horizontal scrollbar. @return a JScrollBar with a horizontal orientation @see JScrollBar
Class JScrollPane, JScrollBar createVerticalScrollBar()

Used by ScrollPaneUI implementations to create the vertical scrollbar. Returns a JScrollPane.ScrollBar by default. Subclasses may override this method to force ScrollPaneUI implementations to use a JScrollBar subclass. Used by ScrollPaneUI implementations to create the vertical scrollbar. @return a JScrollBar with a vertical orientation @see JScrollBar
Class JScrollPane, JViewport createViewport()

Returns a new JViewport by default. Used to create the viewport (as needed) in setViewportView setRowHeaderView and setColumnHeaderView. Subclasses may override this method to return a subclass of JViewport. @return a new JViewport
Class JScrollPane, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJScrollPane. For scroll panes the AccessibleContext takes the form of an AccessibleJScrollPane. A new AccessibleJScrollPane instance is created if necessary. @return an AccessibleJScrollPane that serves as the AccessibleContext of this JComponentJScrollPane
Class JScrollPane, JViewport getColumnHeader()

Returns the column header. @return a JViewport object for the columncolumnHeader headerproperty @see #setColumnHeader
Class JScrollPane, Component getCorner(String)

Returns the component at the specified corner. The key value specifying the corner is one of:
  • JScrollPane.LOWER_LEFT_CORNER
  • JScrollPane.LOWER_RIGHT_CORNER
  • JScrollPane.UPPER_LEFT_CORNER
  • JScrollPane.UPPER_RIGHT_CORNER
  • JScrollPane.LOWER_LEADING_CORNER
  • JScrollPane.LOWER_TRAILING_CORNER
  • JScrollPane.UPPER_LEADING_CORNER
  • JScrollPane.UPPER_TRAILING_CORNER
@seeparam #setCornerkey one of the values as shown above @return one of the Component at the specifiedcomponents listed below or cornernull if key is invalid:
  • lowerLeft
  • lowerRight
  • upperLeft
  • upperRight
@see #setCorner
Class JScrollPane, JScrollBar getHorizontalScrollBar()

Returns the horizontal scroll bar. @return the scrollbar that controls the viewportsviewport's horizontal view position. @return the horizontalScrollBar property @see #setHorizontalScrollBar
Class JScrollPane, int getHorizontalScrollBarPolicy()

Returns the horizontal scroll bar policy value. @return the horizontal scrollbarhorizontalScrollBarPolicy policy.property @see #setHorizontalScrollBarPolicy
Class JScrollPane, JViewport getRowHeader()

Returns the row header. @return the JViewportrowHeader forproperty the row header @see #setRowHeader
Class JScrollPane, ScrollPaneUI getUI()

Returns the look and feel (L&F) object that renders this component. @return the ScrollPaneUI object that renders this component @see #setUI
Class JScrollPane, String getUIClassID()

Returns the keysuffix used to lookconstruct up the ScrollPaneUI class thatname of the providesL&F the look and feel for JScrollPaneclass used to render this component. @return the string "ScrollPaneUI" @see JComponent#getUIClassID @see UIDefaults#getUI @beaninfo hidden: true
Class JScrollPane, JScrollBar getVerticalScrollBar()

Returns the vertical scroll bar. @return the scrollbar that controls the viewports vertical view position. @return the verticalScrollBar property @see #setVerticalScrollBar
Class JScrollPane, int getVerticalScrollBarPolicy()

Returns the vertical scroll bar policy value. @return the vertical scrollbarverticalScrollBarPolicy policyproperty @see #setVerticalScrollBarPolicy
Class JScrollPane, JViewport getViewport()

Returns the current JViewport. @see #setViewport @return the JViewport currently inviewport useproperty
Class JScrollPane, Border getViewportBorder()

Returns the valueBorder of the viewportBorderobject that surrounds propertythe viewport. @return the Border object that surrounds theviewportBorder viewportproperty @see #setViewportBorder
Class JScrollPane, Rectangle getViewportBorderBounds()

Returns the bounds of the viewport's border. @return a Rectangle object specifying the viewport border
Class JScrollPane, boolean isOpaque()

Returns true if this component is completely opaque.

An opaque component paints every pixel inwithin its rangerectangular bounds. (InA non-opaque component paints only a subset of its pixels or none at other wordsall allowing the pixels underneath it to "show through". Therefore a component that does not havefully paint its pixels provides a transparentdegree of backgroundtransparency. or

Subclasses that guarantee to always completely paint foregroundtheir contents should override this method and return true.) @return The value of the opaquetrue if this component is propertycompletely opaque @see JComponent#isOpaquesetOpaque

Class JScrollPane, boolean isValidateRoot()

Calls to revalidate() on any descendant of this JScrollPane e.g. For example the viewportsviewport's view will cause a request to be queued that will validate the JScrollPane and all its descendants. @return true @see JComponent#revalidate @beaninfo hidden: true
Class JScrollPane, String paramString()

Returns a string representation of this JScrollPane. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JScrollPane.
Class JScrollPane, void setColumnHeader(JViewport)

If anRemoves the old columnHeader exists removeif it exists. If the new columnHeader isn't null sync the x coordinate of the its viewPosition with the viewport (if there is one) and then add it to the ScrollPanescrollpane.

Most applications will find it more convenient to use setRowHeaderView to add a row header component and its viewport to the scrollpane. @see #getColumnHeader @see #setColumnHeaderView @beaninfo bound: true description: The column header child for this scrollpane attribute: visualUpdate true

Class JScrollPane, void setColumnHeaderView(Component)

Creates a column-header viewport if neccessarynecessary sets its view and then adds the column-header viewport to the scrollpane. For example:
 JScrollPane scrollpane = new JScrollPane(); scrollpane.setViewportView(myBigComponentToScroll); scrollpane.setColumnHeaderView(myBigComponentsColumnHeader); 
@see #setColumnHeader @see JViewport#setView @param view the Componentcomponent to display as the column header
Class JScrollPane, void setComponentOrientation(ComponentOrientation)

SetSets the language-sensitive orientation that is to be used to orderfor the elements or text within this component. Language-sensitivevertical LayoutManager and Component subclasses will use this property tohorizontal determinescrollbars how toas lay out anddetermined by the drawComponentOrientation componentsargument. At construction@param time aco one component'sof orientation isthe following setvalues: to
    ComponentOrientation
  • java.UNKNOWN indicating that it has not been specified explicitlyawt. The UNKNOWN orientation behaves the same as ComponentOrientation.LEFT_TO_RIGHT. To set the orientation of a single component use this method. To apply a ResourceBundle's orientation to an entire component hierarchy use
  • java.awt.Window.applyResourceBundleComponentOrientation. @seeRIGHT_TO_LEFT
  • java.awt.ComponentOrientation.UNKNOWN
@see java.awt.Window#ApplyResourceBundle(java.util.ResourceBundle) @author Laura Werner IBMComponentOrientation
Class JScrollPane, void setCorner(String, Component)

Adds a child that will appear in one of the scroll panes corners if there's room. For example with both scrollbars showing (on the right and bottom edges of the scrollpane) the lower left corner component will be shown in the space between ends of the two scrollbars. Legal values for the key are:
  • JScrollPane.LOWER_LEFT_CORNER
  • JScrollPane.LOWER_RIGHT_CORNER
  • JScrollPane.UPPER_LEFT_CORNER
  • JScrollPane.UPPER_RIGHT_CORNER
  • JScrollPane.LOWER_LEADING_CORNER
  • JScrollPane.LOWER_TRAILING_CORNER
  • JScrollPane.UPPER_LEADING_CORNER
  • JScrollPane.UPPER_TRAILING_CORNER

Although "corner" isn't doesn't match any beans property signature PropertyChange events are generated with the property name set to the corner key. @param key identifies which corner the component will appear in @param corner anyone componentof the following components:

  • lowerLeft
  • lowerRight
  • upperLeft
  • upperRight
@exception IllegalArgumentException if corner key is invalid
Class JScrollPane, void setHorizontalScrollBar(JScrollBar)

AddAdds the scrollbar that controls the viewportsviewport's horizontal view position to the scrollpane. This is usually unneccessaryunnecessary as JScrollPane creates horizontal and vertical scrollbars by default. @param horizontalScrollBar the horizontal scrollbar to be added @see #createHorizontalScrollBar @see #getHorizontalScrollBar @beaninfo expert: true bound: true description: The horizontal scrollbar.
Class JScrollPane, void setHorizontalScrollBarPolicy(int)

Determines when the horizontal scrollbar appears in the scrollpane. The options are:
  • JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED
  • JScrollPane.HORIZONTAL_SCROLLBAR_NEVER
  • JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS
@param policy one of the three values listed above @exception IllegalArgumentException if policy is not one of the legal values shown above @see #getHorizontalScrollBarPolicy @beaninfo preferred: true bound: true description: The scrollpane scrollbar policy enum: HORIZONTAL_SCROLLBAR_AS_NEEDED JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED HORIZONTAL_SCROLLBAR_NEVER JScrollPane.HORIZONTAL_SCROLLBAR_NEVER HORIZONTAL_SCROLLBAR_ALWAYS JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS
Class JScrollPane, void setLayout(LayoutManager)

Sets the layout manager for this JScrollPane. This method overrides setLayout in java.awt.Container to ensure that only LayoutManagersLayoutManagers which are subclasses of ScrollPaneLayout can be used in a JScrollPane. @param layout the specified layout manager @exception ClassCastException if layout is not a ScrollPaneLayout @see java.awt.Container#getLayout @see java.awt.Container#setLayout @beaninfo hidden: true
Class JScrollPane, void setRowHeader(JViewport)

If anRemoves the old rowHeader exists removeif it exists. If the new rowHeader isn't null syncsyncs the y coordinate of the its viewPosition with the viewport (if there is one) and then addadds it to the ScrollPanescrollpane.

Most applications will find it more convenient to use setRowHeaderView to add a row header component and its viewport to the scrollpane. @param rowHeader the new row header to be used; if null the old row header is still removed and the new rowHeader is set to null @see #getRowHeader @see #setRowHeaderView @beaninfo bound: true expert: true description: The row header child for this scrollpane

Class JScrollPane, void setRowHeaderView(Component)

Creates a row-header viewport if neccessarynecessary sets its view and then adds the row-header viewport to the scrollpane. For example:
 JScrollPane scrollpane = new JScrollPane(); scrollpane.setViewportView(myBigComponentToScroll); scrollpane.setRowHeaderView(myBigComponentsRowHeader); 
@see #setRowHeader @see JViewport#setView @param view the Componentcomponent to display as the row header
Class JScrollPane, void setUI(ScrollPaneUI)

Sets the ScrollPaneUI object that provides the look and feel (L&F) for this component. @param ui the ScrollPaneUI L&F object @see #getUI
Class JScrollPane, void setVerticalScrollBar(JScrollBar)

AddAdds the scrollbar that controls the viewports vertical view position to the scrollpane. This is usually unneccessaryunnecessary as JScrollPane creates vertical and verticalhorizontal scrollbars by default. @param verticalScrollBar the new vertical scrollbar to be added @see #createVerticalScrollBar @see #getVerticalScrollBar @beaninfo expert: true bound: true description: The vertical scrollbar.
Class JScrollPane, void setVerticalScrollBarPolicy(int)

Determines when the vertical scrollbar appears in the scrollpane. Legal values are:
  • JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED
  • JScrollPane.VERTICAL_SCROLLBAR_NEVER
  • JScrollPane.VERTICAL_SCROLLBAR_ALWAYS
@param policy one of the three values listed above @exception IllegalArgumentException if policy is not one of the legal values shown above @see #getVerticalScrollBarPolicy @beaninfo preferred: true bound: true description: The scrollpane vertical scrollbar policy enum: VERTICAL_SCROLLBAR_AS_NEEDED JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED VERTICAL_SCROLLBAR_NEVER JScrollPane.VERTICAL_SCROLLBAR_NEVER VERTICAL_SCROLLBAR_ALWAYS JScrollPane.VERTICAL_SCROLLBAR_ALWAYS
Class JScrollPane, void setViewport(JViewport)

RemoveRemoves the old viewport (if there is one); forceforces the viewPosition of the new viewport to be in the +x +y quadrant; syncsyncs up the row and column headers (if there are any) with the new viewport; and finally syncsyncs the scrollbars and headers with the new viewport.

Most applications will find it more convenient to use setViewportView to add a viewport and a view to the scrollpane. @param viewport the new viewport to be used; if viewport is null the old viewport is still removed and the new viewport is set to null @see #createViewport @see #getViewport @see #setViewportView @beaninfo expert: true bound: true attribute: visualUpdate true description: The viewport child for this scrollpane

Class JScrollPane, void setViewportBorder(Border)

AddAdds a border around the viewport. Note that the border isn't set on the viewport directly JViewport doesn't support the JComponent border property. Similarly setting the JScrollPanesJScrollPanes viewport doesn't effectaffect the viewportBorder property.

The default value of this property is computed by the look and feel implementation. @param viewportBorder the border to be added @see #getViewportBorder @see #setViewport @beaninfo preferred: true bound: true description: The border around the viewport.

Class JScrollPane, void setViewportView(Component)

Creates a viewport if neccessarynecessary and then sets its view. Applications that don't provide the view directly to the JScrollPane constructor should use this method to specify the scrollable child that's going to be displayed in the scrollpane e.g. For example:
 JScrollPane scrollpane = new JScrollPane(); scrollpane.setViewportView(myBigComponentToScroll); 
Applications should not add children directly to the scrollpane. @param view the Componentcomponent to add to the viewport @see #setViewport @see JViewport#setView
Class JScrollPane, void updateUI()

To be called when the default look and feel changes. Replaces the current ScrollPaneUI object with a version from the current default LookAndFeellook and feel. To be called when the default look and feel changes. @see JComponent#updateUI @see UIManager#getUI
Class JScrollPane, JViewport columnHeader

The column header child. Default is null. @see #setColumnHeader
Class JScrollPane, JScrollBar horizontalScrollBar

The scrollpane's horizontal scrollbar child. Default is a JScrollBar. @see #setHorizontalScrollBar
Class JScrollPane, int horizontalScrollBarPolicy

The display policy for the horizontal scrollbar. The default is JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED. @see #setHorizontalScrollBarPolicy
Class JScrollPane, Component lowerLeft

The component to display in the lower left corner. Default is null. @see #setCorner
Class JScrollPane, Component lowerRight

The component to display in the lower right corner. Default is null. @see #setCorner
Class JScrollPane, JViewport rowHeader

The row header child. Default is null. @see #setRowHeader
Class JScrollPane, Component upperLeft

The component to display in the upper left corner. Default is null. @see #setCorner
Class JScrollPane, Component upperRight

The component to display in the upper right corner. Default is null. @see #setCorner
Class JScrollPane, JScrollBar verticalScrollBar

The scrollpane's vertical scrollbar child. Default is a JScrollBar. @see #setVerticalScrollBar
Class JScrollPane, int verticalScrollBarPolicy

The display policy for the vertical scrollbar. The default is JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED. @see #setVerticalScrollBarPolicy
Class JScrollPane, JViewport viewport

The scrollpanesscrollpane's viewport child. Default is an empty JViewport. @see #setViewport

Class JSeparator

An implementation of a Menu Separatormenu separator -- a divider between menu items that breaks them up into logical groupings. Instead of using JSeparator directly you can use the JMenu or JPopupMenu addSeparator method to create and add a separator.

For more information and examples see How to Use Menus a section in The Java Tutorial.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A divider between menu items. @version 1.34 1141 03/1914/9800 @author Georges Saab @author Jeff Shapiro


Class JSeparator.AccessibleJSeparator

TheThis class usedimplements toaccessibility support obtainfor the accessibleJSeparator class. role forIt provides thisan implementation of the Java Accessibility API appropriate to separator user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JSeparator, constructor JSeparator()

CreateCreates a new horizontal separator.
Class JSeparator, constructor JSeparator(int)

CreateCreates a new separator with the specified horizontal or vertical orientation. @param orientation an intinteger specifying SwingConstants.HORIZONTAL or SwingConstants.VERTICAL @exception IllegalArgumentException if orientation is neither SwingConstants.HORIZONTAL nor SwingConstants.VERTICAL
Class JSeparator, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJSeparator. For separators the AccessibleContext takes the form of an AccessibleJSeparator. A new AccessibleJSeparator instance is created if necessary. @return an AccessibleJSeparator that serves as the AccessibleContext of this JComponentJSeparator
Class JSeparator, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "SeparatorUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JSeparator, boolean isFocusTraversable()

Identifies whether or not this component can receive the focus. JSeparatorsJSeparators cannot recieve focus. @return false
Class JSeparator, String paramString()

Returns a string representation of this JSeparator. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JSeparator.
Class JSeparator, void setOrientation(int)

Sets the orientation of the separator. The default value of this property is HORIZONTAL. @param orientation either SwingConstants.HORIZONTAL or SwingConstants.VERTICAL @exception IllegalArgumentException if orientation is neither SwingConstants.HORIZONTAL nor SwingConstants.VERTICAL @see SwingConstants @see #getOrientation @beaninfo bound: true preferred: true enum: HORIZONTAL SwingConstants.HORIZONTAL VERTICAL SwingConstants.VERTICAL attribute: visualUpdate true description: The orientation of the separator.
Class JSeparator, void updateUI()

Notification from the UIFactory that the L&F has changed. Called to replace the UI with the latest version from the UIFactoryUIFactorys. @see JComponent#updateUI

Class JSlider

A component that lets the user graphically select a value by slding a knob within a bounded interval. The slider can show both major tick marks and minor tick marks between them. The number of values between the tick marks is controlled with setMajorTickSpacing and setMinorTickSpacing.

For further information and examples see How to Use Sliders a section in The Java Tutorial. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JSlider key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A component that supports selecting a integer value from a range. @version 1.78 0989 03/0114/9800 @author David Kloba


Class JSlider.AccessibleJSlider

TheThis class usedimplements toaccessibility support obtainfor the accessibleJSlider class. role forIt provides thisan implementation of the Java Accessibility API appropriate to slider user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JSlider.AccessibleJSlider, AccessibleValue getAccessibleValue()

Get the AccessibleValue associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object

Class JSlider, Hashtable createStandardLabels(int)

Creates a hashtable that will draw text labels starting at the slider minimum using the increment specified. If you call createStandardLabels( 10 ) and the slider minimum is zero then it will make labels for the values 0 10 20 30 and so on. @see #setLabelTable
Class JSlider, Hashtable createStandardLabels(int, int)

Creates a hashtable that will draw text labels starting at the start point specified using the increment specified. If you call createStandardLabels( 10 2 ) then it will make labels for the values 2 12 22 32 and so on. @see #setLabelTable @exception IllegalArgumentException if slider label start point out of range or if label increment is less than or equal to zero
Class JSlider, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJSlider. For sliders the AccessibleContext takes the form of an AccessibleJSlider. A new AccessibleJSlider instance is created if necessary. @return an AccessibleJSlider that serves as the AccessibleContext of this JComponentJSlider
Class JSlider, boolean getInverted()

Returns true if the value-range shown for the slider is reversed with the maximum value at the left end of a horizontal slider or at the bottom of a vertical one. @return true if the slider values are reversed from their normal order @see #setInverted
Class JSlider, void setInverted(boolean)

Specify true to reverse the value-range shown for the slider so that theand false to maximumput the value is atrange in the leftnormal endorder. of aThe order horizontaldepends on the slider's ComponentOrientation orproperty. atNormal the(non-inverted) horizontal sliders bottomwith a ComponentOrientation value of LEFT_TO_RIGHT have their maximum on the right. Normal horizontal sliders with a verticalComponentOrientation value of oneRIGHT_TO_LEFT have their maximum on the left. Specify false toNormal vertical sliders puthave their maximum on the valuetop. rangeThese inlabels are reversed when the normalslider orderis inverted. @param b true to reverse the slider values from their normal order @beaninfo bound: true attribute: visualUpdate true description: If true reverses the slider values from their normal order
Class JSlider, void setLabelTable(Dictionary)

Used to specify what label will be drawn at any given value. The key-value pairs are of this format: { Integer value java.awtswing.ComponentJComponent label }. @see #createStandardLabels @see #getLabelTable @beaninfo hidden: true bound: true attribute: visualUpdate true description: Specifies what labels will be drawn for any given value.
Class JSlider, void setMaximum(int)

Sets the models maximum property. @see #getMaximum @see BoundedRangeModel#setMaximum @beaninfo bound: true preferred: true description: The sliders maximum value.
Class JSlider, void setMinimum(int)

Sets the models minimum property. @see #getMinimum @see BoundedRangeModel#setMinimum @beaninfo bound: true preferred: true description: The sliders minimum value.
Class JSlider, ChangeEvent changeEvent

Only one ChangeEvent is needed per slider instance since the event's only (read-only) state is the source property. The source of events generated here is always "this". The event is lazily created the first time that an event notification is fired. @exception IllegalArgumentException if orientation is not either HORIZONTAL or VERTICAL @see #fireStateChanged
Class JSlider, boolean snapToTicks

If true the knob (and the data value it represents) resolve to the closest tick mark next to where the user positioned the knob. The default is false. @see #setSnapToTicks

Class JSplitPane

JSplitPane is used to divide two (and only two) ComponentsComponents. The two ComponentsComponents are graphically divided based on the look and feel implementation and the two ComponentsComponents can then be interactively resized by the user. Information on using JSplitPane is in How to Use Split Panes in The Java Tutorial.

The two ComponentsComponents in a split pane can be aligned left to right using JSplitPane.HORIZONTAL_SPLIT or top to bottom using JSplitPane.VERTICAL_SPLIT. The preferred way to change the size of the ComponentsComponents is to invoke setDividerLocation where location is either the new x or y position depending on the orientation of the JSplitPane. If one component changes JSplitPane also attempts to reposition the other component.

To resize the ComponentsComponents to their preferred sizes invoke resetToPreferredSizes.

When the user is resizing the ComponentsComponents the minimum size of the Components is used to determine the maximum/minimum position the ComponentsComponents can be set to. So that ifIf the minimum size of the two components is greater than the size of the splitpanesplit pane the divider will not allow you to resize it. To alter the minimum size of a JComponent see JComponent#setMinimumSize

When the user resizes the split pane the new space is distributed between the two components based on the resizeWeight property. A value of 0 the default indicates the right/bottom component gets all the space where as a value of 1 indicates the left/top component gets all the space.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JSplitPane key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see #setDividerLocation @see #resetToPreferredSizes @version 1.51 0461 03/2214/9900 @author Scott Violet


Class JSplitPane.AccessibleJSplitPane

TheThis class usedimplements toaccessibility support obtainfor the accessibleJSplitPane class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to split pane user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JSplitPane.AccessibleJSplitPane, AccessibleRole getAccessibleRole()

GetGets the role of this object. @return an instance of AccessibleRole describing the role of the object @see AccessibleRole
Class JSplitPane.AccessibleJSplitPane, AccessibleStateSet getAccessibleStateSet()

GetGets the state set of this object. @return an instance of AccessibleState containing the current state of the object @see AccessibleState
Class JSplitPane.AccessibleJSplitPane, AccessibleValue getAccessibleValue()

Get the AccessibleValue associated with this object. if oneIn the exists.implementation of the Java Accessibility API Otherwisefor this class return nullthis object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object
Class JSplitPane.AccessibleJSplitPane, Number getCurrentAccessibleValue()

GetGets the accessible value of this object. @return a localized String describing the value of this object
Class JSplitPane.AccessibleJSplitPane, Number getMaximumAccessibleValue()

GetGets the maximum accessible value of this object. @return The maximum value of this object.
Class JSplitPane.AccessibleJSplitPane, Number getMinimumAccessibleValue()

GetGets the minimum accessible value of this object. @return The minimum value of this object.
Class JSplitPane.AccessibleJSplitPane, boolean setCurrentAccessibleValue(Number)

SetSets the value of this object as a Number. @return True if the value was set.

Class JSplitPane, constructor JSplitPane()

ReturnsCreates a new JSplitPane configured to arrange the child components side-by-side horizontally with no continuous layout using two buttons for the compoentscomponents.
Class JSplitPane, constructor JSplitPane(int)

ReturnsCreates a new JSplitPane configured with the specified orientation and no continuous layout. @param newOrientation an intJSplitPane.HORIZONTAL_SPLIT specifyingor theJSplitPane.VERTICAL_SPLIT horizontal@exception or verticalIllegalArgumentException if orientation is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT.
Class JSplitPane, constructor JSplitPane(int, Component, Component)

ReturnsCreates a new JSplitPane with the specified orientation and with the specifiiedspecified components that doesdo not do continuous redrawing. @param newOrientation an int specifying the horizontalJSplitPane.HORIZONTAL_SPLIT or vertical orientationJSplitPane.VERTICAL_SPLIT @param newContinuousLayout a boolean true fornewLeftComponent the componentsComponent to redraw continuously asthat will appear on the dividerleft changes positionof a falsehorizontally-split to wait untilpane or at the divider positiontop stops changingof a tovertically-split redrawpane @param newLeftComponentnewRightComponent the Component that will appear on the leftright of a horizontally-split pane or at the topbottom of a vertically-split pane. @exception IllegalArgumentException if orientation is not one of: HORIZONTAL_SPLIT or VERTICAL_SPLIT
Class JSplitPane, constructor JSplitPane(int, boolean)

ReturnsCreates a new JSplitPane with the specified orientation and redrawing style. @param newOrientation an int specifying the horizontalJSplitPane.HORIZONTAL_SPLIT or vertical orientationJSplitPane.VERTICAL_SPLIT @param newContinuousLayout a boolean true for the components to redraw continuously as the divider changes position false to wait until the divider position stops changing to redraw @exception IllegalArgumentException if orientation is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT
Class JSplitPane, constructor JSplitPane(int, boolean, Component, Component)

ReturnsCreates a new JSplitPane with the specified orientation and redrawing style and with the specified components. @param newOrientation an int specifying the horizontalJSplitPane.HORIZONTAL_SPLIT or vertical orientationJSplitPane.VERTICAL_SPLIT @param newContinuousLayout a boolean true for the components to redraw continuously as the divider changes position false to wait until the divider position stops changing to redraw @param newLeftComponent the Component that will appear on the left of a horizontally-split pane or at the top of a vertically-split pane. @param newRightComponent the Component that will appear on the right of a horizontally-split pane or at the bottom of a vertically-split pane @exception IllegalArgumentException if orientation is not one of HORIZONTAL_SPLIT or VERTICAL_SPLIT
Class JSplitPane, void addImpl(Component, Object, int)

Adds the specified component to this split pane. If constraints identifies the left/top or right/bottom child component and a component with that identifier was previously added it will be removed and then comp will be added in its place. If constraints is not one of the known identifers the layout manager may throw an IllegalArgumentException.

The possible constraints objects (Strings) are:

  • JSplitPane.TOP
  • JSplitPane.LEFT
  • JSplitPane.BOTTOM
  • JSplitPane.RIGHT
If the constraints object is null the component is added in the first available position (left/top if open else right/bottom). @param comp the component to add @param constraints an Object specifying the layout constraints (position) for this component @param index an intinteger specifying the index in the container's list. @exception IllegalArgumentException thrown if the constraints object does not match an existing component @see java.awt.Container#addImpl(Component Object int)
Class JSplitPane, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJSplitPane. For split panes the AccessibleContext takes the form of an AccessibleJSplitPane. A new AccessibleJSplitPane instance is created if necessary. @return an AccessibleJSplitPane that serves as the AccessibleContext of this JComponentJSplitPane @beaninfo expert: true description: The AccessibleContext associated with this LabelSplitPane.
Class JSplitPane, Component getBottomComponent()

Returns the component below or to the right of the divider. @return the Component displayed in that position
Class JSplitPane, int getDividerLocation()

Returns the location of thelast value passed dividerto setDividerLocation. The value returned from this method may differ from the lookactual divider location (if setDividerLocation was passed a value bigger than and feelthe curent implementationsize). @return an intinteger specifying a UI-specific valuethe (typicallylocation a pixelof the count)divider
Class JSplitPane, int getDividerSize()

Returns the size of the divider. @return an intinteger giving the size of the divider in pixels
Class JSplitPane, int getLastDividerLocation()

Returns the last location the divider was at. @return an intinteger specifying the last divider location as a count of pixels from the left (or upper) edge of the pane to the left (or upper) edge of the divider
Class JSplitPane, Component getLeftComponent()

Returns the component to the left (or above) the divider. @return the Component displayed in that position @beaninfo preferred: true description: The component to the left (or above) the divider.
Class JSplitPane, int getMaximumDividerLocation()

Returns the maximum location of the divider from the look and feel implementation. @return an intinteger specifying a UI-specific value for the maximum location (typically a pixel count); or -1 if the UI is null
Class JSplitPane, int getMinimumDividerLocation()

Returns the minimum location of the divider from the look and feel implementation. @return an intinteger specifying a UI-specific value for the minimum location (typically a pixel count); or -1 if the UI is null @beaninfo description: The minimum location of the divider from the L&F.
Class JSplitPane, int getOrientation()

Returns the orientation. @return an intinteger giving the orientation @see #setOrientation
Class JSplitPane, Component getRightComponent()

Returns the component to the right (or below) the divider. @return the Component displayed in that position
Class JSplitPane, Component getTopComponent()

Returns the component above or to the left of the divider. @return the Component displayed in that position
Class JSplitPane, SplitPaneUI getUI()

Returns the SplitPaneUI that is providing the current look and feel. @return the SplitPaneUI object that renders this component @beaninfo expert: true description: The L&F object that renders this component.
Class JSplitPane, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "SplitPaneUI" @see JComponent#getUIClassID @see UIDefaults#getUI @beaninfo expert: true description: A string that specifies the name of the L&F class.
Class JSplitPane, boolean isValidateRoot()

CallsReturns true so that calls to revalidate() on any descendant of this JSplitPane will cause a request to be queued that will validate the JSplitPane and all its descendants. @return true @see JComponent#revalidate @beaninfo hidden: true
Class JSplitPane, void paintChildren(Graphics)

Subclassed to message the UI with finishedPaintingChildren after super has been messaged as well as painting the border. @param g the Graphics context within which to paint
Class JSplitPane, String paramString()

Returns a string representation of this JSplitPane. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JSplitPane.
Class JSplitPane, void remove(Component)

Removes the child component component from the pane. Resets the leftComponent or rightComponent instance variable as necessary. @param component the Component to remove
Class JSplitPane, void remove(int)

Removes the Component at the specified index. Updates the leftComponent and rightComponent instance variables as necessary and then messages super. @param index an intinteger specifying the component to remove where 1 specifies the left/top component and 2 specifies the bottom/right component
Class JSplitPane, void removeAll()

Removes all the child components from the receiversplit pane. Resets the leftComonent and rightComponent instance variables.
Class JSplitPane, void resetToPreferredSizes()

Messaged toLays out relayout the JSplitPane layout based on the preferred size of the children components. This will likely result in changing the divider location.
Class JSplitPane, void setBottomComponent(Component)

Sets the component below or to the right of the divider. @param comp the Component to display in that position @beaninfo description: The component below or to the right of the divider.
Class JSplitPane, void setDividerLocation(double)

Sets the divider location as a percentage of the JSplitPane's size.

This method is implemented in terms of setDividerLocation(int). This method immediately changes the size of the split pane based on its current size. If the split pane is not correctly realized and on screen this method will have no effect (new divider location will become (current size * proportionalLocation) which is 0). @param proportionalLocation a double-precision floating point value that specifies a percentage from zero (top/left) to 1.0 (bottom/right) @exception IllegalArgumentException if the specified location is <0 or > 1.0 @beaninfo description: The location of the divider.

Class JSplitPane, void setDividerLocation(int)

Sets the location of the divider. This is passed off to the look and feel implementation and then listeners are notified. A value less than 0 implies the divider should be reset to a value that attempts to honor the preferred size of the left/top component. After notifying the listeners the last divider location is updated via setLastDividerLocation. @param location an int specifying a UI-specific value (typically a pixel count) @beaninfo bound: true description: The location of the divider.
Class JSplitPane, void setDividerSize(int)

Sets the size of the divider. @param newSize an intinteger giving the size of the divider in pixels @beaninfo bound: true description: The size of the divider.
Class JSplitPane, void setLastDividerLocation(int)

Sets the last location the divider was at to newLastLocation. @param newLastLocation an intinteger specifying the last divider location in pixels from the left (or upper) edge of the pane to the left (or upper) edge of the divider @beaninfo bound: true description: The last location the divider was at.
Class JSplitPane, void setLeftComponent(Component)

Sets the component to the left (or above) the divider. @param comp the Component to display in that position
Class JSplitPane, void setOneTouchExpandable(boolean)

Determines whether the JSplitPane provides a UI widget on the divider to quickly expand/collapse the divider. @param newValue a boolean where true means to provide a collapse/expand widget @beaninfo bound: true description: UI widget on the divider to quickly expand/collapse the divider.
Class JSplitPane, void setOrientation(int)

Sets the orientation or how the splitter is divided. The options are:
  • JSplitPane.VERTICAL_SPLIT (above/below orientation of components)
  • JSplitPane.HORIZONTAL_SPLIT (left/right orientation of components)
@param orientation an intinteger specifying the orientation @exception IllegalArgumentException if orientation is not one of: HORIZONTAL_SPLIT or VERTICAL_SPLIT. @beaninfo bound: true description: The orientation or how the splitter is divided. enum: HORIZONTAL_SPLIT JSplitPane.HORIZONTAL_SPLIT VERTICAL_SPLIT JSplitPane.VERTICAL_SPLIT
Class JSplitPane, void setRightComponent(Component)

Sets the component to the right (or below) the divider. @param comp the Component to display in that position @beaninfo preferred: true description: The component to the right (or below) the divider.
Class JSplitPane, void setTopComponent(Component)

Sets the component above or to the left of the divider. @param comp the Component to display in that position @beaninfo description: The component above or to the left of the divider.
Class JSplitPane, void setUI(SplitPaneUI)

Sets the L&F object that renders this component. @param ui the SplitPaneUI L&F object @see UIDefaults#getUI
Class JSplitPane, void updateUI()

Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager. @see JComponent#updateUI
Class JSplitPane, String BOTTOM

Used to add a Component below the other Component.
Class JSplitPane, String DIVIDER

Used to add a Component that will represent the divider.
Class JSplitPane, int HORIZONTAL_SPLIT

Horizontal split indicates the ComponentsComponents are split along the x axis. For egexample the two ComponentsComponents will be split one to the left of the other.
Class JSplitPane, String LEFT

Used to add a Component to the left of the other Component.
Class JSplitPane, String RIGHT

Used to add a Component to the right of the other Component.
Class JSplitPane, String TOP

Used to add a Component above the other Component.
Class JSplitPane, int VERTICAL_SPLIT

Vertical split indicates the ComponentsComponents are split along the y axis. For egexample the two ComponentsComponents will be split one on top of the other.

Class JTabbedPane

A component whichthat lets the user switch between a group of components by clicking on a tab with a given title and/or icon. For examples and information on using tabbed panes see How to Use Tabbed Panes a section in The Java Tutorial.

Tabs/components are added to a TabbedPane object by using the addTab and insertTab methods. A tab is represented by an index corresponding to the position it was added in where the first tab has an index equal to 0 and the last tab has an index equal to the tab count minus 1.

The TabbedPane uses a SingleSelectionModel to represent the set of tab indecesindices and the currently selected index. If the tab count is greater than 0 then there will always be a selected index which by default will be initialized to the first tab. If the tab count is 0 then the selected index will be -1.

See How to Use Tabbed Panes in The Java Tutorial for further documentation. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JTabbedPane key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer true description: A component which provides a tab folder metaphor for displaying one component from a set of components. @version %I% %G% @author Dave Moore @author Philip Milne @author Amy Fowler @see SingleSelectionModel


Class JTabbedPane.AccessibleJTabbedPane

TheThis class usedimplements toaccessibility support obtainfor the accessibleJTabbedPane class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to tabbed pane user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JTabbedPane.AccessibleJTabbedPane, Accessible getAccessibleChild(int)

Return the specified Accessible child of the object. @param i zero-based index of child @return the Accessible child of the object @exception IllegalArgumentException if index is out of bounds
Class JTabbedPane.AccessibleJTabbedPane, AccessibleSelection getAccessibleSelection()

Get the AccessibleSelection associated with this object. if oneIn the exists.implementation Otherwise returnof the null.Java @Accessibility API for this class return this object which is responsible for implementing the AccessibleSelection orinterface on behalf of nullitself. @return this object

Class JTabbedPane.ModelListener

We pass ModelChanged events along to the listeners with the tabbedpane (instead of the model itself) as the event source.

Class JTabbedPane, constructor JTabbedPane()

Creates an empty TabbedPane. The default tab placement is TOP. @see #addTab
Class JTabbedPane, constructor JTabbedPane(int)

Creates an empty TabbedPane with the specified tab placement of either: TOP BOTTOM LEFT or RIGHT. @param tabPlacement the placement for the tabs relative to the content @see #addTab
Class JTabbedPane, Component add(Component)

Adds a component with a tab title defaulting to the name of the component. Cover method for insertTab(). @param component Thethe component to be displayed when this tab is clicked. @return the component @see #insertTab @see #removeTabAt
Class JTabbedPane, void add(Component, Object)

Adds a component to the tabbed pane. If constraints is a String or an Icon it will be used for the tab title otherwise the component's name will be used as the tab title. Cover method for insertTab(). @param component Thethe component to be displayed when this tab is clicked. @param constraints the object to be displayed in the tab @see #insertTab @see #removeTabAt
Class JTabbedPane, void add(Component, Object, int)

Adds a component at the specified tab index. If constraints is a String or an Icon it will be used for the tab title otherwise the component's name will be used as the tab title. Cover method for insertTab(). @param component Thethe component to be displayed when this tab is clicked. @constraints the object to be displayed in the tab @param index the position to insert this new tab @see #insertTab @see #removeTabAt
Class JTabbedPane, Component add(Component, int)

Adds a component at the specified tab index with a tab title defaulting to the name of the component. Cover method for insertTab(). @param component Thethe component to be displayed when this tab is clicked. @param index the position to insert this new tab @return the component @see #insertTab @see #removeTabAt
Class JTabbedPane, Component add(String, Component)

Adds a component with the specified tab title. Cover method for insertTab(). @param title the title to be displayed in this tab @param component Thethe component to be displayed when this tab is clicked. @return the component @see #insertTab @see #removeTabAt
Class JTabbedPane, void addChangeListener(ChangeListener)

Adds a ChangeListener to this tabbedpane. @param l the ChangeListener to add @see #fireStateChanged @see #removeChangeListener
Class JTabbedPane, void addTab(String, Component)

Adds a component represented by a title and no icon. Cover method for insertTab(). @param title the title to be displayed in this tab @param component The component to be displayed when this tab is clicked. @see #insertTab @see #removeTabAt
Class JTabbedPane, void addTab(String, Icon, Component)

Adds a component represented by a title and/or icon either of which can be null. Cover method for insertTab(). @param title the title to be displayed in this tab @param icon the icon to be displayed in this tab @param component Thethe component to be displayed when this tab is clicked. @see #insertTab @see #removeTabAt
Class JTabbedPane, void addTab(String, Icon, Component, String)

Adds a component and tip represented by a title and/or icon either of which can be null. Cover method for insertTab(). @param title the title to be displayed in this tab @param icon the icon to be displayed in this tab @param component The component to be displayed when this tab is clicked. @param tip the tooltip to be displayed for this tab @see #insertTab @see #removeTabAt
Class JTabbedPane, ChangeListener createChangeListener()

Subclasses that want to handle ChangeEvents differently can override this to return a subclass of ModelListener or another ChangeListener implementation. @see #fireStateChanged
Class JTabbedPane, void fireStateChanged()

Send a ChangeEvent whose source is this tabbedpane to each listener. This method method is called each time a ChangeEvent is received from the model. @see #addChangeListener @see EventListenerList
Class JTabbedPane, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJTabbedPane. For tabbed panes the AccessibleContext takes the form of an AccessibleJTabbedPane. A new AccessibleJTabbedPane instance is created if necessary. @return an AccessibleJTabbedPane that serves as the AccessibleContext of this JComponentJTabbedPane
Class JTabbedPane, Color getBackgroundAt(int)

Returns the tab background color at index. @param index the index of the item being queried @return the Color of the tab background at index @exception IllegalArgumentException if index is out of bounds @see #setBackgroundAt
Class JTabbedPane, Rectangle getBoundsAt(int)

Returns the tab bounds at index. If the tab at this index is not currently visible in the UI then returns null. If there is no UI set on this tabbedpane then returns null. @param index the index to be queried @return a Rectangle containing the tab bounds at index or null if tab at index is not currently visible in the UI or if there is no UI set on this tabbedpane
Class JTabbedPane, Component getComponentAt(int)

Returns the component at index. @param index the index of the item being queried @return the Component at index @exception IllegalArgumentException if index is out of bounds @see #setComponentAt
Class JTabbedPane, Icon getDisabledIconAt(int)

Returns the tab disabled icon at index. @param index the index of the item being queried @return the icon at index @exception IllegalArgumentException if index is out of bounds @see #setDisabledIconAt
Class JTabbedPane, Color getForegroundAt(int)

Returns the tab foreground color at index. @param index the index of the item being queried @return the Color of the tab foreground at index @exception IllegalArgumentException if index is out of bounds @see #setForegroundAt
Class JTabbedPane, Icon getIconAt(int)

Returns the tab icon at index. @param index the index of the item being queried @return the icon at index @exception IllegalArgumentException if index is out of bounds @see #setIconAt
Class JTabbedPane, Component getSelectedComponent()

Returns the currently selected component for this tabbedpane. Returns null if there is no currently selected tab. @return the component corresponding to the selected tab @see #setSelectedComponent
Class JTabbedPane, int getTabCount()

Returns the number of tabs in this tabbedpane. @return an intinteger specifying the number of tabbed pages
Class JTabbedPane, int getTabRunCount()

Returns the number of tab runs currently used to display the tabs. @return an intinteger giving the number of rows if the tabPlacement is TOP or BOTTOM and the number of columns if tabPlacement is LEFT or RIGHT or 0 if there is no UI set on this tabbedpane
Class JTabbedPane, String getTitleAt(int)

Returns the tab title at index. @param index the index of the item being queried @return the title at index @exception IllegalArgumentException if index is out of bounds @see #setTitleAt
Class JTabbedPane, String getToolTipText(MouseEvent)

Returns the tooltip text for the component determined by the mouse event location. @param event the MouseEvent that tells where the cursor is lingering @return the String withcontaining the tooltip text @exception IllegalArgumentException if index is out of bounds
Class JTabbedPane, String getUIClassID()

Returns the name of the UI class that implements the L&F for this component. @return the string "TabbedPaneUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JTabbedPane, int indexOfComponent(Component)

Returns the index of the tab for the specified component. Returns -1 if there is no tab for this component. @param component the component for the tab @return the first tab which matches this component or -1 if there is no tab for this component
Class JTabbedPane, int indexOfTab(Icon)

Returns the first tab index with a given icon. Returnsor -1 if no tab has this icon. @param icon the icon for the tab @return the first tab index which matches icon or -1 if no tab has this icon
Class JTabbedPane, int indexOfTab(String)

Returns the first tab index with a given title Returnsor -1 if no tab has this title. @param title the title for the tab @return the first tab index which matches title or -1 if no tab has this title
Class JTabbedPane, void insertTab(String, Icon, Component, String, int)

Inserts a component at index represented by a title and/or icon either of which may be null. Uses java.util.Vector internally see insertElementAt() for details of insertion conventions. @param title the title to be displayed in this tab @param icon the icon to be displayed in this tab @param component The component to be displayed when this tab is clicked. @param tip the tooltip to be displayed for this tab @param index the position to insert this new tab @see #addTab @see #removeTabAt
Class JTabbedPane, boolean isEnabledAt(int)

Returns whether or not the tab at index is currently enabled. @param index the index of the item being queried @return true if the tab at index is enabled; false otherwise @exception IllegalArgumentException if index is out of bounds @see #setEnabledAt
Class JTabbedPane, String paramString()

Returns a string representation of this JTabbedPane. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JTabbedPane.
Class JTabbedPane, void removeAll()

Removes all the tabs and their corresponding components from the tabbedpane. @see #addTab @see #removeTabAt
Class JTabbedPane, void removeChangeListener(ChangeListener)

Removes a ChangeListener from this tabbedpane. @param l the ChangeListener to remove @see #fireStateChanged @see #addChangeListener
Class JTabbedPane, void removeTabAt(int)

Removes the tab at index. After the component associated with index is removed its visibility is reset to true to ensure it will be visible if added to other containers. @param index the index of the tab to be removed @see #addTab @see #insertTab
Class JTabbedPane, void setBackgroundAt(int, Color)

Sets the background color at index to background which can be null in which case the tab's background color will default to the background color of the tabbedpane. An internal exception is raised if there is no tab at that index. @param index the tab index where the background should be set @param background the color to be displayed in the tab's background @exception IllegalArgumentException if index is out of bounds @see #getBackgroundAt @beaninfo preferred: true attribute: visualUpdate true description: The background color at the specified tab index.
Class JTabbedPane, void setComponentAt(int, Component)

Sets the component at index to component. An internal exception is raised if there is no tab at that index. @param index the tab index where this component is being placed @param component the component for the tab @exception IllegalArgumentException if index is out of bounds @see #getComponentAt @beaninfo attribute: visualUpdate true description: The component at the specified tab index.
Class JTabbedPane, void setDisabledIconAt(int, Icon)

Sets the disabled icon at index to icon which can be null. An internal exception is raised if there is no tab at that index. @param index the tab index where the disabled icon should be set @param icon the icon to be displayed in the tab when disabled @exception IllegalArgumentException if index is out of bounds @see #getDisabledIconAt @beaninfo preferred: true attribute: visualUpdate true description: The disabled icon at the specified tab index.
Class JTabbedPane, void setEnabledAt(int, boolean)

Sets whether or not the tab at index is enabled. An internal exception is raised if there is no tab at that index. @param index the tab index which should be enabled/disabled @param enabled whether or not the tab should be enabled @exception IllegalArgumentException if index is out of bounds @see #isEnabledAt
Class JTabbedPane, void setForegroundAt(int, Color)

Sets the foreground color at index to foreground which can be null in which case the tab's foreground color will default to the foreground color of this tabbedpane. An internal exception is raised if there is no tab at that index. @param index the tab index where the foreground should be set @param foreground the color to be displayed as the tab's foreground @exception IllegalArgumentException if index is out of bounds @see #getForegroundAt @beaninfo preferred: true attribute: visualUpdate true description: The foreground color at the specified tab index.
Class JTabbedPane, void setIconAt(int, Icon)

Sets the icon at index to icon which can be null. An internal exception is raised if there is no tab at that index. @param index the tab index where the icon should be set @param icon the icon to be displayed in the tab @exception IllegalArgumentException if index is out of bounds @see #getIconAt @beaninfo preferred: true attribute: visualUpdate true description: The icon at the specified tab index.
Class JTabbedPane, void setSelectedComponent(Component)

Sets the selected component for this tabbedpane. This will automatically set the selectedIndex to the index corresponding to the specified component. @exception IllegalArgumentException if component not found in tabbed pane @see #getSelectedComponent @beaninfo preferred: true description: The tabbedpane's selected component.
Class JTabbedPane, void setSelectedIndex(int)

Sets the selected index for this tabbedpane. @param index the index to be selected @exception IllegalArgumentException if index is out of bounds @see #getSelectedIndex @see SingleSelectionModel#setSelectedIndex @beaninfo preferred: true description: The tabbedpane's selected tab index.
Class JTabbedPane, void setTabPlacement(int)

Sets the tab placement for this tabbedpane. Possible values are:
  • SwingConstants.TOP
  • SwingConstants.BOTTOM
  • SwingConstants.LEFT
  • SwingConstants.RIGHT
The default value if not set is SwingConstants.TOP. @param tabPlacement the placement for the tabs relative to the content @exception IllegalArgumentException if tab placement value isn't one of the above valid values @beaninfo preferred: true bound: true attribute: visualUpdate true enum: TOP JTabbedPane.TOP LEFT JTabbedPane.LEFT BOTTOM JTabbedPane.BOTTOM RIGHT JTabbedPane.RIGHT description: The tabbedpane's tab placement.
Class JTabbedPane, void setTitleAt(int, String)

Sets the title at index to title which can be null. An internal exception is raised if there is no tab at that index. @param index the tab index where the title should be set @param title the title to be displayed in the tab @exception IllegalArgumentException if index is out of bounds @see #getTitleAt @beaninfo preferred: true attribute: visualUpdate true description: The title at the specified tab index.
Class JTabbedPane, void updateUI()

Notification from the UIManager that the L&F has changed. Called to replace the UI with the latest version from the default UIFactory. @see JComponent#updateUI
Class JTabbedPane, ChangeEvent changeEvent

Only one ChangeEvent is needed per TabPane instance since the event's only (read-only) state is the source property. The source of events generated here is always "this".

Class JTable

JTable is a user-interface component that presents data in a two-dimensional table format. See How to Use Tables in The Java Tutorial for task-oriented documentation and examples of using JTable.

The JTable has many facilities that make it possible to customize its rendering and editing but provides defaults for these features so that simple tables can be set up easily. For example to set up a table with 10 rows and 10 columns of numbers:

 TableModel dataModel = new AbstractTableModel() { public int getColumnCount() { return 10; } public int getRowCount() { return 10;} public Object getValueAt(int row int col) { return new Integer(row*col); } }; JTable table = new JTable(dataModel); JScrollPane scrollpane = new JScrollPane(table); 

Because the JTable is now much easier to set up with custom models the DefaultTableModel is less useful than it was in previous releases. Instead of copying the data in an application into the DefaultTableModel we recommend wrapping it in the methods of the TableModel interface and passing the real data to the JTable as above. This technique is nearly as concise as using a DefaultTableModel and starting this way has a number of advantages over the longer term. In particular: it is a scalable technique is easier tocan more easily handle dynamic or editable tables and often results in much more efficient applications because the model is free to choose the internal representation that best suits the data.

The "Table" directory in the examples/demo area gives a number of complete examples of JTable usage covering how the JTable can be used to provide an editable view of data taken from a database and how to modify the columns in the display to use specialized renderers and editors. For example overriding AbstractTableModel's getColumnClass() method to return a value of ImageIcon.class for a given column allows icons to be displayed while returning a value of Number.class allows digits to be right-justified in the column.

The JTable uses integers exclusively to refer to both the rows and the columns of the model that it displays. The JTable simply takes a tabular range of cells and uses getValueAt(int int) to retrieve and display the appropriate values from the model.

If getTableHeader().setReorderingAllowed(boolean) is used to enable column reordering columns may be rearranged in the JTable so that the view's columns appear in a different order to the columns in the model. This does not affect the implementation of the model at all: when the columns are reordered the JTable maintains the new order of the columns internally and converts its column indices before querying the model.

So when writing a TableModel it is not necessary to listen for column reordering events as the the model will be queried in its own co-ordinatecoordinate system regardless of what is happening in the view. In the examples area there is a demonstration of a sorting algorithm making use of exactly this technique to interpose yet another co-ordinatecoordinate system where the order of the rows is changed rather than the order of the columns.

The general rule for the JTable API and the APIs of all its associated classes including the the column model and both the row and column selection models is: methods using integer indices for rows and columns always use the co-ordinatecoordinate system of the view. There are three exceptions to this rule:

  • All references to rows and columns in the TableModel interface are in the co-ordinatecoordinate system of the model.
  • The index modelIndex in the TableColumn constructors refers to the index of the column in the model not the view.
  • All constructors for the TableModelEvent which describes changes that have taken place in a table model use the co-ordinatecoordinate system of the model.
The TableColumn provides a slot for holding an identifier or "tag" for each column and the JTable and TableColumModelTableColumnModel
both support getColumn(Object id) conveniences for locating columns by their identifier. If no identifier is explicitly set the TableColumn returns its header value (the name of the column) as a default. A different identifier which can be of any type can be set using the TableColumn's setIdentifier() method. All of the JTable's functions operate correctly regardless of the type and uniqueness of these identifiers.

The convertColumnIndexToView() and convertColumnIndexToModel() methods have been provided to convert between the two co-ordinatecoordinate systems but they are rarely needed during normal use.

LikeAs for all JComponent classes you can use JComponent#registerKeyboardActionInputMap and ActionMap to associate an Action object with a KeyStroke and execute the action under specified conditions.

See How to Use Tables in The Java Tutorial for further documentation. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JTable key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A component which displays data in a two dimensional grid. @version 1.120 04165 03/2214/9900 @author Philip Milne @author Alan Chung


Class JTable.AccessibleJTable

TheThis class usedimplements toaccessibility support obtainfor the accessibleJTable class. role forIt provides thisan implementation of the Java Accessibility API appropriate to table user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JTable.AccessibleJTable.AccessibleJTableCell

The class usedprovides toan implementation obtainof the AccessibleRoleJava Accessibility forAPI appropriate to a celltable cells.
Class JTable.AccessibleJTable.AccessibleJTableCell, constructor JTable.AccessibleJTable.AccessibleJTableCell(AccessibleJTable, JTable, int, int, int)

Constructs an AccessiblJTableHeaaderEntryAccessibleJTableHeaderEntry
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleAction getAccessibleAction()

GetGets the AccessibleAction associated with this object if one exists. Otherwise returnreturns null. @return the AccessibleAction or null
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleComponent getAccessibleComponent()

GetGets the AccessibleComponent associated with this object if one exists. Otherwise returnreturns null. @return the AccessibleComponent or null
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this @returncomponent. In the AccessibleContextimplementation of the Java Accessibility API for this class return this object which is its own AccessibleContext. @return this JComponentobject
Class JTable.AccessibleJTable.AccessibleJTableCell, String getAccessibleDescription()

GetGets the accessible description of this object. @return the localized description of the object; null if this object does not have a description
Class JTable.AccessibleJTable.AccessibleJTableCell, int getAccessibleIndexInParent()

GetGets the index of this object in its accessible parent. @return the index of this object in its parent; -1 if this object does not have an accessible parent. @see #getAccessibleParent
Class JTable.AccessibleJTable.AccessibleJTableCell, String getAccessibleName()

GetGets the accessible name of this object. @return the localized name of the object; null if this object does not have a name
Class JTable.AccessibleJTable.AccessibleJTableCell, Accessible getAccessibleParent()

GetGets the Accessible parent of this object. @return the Accessible parent of this object; null if this object does not have an Accessible parent
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleRole getAccessibleRole()

GetGets the role of this object. @return an instance of AccessibleRole describing the role of the object @see AccessibleRole
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleSelection getAccessibleSelection()

GetGets the AccessibleSelection associated with this object if one exists. Otherwise returnreturns null. @return the AccessibleSelection or null
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleStateSet getAccessibleStateSet()

GetGets the state set of this object. @return an instance of AccessibleStateSet containing the current state set of the object @see AccessibleState
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleText getAccessibleText()

GetGets the AccessibleText associated with this object if one exists. Otherwise returnreturns null. @return the AccessibleText or null
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleValue getAccessibleValue()

GetGets the AccessibleValue associated with this object if one exists. Otherwise returnreturns null. @return the AccessibleValue or null
Class JTable.AccessibleJTable.AccessibleJTableCell, Color getBackground()

GetGets the background color of this object. @return the background color if supported of the object; otherwise null.
Class JTable.AccessibleJTable.AccessibleJTableCell, Cursor getCursor()

GetGets the Cursor of this object. @return the Cursor if supported of the object; otherwise null
Class JTable.AccessibleJTable.AccessibleJTableCell, Font getFont()

GetGets the Font of this object. @return the Font if supported for the object; otherwise null
Class JTable.AccessibleJTable.AccessibleJTableCell, FontMetrics getFontMetrics(Font)

GetGets the FontMetrics of this object. @param f the Font @return the FontMetrics if supported the object; otherwise null @see #getFont
Class JTable.AccessibleJTable.AccessibleJTableCell, Color getForeground()

GetGets the foreground color of this object. @return the foreground color if supported of the object; otherwise null
Class JTable.AccessibleJTable.AccessibleJTableCell, Locale getLocale()

Gets the locale of the component. If the component does not have a locale then the locale of its parent is returned. @return Thisthis component's locale.; Ifif this component does not have a locale the locale of its parent is returned. @exception IllegalComponentStateException Ifif the Component does not have its own locale and has not yet been added to a containment hierarchy such that the locale can be determined from the containing parent. @see #setLocale
Class JTable.AccessibleJTable.AccessibleJTableCell, Point getLocation()

Gets the location of the object relative to the parent in the form of a point specifying the object's top-left corner in the screen's coordinate space. @return Anan instance of Point representing the top-left corner of the objectsobject's bounds in the coordinate space of the screen; null if this object or its parent are not on the screen
Class JTable.AccessibleJTable.AccessibleJTableCell, boolean isEnabled()

DetermineDetermines if the object is enabled. @return true if object is enabled; otherwise false
Class JTable.AccessibleJTable.AccessibleJTableCell, boolean isShowing()

DetermineDetermines if the object is showing. This is determined by checking the visibility of the object and ancestors of the object. Note: this will return true even if the object is obscured by another (for example it happens to be underneath a menu that was pulled down). @return true if the object is showing; otherwise false
Class JTable.AccessibleJTable.AccessibleJTableCell, boolean isVisible()

DetermineDetermines if thethis object is visible. Note: this means that the object intends to be visible; however it may not in fact be showing on the screen because one of the objects that this object is contained by is not visible. To determine if an object is showing on the screen use isShowing(). @return true if object is visible; otherwise false
Class JTable.AccessibleJTable.AccessibleJTableCell, void setAccessibleDescription(String)

SetSets the accessible description of this object. @param s the new localized description of the object
Class JTable.AccessibleJTable.AccessibleJTableCell, void setAccessibleName(String)

SetSets the localized accessible name of this object. @param s the new localized name of the object.
Class JTable.AccessibleJTable.AccessibleJTableCell, void setBackground(Color)

SetSets the background color of this object. @param c the new Color for the background
Class JTable.AccessibleJTable.AccessibleJTableCell, void setCursor(Cursor)

SetSets the Cursor of this object. @param c the new Cursor for the object
Class JTable.AccessibleJTable.AccessibleJTableCell, void setEnabled(boolean)

SetSets the enabled state of the object. @param b if true enables this object; otherwise disables it
Class JTable.AccessibleJTable.AccessibleJTableCell, void setFont(Font)

SetSets the Font of this object. @param f the new Font for the object
Class JTable.AccessibleJTable.AccessibleJTableCell, void setForeground(Color)

SetSets the foreground color of this object. @param c the new Color for the foreground
Class JTable.AccessibleJTable.AccessibleJTableCell, void setVisible(boolean)

SetSets the visible state of the object. @param b if true shows this object; otherwise hides it

Class JTable.AccessibleJTable, AccessibleRole getAccessibleRole()

GetGets the role of this object. @return an instance of AccessibleRole describing the role of the object @see AccessibleRole
Class JTable.AccessibleJTable, AccessibleSelection getAccessibleSelection()

Get the AccessibleSelection associated with this object. if oneIn the exists.implementation Otherwise returnof the null.Java @Accessibility API for this class return this object which is responsible for implementing the AccessibleSelection orinterface on behalf of nullitself. @return this object

Class JTable, constructor JTable()

Constructs a default JTable whichthat is initialized with a default data model a default column model and a default selection model. @see #createDefaultDataModel @see #createDefaultColumnModel @see #createDefaultSelectionModel
Class JTable, constructor JTable(Object[][], Object[])

Constructs a JTable to display the values in the two dimensional array rowData with column names columnNames. rowData is an Arrayarray of rows so the value of the cell at row 1 column 5 can be obtained with the following code:

 rowData[1][5]; 

All rows must be of the same length as columnNames.

@param rowData Thethe data for the new table @param columnNames Namesnames of each column

Class JTable, constructor JTable(TableModel)

Constructs a JTable whichthat is initialized with dm as the data model a default column model and a default selection model. @param dm Thethe data model for the table @see #createDefaultColumnModel @see #createDefaultSelectionModel
Class JTable, constructor JTable(TableModel, TableColumnModel)

Constructs a JTable whichthat is initialized with dm as the data model cm as the column model and a default selection model. @param dm Thethe data model for the table @param cm Thethe column model for the table @see #createDefaultSelectionModel
Class JTable, constructor JTable(TableModel, TableColumnModel, ListSelectionModel)

Constructs a JTable whichthat is initialized with dm as the data model cm as the column model and sm as the selection model. If any of the parameters are null this method will initialize the table with the corresponding default model. The autoCreateColumnsFromModel flag is set to false if cm is non-null otherwise it is set to true and the column model is populated with suitable TableColumns for the columns in dm. @param dm Thethe data model for the table @param cm Thethe column model for the table @param sm Thethe row selection model for the table @see #createDefaultDataModel @see #createDefaultColumnModel @see #createDefaultSelectionModel
Class JTable, constructor JTable(Vector, Vector)

Constructs a JTable to display the values in the Vector of Vectors rowData with column names columnNames. The Vectors contained in rowData should contain the values for that row. In other words the value of the cell at row 1 column 5 can be obtained with the following code:

((Vector)rowData.elementAt(1)).elementAt(5);

All rowsEach row must becontain ofa thevalue for each same length ascolumn or an columnNamesexception will be raised.

@param rowData Thethe data for the new table @param columnNames Namesnames of each column

Class JTable, constructor JTable(int, int)

Constructs a JTable with numRows and numColumns of empty cells using the DefaultTableModel. The columns will have names of the form "A" "B" "C" etc. @param numRows Thethe number of rows the table holds @param numColumns Thethe number of columns the table holds @see javax.swing.table.DefaultTableModel
Class JTable, void addColumn(TableColumn)

Appends aColumn to the end of the array of columns held by thethis JTable's column model. If the header valuecolumn name of aColumn is null sets the headercolumn valuename of aColumn to the name returned by getModel().getColumnName().

To add a column to thethis JTable to display the modelColumn'th column of data in the model with a given width cellRenderer and cellEditor you can use:

 addColumn(new TableColumn(modelColumn width cellRenderer cellEditor)); 
[AllAny of the otherTableColumn constructors in the TableColumn can be used in placeinstead of this one.] The model column number is stored inside the TableColumn and is used during rendering and editing to locate the appropriateappropriates data values in the model. The model column number does not change when columns are reordered in the view. @param aColumn The the TableColumn to be added @see #removeColumn
Class JTable, void addColumnSelectionInterval(int, int)

Adds the columns from index0 to index0index1 inclusive to the current selection. @exception IllegalArgumentException if index0 or index1 lie outside [0 getColumnCount()-1] @param index0 one end of the interval. @param index1 the other end of the interval
Class JTable, void addNotify()

Calls the configureEnclosingScrollPane method. @see #configureEnclosingScrollPane
Class JTable, void addRowSelectionInterval(int, int)

Adds the rows from index0 to index0index1 inclusive to the current selection. @exception IllegalArgumentException if index0 or index1 lie outside [0 getRowCount()-1] @param index0 one end of the interval. @param index1 the other end of the interval
Class JTable, void columnAdded(TableColumnModelEvent)

Tells listenersInvoked when that a column wasis added to the table column model.

Application code will not use these methods explicitly they are used internally by JTable. @see TableColumnModelListener

Class JTable, int columnAtPoint(Point)

Returns the index of the column that point lies in or -1 if itthe liesresult is not outsidein the receiver'srange [0 boundsgetColumnCount()-1]. @param point the location of interest @return the index of the column that point lies in or -1 if it lies outsidethe result is not in the receiver'srange bounds[0 getColumnCount()-1] @see #rowAtPoint
Class JTable, void columnMarginChanged(ChangeEvent)

Tells listenersInvoked when that a column wasis moved due to a margin change. If a cell is being edited then editing is stopped and the cell is redrawn.

Application code will not use these methods explicitly they are used internally by JTable. @param e the event received @see TableColumnModelListener

Class JTable, void columnMoved(TableColumnModelEvent)

Tells listenersInvoked when that a column wasis repositioned. If a cell is being edited then editing is stopped and the cell is redrawn.

Application code will not use these methods explicitly they are used internally by JTable. @param e the event received @see TableColumnModelListener

Class JTable, void columnRemoved(TableColumnModelEvent)

Tells listenersInvoked when that a column wasis removed from the table column model.

Application code will not use these methods explicitly they are used internally by JTable. @see TableColumnModelListener

Class JTable, void columnSelectionChanged(ListSelectionEvent)

Tells listenersInvoked when that the selection model of the TableColumnModel is changed.

Application code will not use these methods explicitly they are used internally by JTable. @param e the event received @see TableColumnModelListener

Class JTable, void configureEnclosingScrollPane()

If thethis JTable is the viewportView of an enclosing JScrollPane (the usual situation) configure this ScrollPane by amongst other things installing the table's tableHeader as the columnHeaderView of the scrollpanescroll pane. When a JTable is added to a JScrollPane in the usual way using new JScrollPane(myTable) addNotify is called in the JTable (when the table is added to the viewport). JTable's addNotify method in turn calls this method which is protected so that this default installation procedure can be overridden by a subclass. @see #addNotify
Class JTable, int convertColumnIndexToModel(int)

ReturnMaps the index of the column in the modelview whoseat dataviewColumnIndex is being displayed into the index of the column viewColumnIndex in the displaytable model. Returns viewColumnIndexthe index of the corresponding column in the unchangedmodel. when If viewColumnIndex is less than zero returns viewColumnIndex. @param viewColumnIndex the index of the column in the view @return the index of the corresponding column in the model @see #convertColumnIndexToView
Class JTable, int convertColumnIndexToView(int)

ReturnMaps the index of the column in the viewtable whichmodel isat modelColumnIndex displayingto the dataindex fromof the column modelColumnIndex in the modelview. Returns the index of the corresponding column in the view; returns -1 if this column is not being displayed. Returns modelColumnIndex unchanged whenIf modelColumnIndex is less than zero returns modelColumnIndex. @param modelColumnIndex the index of the column in the model @return the index of the corresponding column in the view @see #convertColumnIndexToModel
Class JTable, TableColumnModel createDefaultColumnModel()

Returns the default column model object which is a DefaultTableColumnModel. SubclassA subclass can override this method to return a different column model object. @return the default column model object @see javax.swing.table.DefaultTableColumnModel
Class JTable, void createDefaultColumnsFromModel()

ThisCreates method will create default columns for the table from the data model using the getColumnCount() and getColumnClass() methodsmethod defined in the TableModel interface.

This method will clearClears any exsitingexisting columns before creating the new columns based on information from the model. @see #getAutoCreateColumnsFromModel

Class JTable, TableModel createDefaultDataModel()

Returns the default table model object which is a DefaultTableModel. SubclassA subclass can override this method to return a different table model object. @return the default table model object @see javax.swing.table.DefaultTableModel
Class JTable, void createDefaultEditors()

Creates default cell editors for Objectsobjects numbers and boolean values. @see DefaultCellEditor
Class JTable, ListSelectionModel createDefaultSelectionModel()

Returns the default selection model object which is a DefaultListSelectionModel. SubclassA subclass can override this method to return a different selection model object. @return the default selection model object @see javax.swing.DefaultListSelectionModel
Class JTable, JTableHeader createDefaultTableHeader()

Returns the default table header object which is a JTableHeader. SubclassA subclass can override this method to return a different table header object. @return the default table header object @see javax.swing.table.JTableHeader
Class JTable, void doLayout()

Causes this containertable to lay out its components. Most programsrows shouldand not callcolumns. this method directly but should invoke theOverridden so that columns can be resized validateto methodaccomodate instead.a @seechange java.awt.LayoutManager#layoutContainerin @seethe #setLayoutsize @seeof #validatea @sincecontaining JDK1parent.1
Class JTable, boolean editCellAt(int, int)

Programmatically starts editing the cell at row and column if the cell is editable. @param row the row to be edited @param column the column to be edited @exception IllegalArgumentException If row or column areis not in the valid range @return false if for any reason the cell cannot be edited.
Class JTable, boolean editCellAt(int, int, EventObject)

Programmatically starts editing the cell at row and column if the cell is editable. To prevent the JTable from editing a particular table column or cell value return false from the isCellEditable() method in the TableModel interface. @param row the row to be edited @param column the column to be edited @param e event to pass into shouldSelectCell @exception IllegalArgumentException If row or column areis not in the valid range @return false if for any reason the cell cannot be edited.
Class JTable, void editingCanceled(ChangeEvent)

Invoked when editing is canceled. The editor object is discarded and the cell is rendered once again.

Application code will not use these methods explicitly they are used internally by JTable. @param e the event received @see CellEditorListener

Class JTable, void editingStopped(ChangeEvent)

Invoked when editing is finished. The changes are saved and the editor is discarded.

Application code will not use these methods explicitly they are used internally by JTable. @param e the event received @see CellEditorListener

Class JTable, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJTable. For tables the AccessibleContext takes the form of an AccessibleJTable. A new AccessibleJTable instance is created if necessary. @return an AccessibleJTable that serves as the AccessibleContext of this JComponentJTable
Class JTable, boolean getAutoCreateColumnsFromModel()

ReturnsDetermines whether the table will create default columns from the model. If this is true setModel() will clear any existing columns and create new columns from the new model. Also if the event in the the tableChanged() notification specifiedspecifies that the entiredentire table changed then the columns will be rebuilt. The default is true. @return the autoCreateColumnsFromModel of the table @see #setAutoCreateColumnsFromModel @see #createDefaultColumnsFromModel
Class JTable, int getAutoResizeMode()

Returns the auto resize mode of the table. The default mode is AUTO_RESIZE_SUBSEQUENT_COLUMNS. @return the autoResizeMode of the table @see #setAutoResizeMode @see #sizeColumnsToFit(int)
Class JTable, TableCellEditor getCellEditor()

ReturnReturns the cellEditorcell editor. @return the TableCellEditor that does the editing @see #cellEditor
Class JTable, TableCellEditor getCellEditor(int, int)

ReturnReturns an appropriate editor for the cell specified by this this row and column. If the TableColumn for this column has a non-null editor returnreturns that. If not findfinds the class of the data in this column (using getColumnClass()) and returnreturns the default editor for this type of data.

Note: Throughout the table package the internal implementations always use this method to provide editors so that this default behavior can be safely overridden by a subclass. @param row the row of the cell to edit where 0 is the first row @param column the column of the cell to edit where 0 is the first column @return the editor for this cell; if null return the default editor for this type of cell @see DefaultCellEditor

Class JTable, Rectangle getCellRect(int, int, boolean)

Returns a rectangle locatingfor the cell that lies at the intersection of row and column. If includeSpacing is true then the value returned includeshas the full height and width of the intercellSpacingrow and column marginspecified. If it is false then the returned rectrectangle is inset by halfthe ofintercell intercellSpacing.spacing (Thisto isreturn the true framebounds of the cell)rendering @paramor rowediting component as it will be set during rendering.

If the column index is valid but the row to computeindex is @paramless columnthan zero the column to computemethod returns a @paramrectangle includeSpacing ifwith the truethe y and height values set appropriately and the rectx returnedand willwidth values includeboth set to zero. In general when either the correct intercellSpacingrow or @returncolumn indices indicate a cell outside the appropriate range the method returns a rectangle containingdepicting the closest edge of the closest cell at indexthat is rowwithin columnthe @exceptiontable's IllegalArgumentExceptionrange. IfWhen both row orand column indices are out of range the returned rectangle covers the closest point of the closest cell.

In all cases calulations that use this method to calculate results along one axix will not fail because of anomalies in calculations along other axis. When the cell is not valid rangethe includeSpacing parameter is ignored. @param includeSpacing if false return the true cell bounds - computed by subtracting the intercell spacing from the height and widths of the column and row models. @return the rectangle containing the cell at location row column

Class JTable, TableCellRenderer getCellRenderer(int, int)

ReturnReturns an appropriate renderer for the cell specified by this this row and column. If the TableColumn for this column has a non-null renderer returnreturns that. If not findfinds the class of the data in this column (using getColumnClass()) and returnreturns the default renderer for this type of data.

Note: Throughout the table package the internal implementations always use this method to provide renderers so that this default behavior can be safely overridden by a subclass. @param row the row of the cell to render where 0 is the first row @param column the column of the cell to render where 0 is the first column @return the assigned renderer; if null returns the default renderer for this type of object @see javax.swing.table.DefaultTableCellRenderer @see javax.swing.table.TableColumn#setCellRenderer @see #setDefaultRenderer

Class JTable, boolean getCellSelectionEnabled()

Returns true if simultaneousboth row and column selectionsselection models are allowedenabled. Equivalent to getRowSelectionAllowed() && getColumnSelectionAllowed(). @return true if simultaneousboth row and column selectionsselection models are allowedenabled @see #setCellSelectionEnabled
Class JTable, TableColumn getColumn(Object)

Returns the TableColumn object for the column in the table whose identifier is equal to identifier when compared using equals(). @return the TableColumn object with matchingthat matches the identifier @exception IllegalArgumentException if identifier is null or no TableColumn has this identifier @param identifier the identifier object
Class JTable, Class getColumnClass(int)

Returns the type of the column at the specifiedappearing in the view at column position column. @param column the column in the view being queried @return the type of the column at position column in the view where the first column is column 0.
Class JTable, int getColumnCount()

Returns the number of columns in the column model. Note notethat this may be different tofrom the number of columns in the table model. @return the number of columns in the table @see #getRowCount @see #removeColumn
Class JTable, TableColumnModel getColumnModel()

Returns the TableColumnModel that contains all column inforamtioninformation of this table. @return the object that provides the column state of the table @see #setColumnModel
Class JTable, String getColumnName(int)

Returns the name of the column at the specifiedappearing in the view at column position column. @param column the column in the view being queried @return the name of the column at position column in the view where the first column is column 0.
Class JTable, boolean getColumnSelectionAllowed()

Returns true if columns can be selected. @return true if columns can be selected. otherwise false @see #setColumnSelectionAllowed
Class JTable, TableCellEditor getDefaultEditor(Class)

Returns the editor to be used when no editor has been set in a TableColumn. During the editing of cells the editor is fetched from a Hashtable of entries according to the class of the cells in the column. If there is no entry for this columnClass the method returns the entry for the most specific superclass. The JTable installs entries for Object Number and Boolean all of which can be modified or replaced. @param columnClass return the default cell editor for this columnClass @return the default cell editor to be used for this columnClass @see #setDefaultEditor @see #getColumnClass
Class JTable, TableCellRenderer getDefaultRenderer(Class)

Returns the cell renderer to be used when no renderer has been set in a TableColumn. During the rendering of cells the renderer is fetched from a Hashtable of entries according to the class of the cells in the column. If there is no entry for this columnClass the method returns the entry for the most specific superclass. The JTable installs entries for Object Number and Boolean all of which can be modified or replaced. @param columnClass return the default cell renderer for this columnClass @return the renderer for this columnClass @see #setDefaultRenderer @see #getColumnClass
Class JTable, int getEditingColumn()

ThisReturns returns the index of the editing column that contains the cell currently being edited. If nothing is being edited returns -1. @return the index of the column that contains the cell currently being edited; returns -1 if nothing being edited @see #editingRow
Class JTable, int getEditingRow()

Returns the index of the editing row that contains the cell currently being edited. If nothing is being edited returns -1. @return the index of the row that contains the cell currently being edited; returns -1 if nothing being edited @see #editingColumn
Class JTable, Component getEditorComponent()

IfReturns the receiver iscomponent currently editing this will returnthat is handling the editing thesession. Component that was returned from the CellEditorIf nothing is being edited returns null. @return Component handling editing session
Class JTable, Color getGridColor()

Returns the color used to draw grid lines. The default color is Color.gray. @return the color used to draw grid lines @see #setGridColor
Class JTable, Dimension getIntercellSpacing()

Returns the horizontal and vertical spacingspace between cells. The default spacing is (31 21) which provides room to draw the grid. @return the horizontal and vertical spacing between cells @see #setIntercellSpacing
Class JTable, TableModel getModel()

Returns the TableModel that provides the data displayed by thethis receiverJTable. @return the objectTableModel that provides the data displayed by thethis receiverJTable @see #setModel
Class JTable, Dimension getPreferredScrollableViewportSize()

Returns the preferred size of the viewport for this table. @return a Dimension object containing the preferredSize of the JViewport which displays this table @see Scrollable#getPreferredScrollableViewportSize
Class JTable, int getRowCount()

Returns the number of rows in thethis table's model. @return the number of rows in this table's model @see #getColumnCount
Class JTable, int getRowHeight()

Returns the height of a table row in the receiverpixels. The default row height is 16.0. @return the height of each row in the receiverin pixels of a table row @see #setRowHeight
Class JTable, int getRowMargin()

Gets the amount of emtpyempty space in pixels between rowscells. Equivalent to: getIntercellSpacing().height. @return the number of pixels between cells in a row @see #setRowMargin
Class JTable, boolean getRowSelectionAllowed()

Returns true if rows can be selected. @return true if rows can be selected otherwise false @see #setRowSelectionAllowed
Class JTable, int getScrollableBlockIncrement(Rectangle, int, int)

Returns The visibleRect.height or visibleRect.width depending on thethis table's orientation. Note that as of Swing 1.1.1 (Java 2 v 1.2.2) the value returned will ensure that the viewport is cleanly aligned on a row boundary. @return The visibleRect.height or visibleRect.width per the orientation. @see Scrollable#getScrollableBlockIncrement
Class JTable, int getScrollableUnitIncrement(Rectangle, int, int)

Returns the scroll increment (in pixels) that completely exposes one new row or column (depending on the orientation).

This method is called each time the user requests a unit scroll. @param visibleRect Thethe view area visible within the viewport @param orientation Eithereither SwingConstants.VERTICAL or SwingConstants.HORIZONTAL. @param direction Lessless than zero to scroll up/left greater than zero for down/right. @return Thethe "unit" increment for scrolling in the specified direction @see Scrollable#getScrollableUnitIncrement

Class JTable, int getSelectedColumn()

Returns the index of the first selected column -1 if no column is selected. @return the index of the first selected column
Class JTable, int[] getSelectedColumns()

Returns the indices of all selected columns. @return an array of intsintegers containing the indices of all selected columns or an empty array if no column is selected. @see #getSelectedColumn
Class JTable, int getSelectedRow()

Returns the index of the first selected row -1 if no row is selected. @return the index of the first selected row
Class JTable, int getSelectedRowCount()

Returns the number of selected rows. @return the number of selected rows 0 if no columnsrows are selected
Class JTable, int[] getSelectedRows()

Returns the indices of all selected rows. @return an array of intsintegers containing the indices of all selected rows or an empty array if no row is selected. @see #getSelectedRow
Class JTable, Color getSelectionBackground()

Returns the background color for selected cells. @return the Color used for the background of selected list items @see #setSelectionBackground @see #setSelectionForeground
Class JTable, Color getSelectionForeground()

Returns the foreground color for selected cells. @return the Color object for the foreground property @see #setSelectionForeground @see #setSelectionBackground
Class JTable, ListSelectionModel getSelectionModel()

Returns the ListSelectionModel that is used to maintain row selection state. @return the object that provides row selection state. Or null if row selection is not allowed. @see #setSelectionModel
Class JTable, boolean getShowHorizontalLines()

Returns true if the receivertable draws horizontal lines between cells false if it doesn't. The default is true. @return true if the receivertable draws horizontal lines between cells false if it doesn't @see #setShowHorizontalLines
Class JTable, boolean getShowVerticalLines()

Returns true if the receivertable draws vertical lines between cells false if it doesn't. The default is true. @return true if the receivertable draws vertical lines between cells false if it doesn't @see #setShowVerticalLines
Class JTable, JTableHeader getTableHeader()

Returns the tableHeader working withused by this JTable. @return the tableHeader working with the receiverused by this table @see #setTableHeader
Class JTable, String getToolTipText(MouseEvent)

Overrides JComponent's setToolTipTextgetToolTipText method to allow use ofin order to allow the renderer's tips (ifto thebe rendererused if it has text set).

NOTENote: For JTable to properly display tooltips of its renderers JTable must be a registered component with the ToolTipManager. This is done automatically in initializeLocalVars() but if at a later point JTable is told setToolTipText(null) it will unregister the table component and no tips from renderers will display anymore. @see JComponent#getToolTipText

Class JTable, TableUI getUI()

Returns the L&F object that renders this component. @return the TableUI object that renders this component
Class JTable, String getUIClassID()

Returns the suffix used to construct the name of the L&F class thatused to rendersrender this component. @return the string "TableUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JTable, Object getValueAt(int, int)

Returns the cell value at row and column.

NOTENote: The column is specified in the table view's display order and not in the TableModel's column order. This is an important distinction because as the user rearranges the columns in the table what isthe column at columna given index in the view 2 changeswill change. Meanwhile the user's actions never affect the model's column ordering. @param row the row whose value is to be looked upqueried @param column the column whose value is to be looked upqueried @return the Object at the specified cell

Class JTable, boolean isCellEditable(int, int)

Returns true if the cell at row and column is editable. Otherwise invoking setValueAt() on the cell will have no effect.

Note: The column is specified in the table view's display order and not in the TableModel's column order. This is an important distinction because as the user rearranges the columns in the table the column at a given index in the view will change. Meanwhile the valueuser's of thatactions never cellaffect the model's column ordering. @param row the row whose value is to be looked upqueried @param column the column whose value is to be lookedqueried up @return true if the cell is editable. @see #setValueAt

Class JTable, boolean isCellSelected(int, int)

Returns true if the cell at the specified position is selected. @param row the row being queried @param column the column being queried @return true if the cell at index (row column) is selected where the first row and first column are at index 0 @exception IllegalArgumentException if row or column are not in the valid range
Class JTable, boolean isColumnSelected(int)

Returns true if the column at the specified index is selected. @param column the column in the column model @return true if the column at index column is selected where 0 is the first column @exception IllegalArgumentException if column is not in the valid range
Class JTable, boolean isEditing()

Returns true is the tableif a cell is editing abeing celledited. @return true isif the table is editing a cell @see #editingColumn @see #editingRow
Class JTable, boolean isFocusTraversable()

Identifies whetherWe override or not this component can receive themethod whose implementation in focus.JComponent A disabled button forreturns false to return exampletrue. would returnThis indicates false.that @returnthe trueJTable if thisis a component canthat receiveshould thebe part of a (tabbing) focus cycle by default. @return true
Class JTable, boolean isManagingFocus()

We override this method whose implementation in JComponent returns false to return true. This allows us to give a special meaning to TAB and SHIFT-TAB in the JTable. @return true
Class JTable, boolean isRowSelected(int)

Returns true if the row at the specified index is selected. @return true if the row at index row is selected where 0 is the first row @exception IllegalArgumentException if row is not in the valid range
Class JTable, void moveColumn(int, int)

Moves the column column to the position currently occupied by the column targetColumn in the view. The old column at targetColumn is shifted left or right to make room. @param column the index of column to be moved @param targetColumn the new index of the column
Class JTable, String paramString()

Returns a string representation of this JTabletable. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JTable.table
Class JTable, Component prepareEditor(TableCellEditor, int, int)

Prepares the specified editor usingby querying the data model for the value and selection state of the cell at row column.

Note: Throughout the specifiedtable cellpackage the internal implementations always use this method to prepare editors so that this default behavior can be safely overridden by a subclass. @param editor the TableCellEditor to set up @param row the row of the cell to edit where 0 is the first row @param column the column of the cell to edit where 0 is the first column @return the Component being edited

Class JTable, Component prepareRenderer(TableCellRenderer, int, int)

Prepares the specified renderer withby querying an appropriate value fromthe data model for the dataModelvalue and an appropriate selectionselection state of valuethe cell at fromrow column.

Note: Throughout the selectiontable package the internal modelsimplementations always use this method to prepare renderers so that this default behavior can be safely overridden by a subclass. @param renderer the TableCellRenderer to prepare @param row the row of the cell to render where 0 is the first row @param column the column of the cell to render where 0 is the first column

Class JTable, void removeColumn(TableColumn)

Removes aColumn from thethis JTable's array of columns. Note: this method does not remove the column of data from the model; it just removes the TableColumn that was responsible for displaying it. @param aColumn The the TableColumn to be removed @see #addColumn
Class JTable, void removeColumnSelectionInterval(int, int)

Deselects the columns from index0 to index0index1 inclusive. @exception IllegalArgumentException if index0 or index1 lie outside [0 getColumnCount()-1] @param index0 one end of the interval. @param index1 the other end of the interval
Class JTable, void removeEditor()

DiscardDiscards the editor object and returnfrees the real estate it used tofor cell rendering.
Class JTable, void removeNotify()

NotificationCalls to this component that it no longer has a parent component. When this method is invoked any KeyboardActions set up in the the chain of parentunconfigureEnclosingScrollPane components are removedmethod. @see #registerKeyboardActionunconfigureEnclosingScrollPane
Class JTable, void removeRowSelectionInterval(int, int)

Deselects the rows from index0 to index0index1 inclusive. @exception IllegalArgumentException if index0 or index1 lie outside [0 getRowCount()-1] @param index0 one end of the interval. @param index1 the other end of the interval
Class JTable, void reshape(int, int, int, int)

CallsMoves super.reshape() and is overridden simply to detect changes in our bounds. After reshaping we resize theresizes columnsthis (similar to triggering a layout) to fit the new bounds for the component using sizeColumnsToFit(). @see java.awt.Component#sizeColumnsToFit(int)setBounds
Class JTable, void resizeAndRepaint()

Equivalent to revalidate() followed by repaint().
Class JTable, int rowAtPoint(Point)

Returns the index of the row that point lies in or -1 if the result is not in the range [0 getRowCount()-1]. @param point the location of interest @return the index of the row that point lies in or -1 if itthe result is not in the range [0 getRowCount()-1] @see #columnAtPoint
Class JTable, void selectAll()

SelectSelects all rows columns and cells in the table.
Class JTable, void setAutoCreateColumnsFromModel(boolean)

Sets thethis table's autoCreateColumnsFromModel flag. This method will callcalls createDefaultColumnsFromModel() if createColumnsautoCreateColumnsFromModel changes isfrom false to true. @param createColumnsautoCreateColumnsFromModel true if JTable should autoautomatically create columns @see #getAutoCreateColumnsFromModel @see #createDefaultColumnsFromModel @beaninfo bound: true description: Automatically populatepopulates the columnModel when a new TableModel is submitted.
Class JTable, void setAutoResizeMode(int)

Sets the table's auto resize mode when the table is resized. @param mode One of 5 legal values: AUTO_RESIZE_OFF AUTO_RESIZE_NEXT_COLUMN AUTO_RESIZE_SUBSEQUENT_COLUMNS AUTO_RESIZE_LAST_COLUMN AUTO_RESIZE_ALL_COLUMNS @see #getAutoResizeMode @see #sizeColumnsToFit(int) @beaninfo bound: true description: Whether the columns should adjust themselves automatically. enum: AUTO_RESIZE_OFF JTable.AUTO_RESIZE_OFF AUTO_RESIZE_NEXT_COLUMN JTable.AUTO_RESIZE_NEXT_COLUMN AUTO_RESIZE_SUBSEQUENT_COLUMNS JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS AUTO_RESIZE_LAST_COLUMN JTable.AUTO_RESIZE_LAST_COLUMN AUTO_RESIZE_ALL_COLUMNS JTable.AUTO_RESIZE_ALL_COLUMNS
Class JTable, void setCellEditor(TableCellEditor)

SetSets the cellEditor variable. @param anEditor the TableCellEditor that does the editing @see #cellEditor @beaninfo bound: true description: The table's active cell editor if one exists.
Class JTable, void setCellSelectionEnabled(boolean)

Sets whether this table allows both a column selection and a row selection to exist at the same timesimultaneously. When set this results in a facility to select a rectangular region of cells inthe table treats the intersection of the row and column selection models as the displayselected cells. Override isCellSelected to change this default behavior. This flagmethod is equivalent to setting over-ridesboth the rowrowSelectionAllowed property and columncolumnSelectionAllowed selectionproperty of modesthe ensuringcolumnModel that cell selectionto the supplied isvalue. @param possible whenever this flagcellSelectionEnabled true if simultaneous row and column selection is set.allowed @see #getCellSelectionEnabled @see #isCellSelected @beaninfo bound: true description: Select a rectangular region of cells rather than rows or columns.
Class JTable, void setColumnModel(TableColumnModel)

Sets the column model for this table to newModel and registers with for listnerlistener notifications from the new column model. Also sets the column model of the JTableHeader to newModelcolumnModel. @param newModelcolumnModel the new data source for this table @exception IllegalArgumentException if newModelcolumnModel is null @see #getColumnModel @beaninfo bound: true description: The object governing the way columns appear in the view.
Class JTable, void setColumnSelectionAllowed(boolean)

Sets whether the columns in this model can be selected. @param columnSelectionAllowed true if this model will allow column selection @see #getColumnSelectionAllowed @beaninfo bound: true description: If true an entire column is selected for each selected cell.
Class JTable, void setColumnSelectionInterval(int, int)

Selects the columns from index0 to index1 inclusive. @exception IllegalArgumentException if index0 or index1 lie outside [0 getColumnCount()-1] @param index0 one end of the interval. @param index1 the other end of the interval
Class JTable, void setDefaultEditor(Class, TableCellEditor)

SetSets a default cell editor to be used if no editor has been set in a TableColumn. If no editing is required in a table or a particular column in a table useuses the isCellEditable() method in the TableModel interface to ensure that thethis JTable will not start an editor in these columns. If editor is null removeremoves the default editor for this column class. @param columnClass set the default cell editor for this columnClass @param editor default cell editor to be used for this columnClass @see TableModel#isCellEditable @see #getDefaultEditor @see #setDefaultRenderer
Class JTable, void setDefaultRenderer(Class, TableCellRenderer)

SetSets a default cell renderer to be used if no renderer has been set in a TableColumn. If renderer is null removeremoves the default renderer for this column class. @param columnClass set the default cell renderer for this columnClass @param renderer default cell renderer to be used for this columnClass @see #getDefaultRenderer @see #setDefaultEditor
Class JTable, void setEditingColumn(int)

SetSets the editingColumn variable. @param aColumn the column of the cell to be edited @see #editingColumn
Class JTable, void setEditingRow(int)

SetSets the editingRow variable. @param aRow the row of the cell to be edited @see #editingRow
Class JTable, void setGridColor(Color)

Sets the color used to draw grid lines to colorgridColor and redisplays the receiver. The default color is Color.gray. @param colorgridColor the new color of the grid lines @exception IllegalArgumentException if colorgridColor is null @see #getGridColor @beaninfo bound: true description: The grid color.
Class JTable, void setIntercellSpacing(Dimension)

Sets the widthrowMargin and heightthe betweencolumnMargin cells-- tothe newSpacingheight and redisplayswidth of the receiverspace between cells -- to intercellSpacing. @param newSpacingintercellSpacing a TheDimension specifying the new width and height intercellSpacingbetween cells @see #getIntercellSpacing @beaninfo description: The spacing between the cells drawn in the background color of the JTable.
Class JTable, void setModel(TableModel)

Sets the data model for this table to newModel and registers with it for listnerlistener notifications from the new data model. @param newModel the new data source for this table @exception IllegalArgumentException if newModel is null @see #getModel @beaninfo bound: true description: The model that is the source of the data for this view.
Class JTable, void setPreferredScrollableViewportSize(Dimension)

Sets the preferred size of the viewport for this table. @param size a Dimension object specifying the preferredSize of a JViewport whose view is this table @see Scrollable#getPreferredScrollableViewportSize @beaninfo description: The preferred size of the viewport.
Class JTable, void setRowHeight(int)

Sets the height for rowsin pixels of all cells to newRowHeightrowHeight revalidates and invokesrepaints. The height of the cells in this row will be equal tileto the row height minus the row margin. @param newRowHeightrowHeight new row height @exception IllegalArgumentException Ifif newRowHeightrowHeight is less than 1. @see #getRowHeight @beaninfo bound: true description: The height of the cells including the inter-cellspecified spacingrow.
Class JTable, void setRowMargin(int)

Sets the amount of emtpyempty space between cells in adjacent rows. @param rowMargin the number of pixels between cells in a row @see #getRowMargin @beaninfo bound: true description: The amount of space between cells.
Class JTable, void setRowSelectionAllowed(boolean)

Sets whether the rows in this model can be selected. @param rowSelectionAllowed true if this model will allow row selection @see #getRowSelectionAllowed @beaninfo bound: true description: If true an entire row is selected for each selected cell.
Class JTable, void setRowSelectionInterval(int, int)

Selects the rows from index0 to index1 inclusive. @exception IllegalArgumentException if index0 or index1 lie outside [0 getRowCount()-1] @param index0 one end of the interval. @param index1 the other end of the interval
Class JTable, void setSelectionBackground(Color)

SetSets the background color for selected cells. Cell renderers can use this color to the fill selected cells.

The default value of this property is defined by the look and feel implementation.

This is a JavaBeans bound property. @param selectionBackground the Color to use for the background of selected cells @see #getSelectionBackground @see #setSelectionForeground @see #setForeground @see #setBackground @see #setFont @beaninfo bound: true description: A default background color for selected cells.

Class JTable, void setSelectionForeground(Color)

SetSets the foreground color for selected cells. Cell renderers can use this color to render text and graphics for selected cells.

The default value of this property is defined by the look and feel implementation.

This is a JavaBeans bound property. @param selectionForeground the Color to use in the foreground for selected list items @see #getSelectionForeground @see #setSelectionBackground @see #setForeground @see #setBackground @see #setFont @beaninfo bound: true description: A default foreground color for selected cells.

Class JTable, void setSelectionMode(int)

Sets the table's selection mode to allow only single selections a single contiguous interval or multiple intervals. NOTE

Note: JTable provides all the methods for handling column and row selection. When setting states such as setSelectionMode it not only updates the mode for the row selection model but also sets similar values in the selection model of the columnModel. If you want to have the row and column selection models operating in different modes set them both directly.

Both the row and column selection models for the JTable default to using a DefaultListSelectionModel so that JTable works the same way as the JList. See the setSelectionMode() method in JList for details about the modes. @see JList#setSelectionMode @beaninfo description: The selection mode used by the row and column selection models. enum: SINGLE_SELECTION ListSelectionModel.SINGLE_SELECTION SINGLE_INTERVAL_SELECTION ListSelectionModel.SINGLE_INTERVAL_SELECTION MULTIPLE_INTERVAL_SELECTION ListSelectionModel.MULTIPLE_INTERVAL_SELECTION

Class JTable, void setSelectionModel(ListSelectionModel)

Sets the row selection model for this table to newModel and registers with for listnerlistener notifications from the new selection model. @param newModel the new selection model @exception IllegalArgumentException if newModel is null @see #getSelectionModel @beaninfo bound: true description: The selection model for rows.
Class JTable, void setShowGrid(boolean)

Sets whether the receivertable draws grid lines around cells. If flagshowGrid is true it does; if it is false it doesn't. There is no getShowGrid() method as the this state is held in two variables: -- showHorizontalLines and showVerticalLines -- each of which maycan be queried independently. @param flagshowGrid true if table view should draw grid lines @see #setShowVerticalLines @see #setShowHorizontalLines @beaninfo description: The color used to draw the grid lines.
Class JTable, void setShowHorizontalLines(boolean)

Sets whether the receivertable draws horizontal lines between cells. If flagshowHorizontalLines is true it does; if it is false it doesn't. @param flagshowHorizontalLines true if table view should draw horizontal lines @see #getShowHorizontalLines @see #setShowGrid @see #setShowVerticalLines @beaninfo bound: true description: Whether horizontal lines should be drawn in between the cells.
Class JTable, void setShowVerticalLines(boolean)

Sets whether the receivertable draws vertical lines between cells. If flagshowVerticalLines is true it does; if it is false it doesn't. @param flagshowVerticalLines true if table view should draw vertical lines @see #getShowVerticalLines @see #setShowGrid @see #setShowHorizontalLines @beaninfo bound: true description: Whether vertical lines should be drawn in between the cells.
Class JTable, void setTableHeader(JTableHeader)

Sets the tableHeader working with this JTable to newHeader. It is legal to have a null tableHeader. @param newHeader new tableHeader @see #getTableHeader @beaninfo bound: true description: The JTableHeader instance which renders the column headers.
Class JTable, void setUI(TableUI)

Sets the L&F object that renders this component and repaints. @param ui the TableUI L&F object @see UIDefaults#getUI
Class JTable, void setValueAt(Object, int, int)

Sets the value for the cell in the table model at row and column.

Note: The column is specified in the table view's display order and not in the TableModel's column order. This is an important distinction because as the user rearranges the columns in the table the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column ordering. aValue is the new value. @param aValue the new value @param row the row whose value isof the cell to be changed @param column the column whoseof value isthe cell to be changed @see #getValueAt

Class JTable, void sizeColumnsToFit(int)

This method will resizeResizes one or more otof the columns in the table so that the total width of all of thethis JTable's columns will beis equal to the width of the table.

When setBounds()doLayout is called on thethis JTable often as a result of the resizing of an enclosing window - this method is called with resizingColumn set to -1. This means that resizing has taken place '"outside'" the JTable and the change - or '"delta'" - should be distributed to all of the columns regardless of thethis JTable's autoResizeModeautomatic resize mode.

If the resizingColumn is not -1 it is one of the columns in the table that has changed size rather than the table itself. In this case the auto-resize modes govern the way the extra (or defecitdeficit) space is distributed amongst the availibleavailable columns.

The modes are:

  • AUTO_RESIZE_OFF: Don't automatically adjust the column's widths at all. Use a horizontal scrollbar to accomodate the columns when their sum exceeds the width of the Viewport. If the JTable is not enclosed in a JScrollPane this may leave parts of the table invisible.
  • AUTO_RESIZE_NEXT_COLUMN: Use just the column after the resizing column. This results in the 'boundry'"boundary" or divider between adjacent cells being independently adjustable.
  • AUTO_RESIZE_SUBSEQUENT_COLUMNS: Use all columns after the one being adjusted to absorb the changes. This is the default behavior.
  • AUTO_RESIZE_LAST_COLUMN Only ever: automaticallyAutomatically adjust the size of the last column only. If the bounds of the last column prevent the desired size from being allocated set the width of the last column to the appropriate limit and make no further adjustments.
  • AUTO_RESIZE_ALL_COLUMNS: Spread the delta amongst all the columns in the JTable including the one that is being adjusted.

Note: When thea JTable makes adjustments to the widths of the columns it respects their minimum and maximum values absolutely. It is therefore possible that even after this method is called the total width of the columns is still not equal to the width of the table. When this happens the JTable does not put itself in AUTO_RESIZE_OFF mode to bring up a ScrollBarscroll bar or break other commitments of its current auto-resize mode -- instead it allows its bounds to be set larger (or smaller) than the total of the column minimaminimum or maximamaximum meaning either that there will not be enough room to display all of the columns or that the columns will not fill the JTable's bounds. These respectively result in the clipping of some columns or an area being painted in the JTable's background color during painting.

The mechanism for distributing the delta amongst the availibleavailable columns is provided in a private method in the JTable class:

 adjustSizes(long targetSize final Resizable3 r boolean inverse) 
an explanation of which is provided belowin the following section. Resizable3 is a private interface that allows any data structure containing a collection of elements with a size preferredSizepreferred size maximum maximumSizesize and minimumSizeminimum size to have its elements manipulated by the algorithm.

Distributing the delta

Overview

Call '"DELTA'" the difference between the targetSizetarget size and the sum of the preferred sizes of the elements in r. The individual sizes are calculated by taking the original preferred sizes and adding a share of the DELTA - that share being based on how far each preferred size is from its limiting bound (minimum or maximum).

Definition

Call the individual constraints min[i] max[i] and pref[i].#

Call their respective sums: MIN MAX and PREF.#

Each new size will be calculated using:

 size[i] = pref[i] + delta[i] 
where each individual delta[i] is calculated according to:

If (DELTA <0) we are in shrink mode where:#

 ######################### DELTA ####### delta[i] =#### ------------ * (pref[i] - min[i]) ###################### (PREF - MIN) 
If (DELTA > 0) we are in expand mode where:#

 ######################### DELTA ####### delta[i] =#### ------------ * (max[i] - pref[i]) ###################### (MAX - PREF) 

The overall effect is that the total size moves that same percentage k towards the total minimum or maximum and that percentage guarenteesguarantees accomodation of the required space DELTA.

Details

Naive evaluation of the formulae presented here would be subject to the aggregated rounding errors caused by doing this operation in finite precision (using ints). To deal with this the muliplyingmultiplying factor above is constantly recalculated and this takes account of the rounding errors in the previous iterations. The result is an algorithm whichthat produces a set of integers whose values exactly sum to the supplied targetSize and does so by spreading the rounding errors evenly over the given elements.

When the MAX and MIN bounds are hit

When targetSize is outside the [MIN MAX] range the algorithm sets all sizes to either their appropriate limiting value (maximum or minimum). @param resizingColumn Thethe column whose resizing made this adjustment necessary or -1 if there is no such column. @see TableColumn#setWidth

Class JTable, void tableChanged(TableModelEvent)

Invoked when this table's TableModel generates a TableModelEvent. The TableModelEvent should be constructed in the co-ordinatecoordinate system of the model; the appropriate mapping to the view co-ordinatecoordinate system is performed by thethis JTable when it recievesreceives the event.

Application code will not use these methods explicitly they are used internally by JTable.

Class JTable, void updateUI()

Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager. @see JComponent#updateUI
Class JTable, void valueChanged(ListSelectionEvent)

Invoked when the row selection changes -- repaints to show the new selection.

Application code will not use these methods explicitly they are used internally by JTable. @param e the event received @see ListSelectionListener

Class JTable, int AUTO_RESIZE_ALL_COLUMNS

During all resize operations proportionately resize all columns.
Class JTable, int AUTO_RESIZE_LAST_COLUMN

During all resize operations apply adjustments to the last column only.
Class JTable, int AUTO_RESIZE_NEXT_COLUMN

When a column is adjusted in the UI adjust the next column the opposite way.
Class JTable, int AUTO_RESIZE_OFF

Do not adjust column widths automatically; use a scrollbar.
Class JTable, int AUTO_RESIZE_SUBSEQUENT_COLUMNS

During UI adjustment change subsequent columns to preserve the total width; this is the default behavior.
Class JTable, boolean autoCreateColumnsFromModel

The table will query the TableModel to build the default set of columns if this is true.
Class JTable, int autoResizeMode

ThisDetermines mode value determines if the table automatically resizes the width of the table's columns to take up the entire width of the table and how it does the resizing.
Class JTable, TableCellEditor cellEditor

The object that overwrites the screen real estate occupied by the current cell and allows the user to change thoseits contents.
Class JTable, boolean cellSelectionEnabled

If this is true then bothObsolete as of Java 2 platform a row selection and a column selection can bev1.3. non-emptyPlease atuse the samerowSelectionAllowed time the selectedproperty and the cellscolumnSelectionAllowed are theproperty of the cellscolumnModel whose rowinstead. and column are bothOr use the method selectedgetCellSelectionEnabled.
Class JTable, TableColumnModel columnModel

The TableColumnModel of the table.
Class JTable, TableModel dataModel

The TableModel of the table.
Class JTable, Hashtable defaultEditorsByColumnClass

A table of objects that display and edit the contents of a cell indexed by class as declared in getColumnClass in the TableModel interface.
Class JTable, Hashtable defaultRenderersByColumnClass

A table of objects that display the contents of a cell indexed by class as declared in getColumnClass in the TableModel interface.
Class JTable, Component editorComp

If editing the Component that is handling the editing.
Class JTable, Color gridColor

The color of the grid.
Class JTable, Dimension preferredViewportSize

Used by the Scrollable interface to determine the initial visible area.
Class JTable, int rowHeight

The height in pixels of all rowseach row in the table.
Class JTable, int rowMargin

The height in pixels of the margin between rowsthe cells in each row.
Class JTable, boolean rowSelectionAllowed

RowTrue if row selection is allowed in this table.
Class JTable, Color selectionBackground

The background color of selected cells.
Class JTable, Color selectionForeground

The foreground color of selected cells.
Class JTable, ListSelectionModel selectionModel

The ListSelectionModel of the table used to keep track of row selections.
Class JTable, boolean showHorizontalLines

The table draws horizontal lines between cells if showHorizontalLines is true.
Class JTable, boolean showVerticalLines

The table draws vertical lines between cells if showVerticalLines is true.
Class JTable, JTableHeader tableHeader

The TableHeader working with the table.

Class JTextArea

A TextArea is a multi-line area that displays plain text. It is intended to be a lightweight component that provides source compatibility with the java.awt.TextArea class where it can reasonably do so. You can find information and examples of using all the text components in Using Text Components a section in The Java Tutorial.

This component has capabilities not found in the java.awt.TextArea class. The superclass should be consulted for additional capabilities. Alternative multi-line text classes with more capabilitites are JTextPane and JEditorPane.

The java.awt.TextArea internally handles scrolling. JTextArea is different in that it doesn't manage scrolling but implements the swing Scrollable interface. This allows it to be placed inside a JScrollPane if scrolling behavior is desired and used directly if scrolling is not desired.

The java.awt.TextArea has the ability to do line wrapping. This was controlled by the horizontal scrolling policy. Since scrolling is not done by JTextArea directly backward compatibility must be provided another way. JTextArea has a bound property for line wrapping that controls whether or not it will wrap lines. By default the line wrapping property is set to false (not wrapped).

java.awt.TextArea has two properties rows and columns that are used to determine the preferred size. JTextArea uses these properties to indicate the preferred size of the viewport when placed inside a JScrollPane to match the functionality provided by java.awt.TextArea. JTextArea has a preferred size of what is needed to display all of the text so that it functions properly inside of a JScrollPane. If the value for the rows or columns is equal to zero the preferred size along that axis is used for the viewport preferred size along the same axis.

The java.awt.TextArea could be monitored for changes by adding a TextListener for TextEvent's. In the JTextComponent based components changes are broadcasted from the model via a DocumentEvent to DocumentListeners. The DocumentEvent gives the location of the change and the kind of change if desired. The code fragment might look something like:

 DocumentListener myListener = ; JTextArea myArea = ; myArea.getDocument().addDocumentListener(myListener); 

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JTextArea key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A multi-line area that displays plain text. @author Timothy Prinzing @version 1.58 1068 03/1314/9800 @see JTextPane @see JEditorPane


Class JTextArea.AccessibleJTextArea

TheThis class usedimplements toaccessibility support obtainfor the accessibleJTextArea class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to text area user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JTextArea, constructor JTextArea(Document, String, int, int)

Constructs a new JTextArea with the specified number of rows and columns and the given model. All of the constructors feed through this constructor. @param doc the model to use or create a default one if null @param text the text to be displayed null if none @param rows the number of rows >= 0 @param columns the number of columns >= 0 @exception IllegalArgumentException if the rows or columns arguments are negative.
Class JTextArea, constructor JTextArea(String, int, int)

Constructs a new TextArea with the specified text and number of rows and columns. A default model is created. @param text the text to be displayed or null @param rows the number of rows >= 0 @param columns the number of columns >= 0 @exception IllegalArgumentException if the rows or columns arguments are negative.
Class JTextArea, constructor JTextArea(int, int)

Constructs a new empty TextArea with the specified number of rows and columns. A default model is created and the initial string is null. @param rows the number of rows >= 0 @param columns the number of columns >= 0 @exception IllegalArgumentException if the rows or columns arguments are negative.
Class JTextArea, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JTextArea. CreatesFor aJTextAreas the AccessibleContext takes the form of an AccessibleJTextArea. A new contextAccessibleJTextArea instance is created if necessary. @return an AccessibleJTextArea that serves as the AccessibleContext of this JTextArea
Class JTextArea, boolean getWrapStyleWord()

Get the style of wrapping used if the text area is wrapping lines. If set to true the lines will be wrapped at word boundriesboundaries (ie whitespace) if they are too long to fit within the allocated width. If set to false the lines will be wrapped at character boundriesboundaries. @returns if the wrap style should be word boundriesboundaries instead of character boundriesboundaries. @see #setWrapStyleWord
Class JTextArea, void processComponentKeyEvent(KeyEvent)

Make sureProcesses any key events that TABthe component itself recognizes. This is called after the focus manager and Shift-TABany eventsinterested listeners have been given geta chance to steal away the event. This method is called only if the event has not yet been consumed. so that awtThis method is doesn'tcalled attemptprior focusto the keyboard UI logic.

This method is implemented to do nothing. Subclasses would normally override traversalthis method if they process some key events themselves. If the event is processed it should be consumed.

Class JTextArea, void processKeyEvent(KeyEvent)

Override processKeyEvent to processMake sure that TAB and Shift-TAB events get consumed so that awt doesn't attempt focus traversal.
Class JTextArea, void setLineWrap(boolean)

Sets the line-wrapping policy of the text area. If set to true the lines will be wrapped if they are too long to fit within the allocated width. If set to false the lines will always be unwrapped. A PropertyChange event ("lineWrap") is fired when the policy is changed. By default this property is false. @param wrap indicates if lines should be wrapped. @see #getLineWrap @beaninfo preferred: true bound: true description: should lines be wrapped
Class JTextArea, void setWrapStyleWord(boolean)

Set the style of wrapping used if the text area is wrapping lines. If set to true the lines will be wrapped at word boundriesboundaries (ie whitespace) if they are too long to fit within the allocated width. If set to false the lines will be wrapped at character boundriesboundaries. By default this property is false. @param word indicates if word boundriesboundaries should be used for line wrapping. @see #getWrapStyleWord @beaninfo preferred: false bound: true description: should wrapping occur at word boundriesboundaries

Class JTextField

JTextField is a lightweight component that allows the editing of a single line of text. ItFor information on and examples of using text fields see How to Use Text Fields in The Java Tutorial.

JTextField is intended to be source-compatible with java.awt.TextField where it is reasonable to do so. This component has capabilities not found in the java.awt.TextField class. The superclass should be consulted for additional capabilities.

JTextField has a method to establish the string used as the command string for the action event that gets fired. The java.awt.TextField used the text of the field as the command string for the ActionEvent. JTextField will use the command string set with the setActionCommand method if not null otherwise it will use the text of the field as a compatibility with java.awt.TextField.

The method setEchoChar and getEchoChar are not provided directly to avoid a new implementation of a pluggable look-and-feel inadvertantlyinadvertently exposing password characters. To provide password-like services a seperateseparate class JPasswordField extends JTextField to provide this service with an independantlyindependently pluggable look-and-feel.

The java.awt.TextField could be monitored for changes by adding a TextListener for TextEvent's. In the JTextComponent based components changes are broadcasted from the model via a DocumentEvent to DocumentListeners. The DocumentEvent gives the location of the change and the kind of change if desired. The code fragment might look something like:

   DocumentListener myListener = ;   JTextField myArea = ;   myArea.getDocument().addDocumentListener(myListener); 

The horizontal alignment of JTextField can be set to be left justified leading justified centered right justified or righttrailing justified. Right/trailing justification is useful if the required size of the field text is smaller than the size allocated to it. This is determined by the setHorizontalAlignment and getHorizontalAlignment methods. The default is to be leftleading justified.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JTextField key assignments.

ForHow compatibility withthe text java.awt.TextFieldfield theconsumes VK_ENTER key firesevents the ActionEvent todepends on whether the registeredtext ActionListeners.field However awthas any didn'taction havelisteners. default buttons likeIf so then swingVK_ENTER does.results If a text field has focusin the listeners getting an ActionEvent and the VK_ENTER keyevent is pressed itconsumed. will fire the fields ActionEvent rather than activate theThis is compatible with how AWT text fields handle defaultVK_ENTER buttonevents. To disableIf the compatibility withtext awt for text fields the following code fragment willfield has no action listeners then as of v remove1.3 the binding of VK_ENTER from the default keymap used by all JTextFields if thatevent is desirednot consumed. Instead static { JTextField f = newthe bindings of ancestor components are JTextField();processed KeyStroke enter =which enables the KeyStroke.getKeyStroke(KeyEvent.VK_ENTERdefault 0);button Keymap mapfeature of =JFC/Swing f.getKeymap();to mapwork.removeKeyStrokeBinding(enter); }

Customized fields can easily be created by extending the model and changing the default model provided. For example the following piece of code will create a field that holds only upper case characters. It will work even if text is pasted into from the clipboard or it is altered via programmatic changes.

  public class UpperCaseField extends JTextField {     public UpperCaseField(int cols) {   super(cols);   }     protected Document createDefaultModel() {   return new UpperCaseDocument();   }     static class UpperCaseDocument extends PlainDocument {     public void insertString(int offs String str AttributeSet a)   throws BadLocationException {     if (str == null) {   return;   }   char[] upper = str.toCharArray();   for (int i = 0; i   upper[i] = Character.toUpperCase(upper[i]);   }   super.insertString(offs new String(upper) a);   }   }  } 

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A component which allows for the editing of a single line of text. @author Timothy Prinzing @version 1.58 0971 03/0114/9800 @see #setActionCommand @see JPasswordField @see #addActionListener


Class JTextField.AccessibleJTextField

TheThis class usedimplements toaccessibility support obtainfor the accessibleJTextField class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to text field user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JTextField, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JTextField. CreatesFor aJTextFields the AccessibleContext takes the form of an AccessibleJTextField. A new contextAccessibleJTextField instance is created if necessary. @return an AccessibleJTextField that serves as the AccessibleContext of this JTextField
Class JTextField, int getHorizontalAlignment()

Returns the horizontal alignment of the text. Valid keys: JTextField.LEFT (the default) JTextField.CENTER JTextField.RIGHT JTextField.LEADING and JTextField.TRAILING @return the alignment
Class JTextField, boolean isValidateRoot()

Calls to revalidate that come from within the textfield itself will be handled by validating the textfield unless the receiver is contained within a JViewport in which case this returns false. @see JComponent#revalidate @see JComponent#isValidateRoot
Class JTextField, void setHorizontalAlignment(int)

Sets the horizontal alignment of the text. Valid keys: JTextField.LEFT JTextField.CENTER JTextField.RIGHT JTextField.LEADING (the default) JTextField.CENTERand JTextField.RIGHTTRAILING. invalidate() and repaint() are called when the alignment is set and a PropertyChange event ("horizontalAlignment") is fired. @param alignment the alignment @exception IllegalArgumentException if the alignment specified is not a valid key. @beaninfo preferred: true bound: true description: Set the field alignment to LEFT CENTER RIGHT LEADING (the default) CENTER RIGHTor TRAILING enum: LEFT JTextField.LEFT CENTER JTextField.CENTER RIGHT JTextField.RIGHT LEADING JTextField.LEADING TRAILING JTextField.TRAILING

Class JTextPane

A text component that can be marked up with attributes that are represented graphically. You can find how-to information and examples of using text panes in Using Text Components a section in The Java Tutorial.

This component models paragraphs that are composed of runs of character level attributes. Each paragraph may have a logical style attached to it which contains the default attributes to use if no overriden by attributes set on the paragraph or character run. Components and images may be embedded in the flow of text.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JTextPane key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer true description: A text component that can be marked up with attributes that are graphically represented. @author Timothy Prinzing @version 1.66 0972 02/0102/9800 @see javax.swing.text.StyledEditorKit

Class JTextPane, constructor JTextPane(StyledDocument)

Constructs a new JTextPane with a specified document model. A new instance of javax.swing.text.StyledEditorKit is created and set. @param doc the document model
Class JTextPane, EditorKit createDefaultEditorKit()

Creates the EditorKit to use by default. This is implemented to return javax.swing.text.StyledEditorKit. @return the editor kit
Class JTextPane, boolean getScrollableTracksViewportWidth()

Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport. @return true if a viewport should force the Scrollables width to match its own. false otherwise
Class JTextPane, void setEditorKit(EditorKit)

Sets the currently installed kit for handling content. This is the bound property that establishes the content type of the editor. @param kit the desired editor behavior. @exception IllegalArgumentException if kit is not a text.StyledEditorKit

Class JToggleButton

An implementation of a two-state button. The JRadioButton and JCheckBox classes are subclasses of this class. For information on using them see How to Use Buttons Check Boxes and Radio Buttons a section in The Java Tutorial.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JToggleButton key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: An implementation of a two-state button. @see JRadioButton @see JCheckBox @version 1.38 1049 03/0814/9800 @author Jeff Dinkins


Class JToggleButton.AccessibleJToggleButton

TheThis class usedimplements toaccessibility support obtainfor the accessibleJToggleButton class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to toggle button user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JToggleButton, constructor JToggleButton(String, Icon, boolean)

Creates a toggle button with the specified text image and selection state. @param text the text of the toggle button. @param icon the image that the button should display @param selected if true the button is initially selected; otherwise the button is initially unselected
Class JToggleButton, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJToggleButton. For toggle buttons the AccessibleContext takes the form of an AccessibleJToggleButton. A new AccessibleJToggleButton instance is created if necessary. @return an AccessibleJToggleButton that serves as the AccessibleContext of this JComponentJToggleButton @beaninfo expert: true description: The AccessibleContext associated with this ToggleButton.

Class JToolBar

JToolBar provides a component whichthat is useful for displaying commonly used ActionsActions or controls. ItFor examples and information on using tool bars see How to Use Tool Bars a section in The Java Tutorial.

A tool bar can be dragged out into a separate window by the user (unless the floatable property is set to false). In order for drag-out to work correctly it is recommended that you add JToolBar instances to one of the four 'sides' of a container whose layout manager is a BorderLayout and do not add children to any of the other four 'sides'.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JToolBar key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer true description: A component which displays commonly used controls or Actions. @version 1.70 0487 03/2214/9900 @author Georges Saab @author Jeff Shapiro @see Action


Class JToolBar.AccessibleJToolBar

TheThis class usedimplements toaccessibility support obtainfor the accessibleJToolBar class. It roleprovides foran implementation of the Java Accessibility API appropriate to tool bar thisuser-interface objectelements.

Class JToolBar.Separator, constructor JToolBar.Separator()

CreateCreates a new toolbar separator with the default size as defined by the current look and feel.
Class JToolBar.Separator, constructor JToolBar.Separator(Dimension)

CreateCreates a new toolbar separator with the specified size. @param size the new sizeDimension of the separator
Class JToolBar.Separator, Dimension getMaximumSize()

ReturnReturns the maximum size for the separator. @return the Dimension object containing the separator's maximum size
Class JToolBar.Separator, Dimension getMinimumSize()

ReturnReturns the minimum size for the separator. @return the Dimension object containing the separator's minimum size
Class JToolBar.Separator, Dimension getPreferredSize()

ReturnReturns the preferred size for the separator. @return the Dimension object containing the separator's preferred size
Class JToolBar.Separator, Dimension getSeparatorSize()

ReturnReturns the size of the separator @return the Dimension object containing the separator's size (This is a reference NOT a copy )
Class JToolBar.Separator, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "ToolBarSeparatorUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JToolBar.Separator, void setSeparatorSize(Dimension)

SetSets the size of the separator. @param size the new sizeDimension of the separator

Class JToolBar, constructor JToolBar()

CreateCreates a new toolbar.; Orientrationorientation defaults to horizontalHORIZONTAL.
Class JToolBar, constructor JToolBar(int)

CreateCreates a new toolbar. @paramwith the specified orientation. The initial orientation must be (either HORIZONTAL/ or VERTICAL). @param orientation the orientation desired
Class JToolBar, JButton add(Action)

AddAdds a new JButton which dispatches the action.

As of 1.3 this is no longer the preferred method for adding Actions to a container. Instead it is recommended to configure a control with an action using using setAction and then add that control directly to the Container. @param a the Action object to add as a new menu item @return the new button which dispatches the action

Class JToolBar, void addSeparator()

Appends a toolbar separator of default size to the end of the toolbar. The default size is determined by the current look and feel.
Class JToolBar, void addSeparator(Dimension)

Appends a toolbar separator of a specified size to the end of the toolbar. @param size the sizeDimension of the separator
Class JToolBar, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJToolBar. For tool bars the AccessibleContext takes the form of an AccessibleJToolBar. A new AccessibleJToolBar instance is created if necessary. @return an AccessibleJToolBar that serves as the AccessibleContext of this JComponentJToolBar
Class JToolBar, Component getComponentAtIndex(int)

Returns the component at the specified index. @param i the component's position where 0= is first @return the Component at that position or null for an invalid index
Class JToolBar, int getComponentIndex(Component)

Returns the index of the specified component. (Note: Separators occupy index positions.) @param c the Component to find @return an intinteger indicating the component's position where 0= is first
Class JToolBar, Insets getMargin()

Returns the margin between the toolbar's border and its buttons. @return an Insets object containing the margin values @see Insets
Class JToolBar, int getOrientation()

Returns the current orientation of the toolbar. The value is either HORIZONTAL or VERTICAL. @return an intinteger representing the current orientation (-- either HORIZONTAL/ or VERTICAL) @see #setOrientation
Class JToolBar, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "ToolBarUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JToolBar, boolean isFloatable()

ReturnReturns true if the ToolbarJToolbar can be dragged out by the user. @return true if the ToolbarJToolbar can be dragged out by the user false otherwise
Class JToolBar, void paintBorder(Graphics)

Paint the toolbar's border if BorderPainted property is true. @param g the Graphics context in which the painting is done @see JComponent#paint @see JComponent#setBorder
Class JToolBar, String paramString()

Returns a string representation of this JToolBar. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JToolBar.
Class JToolBar, void setBorderPainted(boolean)

Sets whether the border should be painted. @param b if true the border is painted. @see #isBorderPainted @beaninfo description: Does the toolbar paint its borders bound: true expert: true
Class JToolBar, void setFloatable(boolean)

Sets whether the toolbar can be made to float. @param b if true the toolbar can be dragged out; false otherwise @see #isFloatable @beaninfo description: Can the toolbar be made to float by the user bound: true preferred: true
Class JToolBar, void setMargin(Insets)

Sets the margin between the toolbar's border and its buttons. Setting to null causes the toolbar to use the default margins. The toolbar's default Border object uses this value to create the proper margin. However if a non-default border is set on the toolbar it is that Border object's responsibility to create the appropriate margin space (otherwise this property will effectively be ignored). @param m an Insets object that defines the space between the border and the buttons @see Insets @beaninfo description: The margin between the toolbar's border and contents bound: true expert: true
Class JToolBar, void setOrientation(int)

SetSets the orientation of the toolbar. The orientation must have either the value HORIZONTAL or VERTICAL. If orientation is an invalid value an exception will be thrown. @param o Thethe new orientation (-- either HORIZONTAL or VERTICAL @exception IllegalArgumentException if orientation is neither HORIZONTAL/ nor VERTICAL) @see #getOrientation @beaninfo description: The current orientation of the toolbar bound: true preferred: true
Class JToolBar, void setUI(ToolBarUI)

Sets the L&F object that renders this component. @param ui the ToolBarUI L&F object @see UIDefaults#getUI @beaninfo description: The menu item's UI delegate bound: true expert: true hidden: true
Class JToolBar, void updateUI()

Notification from the UIFactory that the L&F has changed. Called to replace the UI with the latest version from the UIFactory. @see JComponent#updateUI

Class JToolTip

Used to display a "Tip" for a Component. Typically components provide api to automate the process of using ToolTipsToolTips. For example any Swing component can use the JComponent setToolTipText method to specify the text for a standard tooltip. A component that wants to create a custom ToolTip display can override JComponent's createToolTip method and use a subclass of this class.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JToolTip key assignments.

See How to Use Tool Tips in The Java Tutorial for further documentation.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JComponent#setToolTipText @see JComponent#createToolTip @version %I% %G% @author Dave Moore @author Rich Shiavi


Class JToolTip.AccessibleJToolTip

TheThis class usedimplements toaccessibility support obtainfor the accessibleJToolTip class. It role forprovides an thisimplementation of the Java Accessibility API appropriate to tool tip user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JToolTip, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJToolTip. For tool tips the AccessibleContext takes the form of an AccessibleJToolTip. A new AccessibleJToolTip instance is created if necessary. @return an AccessibleJToolTip that serves as the AccessibleContext of this JComponentJToolTip
Class JToolTip, JComponent getComponent()

Returns the component the tooltip applies to. The returned value may be null. @return the component that the tooltip describes @see JComponent#createToolTip
Class JToolTip, String getTipText()

Returns the text that is shown when the tool tip is displayed. The returned value may be null. @return the String that is displayed
Class JToolTip, ToolTipUI getUI()

Returns the L&F object that renders this component. @return the ToolTipUI object that renders this component
Class JToolTip, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "ToolTipUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JToolTip, String paramString()

Returns a string representation of this JToolTip. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JToolTip.
Class JToolTip, void setComponent(JComponent)

Specifies the component that the tooltip describes. The component c may be null and will have no effect. @param c the JComponent being described @see JComponent#createToolTip
Class JToolTip, void setTipText(String)

Sets the text to show when the tool tip is displayed. The string tipText may be null. @param tipText the String to display @beaninfo preferred: true bound: true description: Sets the text of the tooltip
Class JToolTip, void updateUI()

Notification from the UIFactory that the L&F has changed. Called to replace the UI with the latest version from the UIFactory. @see JComponent#updateUI

Class JTree

A control that displays a set of hierarchical data as an outline. You can find task-oriented documentation and examples of using trees in How to Use Trees a section in The Java Tutorial.

A specific node in a tree can be identified either by a TreePath (an object that encapsulates a node and all of its ancestors) or by its display row where each row in the display area displays one node. An expanded node is one displays its children. A collapsed node is one which hides them. A hidden node is one which is under a collapsed parentancestor. AAll of a viewable node is undernodes a collapsed parentparents are expanded but may or may not be displayed. A displayed node is both viewable and in the display area where it can be seen.

TheseThe following JTree methods use "visible" to mean "displayed":

  • isRootVisible()
  • setRootVisible()
  • scrollPathToVisible()
  • scrollRowToVisible()
  • getVisibleRowCount()
  • setVisibleRowCount()

TheseThe next group of JTree methods use "visible" to mean "viewable" (under an expanded parent):

  • isVisible()
  • makeVisible()

If you are interested in knowing when the selection changes implement the TreeSelectionListener interface and add the instance using the method addTreeSelectionListener. valueChanged will be invoked when the selection changes that is if the user clicks twice on the same node valueChanged will only be invoked once.

If you are interested in knowingdetecting either double clicks-click events or when a user clicks on a node regardless of whether or not it was selected it iswe recommendedrecommend you do the following:

 final JTree tree = ...; MouseListener ml = new MouseAdapter() { public void mouseClickedmousePressed(MouseEvent e) { int selRow = tree.getRowForLocation(e.getX() e.getY()); TreePath selPath = tree.getPathForLocation(e.getX() e.getY()); if(selRow = -1) { if(e.getClickCount() == 1) { mySingleClick(selRow selPath); } else if(e.getClickCount() == 2) { myDoubleClick(selRow selPath); } } } }; tree.addMouseListener(ml); 
NOTE: This example obtains both the path and row but you only need to get the one you're interested in.

To use JTree to display compound nodes (for example nodes containing both a graphic icon and text) subclass TreeCellRenderer and use #setTreeCellRenderersetCellRenderer to tell the tree to use it. To edit such nodes subclass TreeCellEditor and use #setTreeCellEditorsetCellEditor

Like all JComponent classes you can use JComponent#registerKeyboardActionInputMap and ActionMap to associate an Action object with a KeyStroke and execute the action under specified conditions.

See How to Use Trees in The Java Tutorial for further documentation. For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JTree key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @beaninfo attribute: isContainer false description: A component that displays a set of hierarchical data as an outline. @version 1.78$I% 0503/1115/9800 @author Rob Davis @author Ray Ryan @author Scott Violet


Class JTree.AccessibleJTree

TheThis class usedimplements toaccessibility support obtainfor the accessibleJTree class. role forIt provides thisan implementation of the Java Accessibility API appropriate to tree user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JTree.AccessibleJTree.AccessibleJTreeNode, AccessibleAction getAccessibleAction()

Get the AccessibleAction associated with this object. if oneIn the exists.implementation Otherwise returnof the null.Java @Accessibility API for this class return this object which is responsible for implementing the AccessibleAction orinterface on behalf of nullitself. @return this object
Class JTree.AccessibleJTree.AccessibleJTreeNode, AccessibleComponent getAccessibleComponent()

Get the AccessibleComponent associated with this treeobject. nodeIn NOTE: if the node isimplementation not displayedof the (eitherJava scrolled off of the screen or notAccessibility API for this class return this expanded)object this will return nullwhich is responsible for @returnimplementing the AccessibleComponent interface on behalf of thisitself. @return tree nodethis object
Class JTree.AccessibleJTree.AccessibleJTreeNode, AccessibleContext getAccessibleContext()

Get the AccessibleContext associated with this tree node. @returnIn the AccessibleContextimplementation of the Java Accessibility API for this class return this object which is its own AccessibleContext. @return this JComponentobject
Class JTree.AccessibleJTree.AccessibleJTreeNode, Accessible getAccessibleSelection(int)

Returns an Accessible representing the specified selected item in the object. If there isn't a selection or there are fewer items selctedselected than the integer passed in the return value will be null. @param i the zero-based index of selected items @return an Accessible containing the selected item

Class JTree.AccessibleJTree, void fireVisibleDataPropertyChange()

Fire a visible data property change notification. A 'visible' data property is that itone that represents something about the way the component appears on the display where that appearance isn't bound to any other property. It notifies screen readers that the visual appearance of the component has changed so they can notify the user.
Class JTree.AccessibleJTree, Accessible getAccessibleAt(Point)

Returns the Accessible child if one exists contained at the local coordinate Point. @param p point in local coordinates of the this Accessible @return the Accessible if it exists at the specified location; else null
Class JTree.AccessibleJTree, Accessible getAccessibleSelection(int)

Returns an Accessible representing the specified selected item in the object. If there isn't a selection or there are fewer items selctedselected than the integer passed in the return value will be null. @param i the zero-based index of selected items @return an Accessible containing the selected item

Class JTree.DynamicUtilTreeNode

DynamicUtilTreeNode can wrap vectors/hashtables/arrays/strings and create the appropriate children tree nodes as necessary. It is dynamic in that it'll will only create the children as necessary.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JTree.DynamicUtilTreeNode, constructor JTree.DynamicUtilTreeNode(Object, Object)

Creates a node with the specified object as its value and with the specified children. For the node to allow children the children-object must be an array of objects a Vector or a Hashtable -- even if empty. Otherwise the node is not allowed to have children. @param value the Object that is the value for the new node @param children an array of ObjectsObjects a Vector or a Hashtable used to create the child nodes. If; if any other object is specified or if the value is null then the node is not allowed to have children.
Class JTree.DynamicUtilTreeNode, void createChildren(DefaultMutableTreeNode, Object)

Adds to parent all the children in children. If children is an array or Vectorvector all of its elements are added is children otherwise if children is a Hashtablehashtable all the key/value pairs are added in the order Enumeration returns them.
Class JTree.DynamicUtilTreeNode, boolean isLeaf()

Returns true if this node allows children. Whether the node allows children depends on how it was created. @return true if this node allows children false otherwise. @see #JTree.DynamicUtilTreeNode#DynamicUtilTreeNode(Object Object)
Class JTree.DynamicUtilTreeNode, void loadChildren()

Loads the children based on childValue. If childValue is a Vector orarrayor array each element is added as a child if childValue is a Hashtable each key/value pair is added in the order that Enumeration returns the keys.

Class JTree.EmptySelectionModel

EmptySelectionModel is a TreeSelectionModel that does not allow anything to be selected.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JTree.EmptySelectionModel, void addSelectionPaths(TreePath[])

A null implementation that adds nothing.
Class JTree.EmptySelectionModel, void removeSelectionPaths(TreePath[])

A null implementation that removes nothing.
Class JTree.EmptySelectionModel, void setSelectionPaths(TreePath[])

A null implementation that selects nothing.
Class JTree.EmptySelectionModel, EmptySelectionModel sharedInstance()

Returns a shared instance of an empty selection model.

Class JTree.TreeModelHandler

Listens to the model and updates the expandedState accordingly when nodes are removed or changed.

Class JTree.TreeSelectionRedirector

Handles creating a new TreeSelectionEvent with the JTree as the source and passing it off to all the listeners.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Class JTree.TreeSelectionRedirector, void valueChanged(TreeSelectionEvent)

Invoked by the TreeSelectionModel when the selection changes. @param e the TreeSelectionEvent generated by the TreeSelectionModel

Class JTree, constructor JTree()

Returns a JTree with a sample model. The default model used by the tree defines a leaf node as any node without children. @return a JTree with the default model which defines a leaf node as any node without children. @see DefaultTreeModel#asksAllowsChildren
Class JTree, constructor JTree(Hashtable)

Returns a JTree created from a Hashtable which does not display thewith root. Each value-half of the key/value pairs in the HashTable becomes a child of the new root node. By default the tree defines a leaf node as any node without children. @param value a Hashtable @return a JTree with the contents of the Hashtable as children of the root node @see DefaultTreeModel#asksAllowsChildren
Class JTree, constructor JTree(Object[])

Returns a JTree with each element of the specified array as the child of a new root node which is not displayed. By default the tree defines a leaf node as any node without children. @param value an array of ObjectsObjects @return a JTree with the contents of the array as children of the root node @see DefaultTreeModel#asksAllowsChildren
Class JTree, constructor JTree(TreeModel)

Returns an instance of JTree which displays the root node -- the tree is created using the specified data model. @param newModel the TreeModel to use as the data model @return a JTree based on the TreeModel
Class JTree, constructor JTree(TreeNode)

Returns a JTree with the specified TreeNode as its root which displays the root node. By default the tree defines a leaf node as any node without children. @param root a TreeNode object @return a JTree with the specified root node @see DefaultTreeModel#asksAllowsChildren
Class JTree, constructor JTree(TreeNode, boolean)

Returns a JTree with the specified TreeNode as its root which displays the root node and which decides whether a node is a leaf node in the specified manner. @param root a TreeNode object @param asksAllowsChildren if false any node without children is a leaf node. If; if true only nodes that do not allow children are leaf nodes. @return a JTree with the specified root node @see DefaultTreeModel#asksAllowsChildren
Class JTree, constructor JTree(Vector)

Returns a JTree with each element of the specified Vector as the child of a new root node which is not displayed. By default the tree defines a leaf node as any node without children. @param value a Vector @return a JTree with the contents of the Vector as children of the root node @see DefaultTreeModel#asksAllowsChildren
Class JTree, void addSelectionInterval(int, int)

Adds the paths between index0 and index1 inclusive to the selection. @param index0 an intinteger specifying a display row where 0 is the first row in the display @param index0index1 an intinteger specifying a second display row
Class JTree, void addSelectionPath(TreePath)

Adds the node identified by the specified TreePath to the current selection. If any component of the path isn't viewable and getExpandsSelectedPathsis true it is made viewable. @param path the TreePath to add
Class JTree, void addSelectionPaths(TreePath[])

Adds each path in the array of paths to the current selection. If any component of any of the paths isn't viewable and getExpandsSelectedPaths is true it is made viewable. @param paths an array of TreePath objects that specifies the nodes to add
Class JTree, void addSelectionRow(int)

Adds the path at the specified row to the current selection. @param row an intinteger specifying the row of the node to add where 0 is the first row in the display
Class JTree, void addTreeExpansionListener(TreeExpansionListener)

Adds a listener for TreeExpansion events. @param tel a TreeExpansionListener that will be notified when a tree node is expanded or collapsed (a "negative expansion")
Class JTree, void addTreeSelectionListener(TreeSelectionListener)

Adds a listener for TreeSelection events. @param tsl the TreeSelectionListener that will be notified when a node is selected or deselected (a "negative selection")
Class JTree, void addTreeWillExpandListener(TreeWillExpandListener)

Adds a listener for TreeWillExpand events. @param tel a TreeWillExpandListener that will be notified when a tree node will be expanded or collapsed (a "negative expansion")
Class JTree, void clearToggledPaths()

Clears the cache of toggled tree paths. This does NOT send out any TreeExpansionListener events.
Class JTree, void collapsePath(TreePath)

Ensures that the node identified by the specified path is collapsed and viewable. @param path the TreePath identifying a node
Class JTree, void collapseRow(int)

Ensures that the node in the specified row is collapsed.

If row is <0 or >= getRowCount this will have no effect. @param row an intinteger specifying a display row where 0 is the first row in the display

Class JTree, String convertValueToText(Object, boolean, boolean, boolean, int, boolean)

Called by the renderers to convert the specified value to text. This implementation returns value.toString() ignoring all other arguments. To control the conversion subclass this method and use any of the arguments you need. @param value the Object to convert to text @param selected true if the node is selected @param expanded true if the node is expanded @param leaf true if the node is a leaf node @param row an intinteger specifying the node's display row where 0 is the first row in the display @param hasFocus true if the node has the focus @return the String representation of the node's value
Class JTree, TreeModel createTreeModel(Object)

Returns a TreeModel wrapping the specified object. If the object is:
  • an array of ObjectsObjects
  • a Hashtable or
  • a Vector
then a new root node is created with each of the incoming objects as children. Otherwise a new root is created with the specified object as its value. @param value the Object used as the foundation for the TreeModel @return a TreeModel wrapping the specified object
Class JTree, TreeModelListener createTreeModelListener()

Creates and returns an instance of TreeModelHandler. The returned object is responsible for updating the expanded state when the TreeModel changes.

For more information on what expanded state means see the JTree description above.

Class JTree, void expandPath(TreePath)

Ensures that the node identified by the specified path is expanded and viewable. @param path the TreePath identifying a node
Class JTree, void expandRow(int)

Ensures that the node in the specified row is expanded and viewable.

If row is <0 or >= getRowCount this will have no effect. @param row an intinteger specifying a display row where 0 is the first row in the display

Class JTree, void fireTreeCollapsed(TreePath)

Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. @param path the TreePath indicating the node that was collapsed @see EventListenerList
Class JTree, void fireTreeExpanded(TreePath)

Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. @param path the TreePath indicating the node that was expanded @see EventListenerList
Class JTree, void fireTreeWillCollapse(TreePath)

Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. @param path the TreePath indicating the node that was expanded @see EventListenerList
Class JTree, void fireTreeWillExpand(TreePath)

Notify all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. @param path the TreePath indicating the node that was expanded @see EventListenerList
Class JTree, void fireValueChanged(TreeSelectionEvent)

NotifyNotifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method. @param e the TreeSelectionEvent generated by the TreeSelectionModel when a node is selected or deselected @see EventListenerList
Class JTree, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJTree. For JTrees the AccessibleContext takes the form of an AccessibleJTree. A new AccessibleJTree instance is created if necessary. @return an AccessibleJTree that serves as the AccessibleContext of this JComponentJTree
Class JTree, TreeCellEditor getCellEditor()

Returns the editor used to edit entries in the tree. @return the TreeCellEditor in use or null if the tree cannot be edited
Class JTree, TreeCellRenderer getCellRenderer()

Returns the current TreeCellRenderer that is rendering each cell. @return the TreeCellRenderer that is rendering each cell
Class JTree, TreePath getClosestPathForLocation(int, int)

Returns the path to the node that is closest to x y. If no nodes are currently viewable or there is no model returns null otherwise it always returns a valid path. To test if the node is exactly at x y get the node's bounds and test x y against that. @param x an intinteger giving the number of pixels horizontally from the left edge of the display area minus any left margin @param y an intinteger giving the number of pixels vertically from the top of the display area minus any top margin @return the TreePath for the node closest to that location null if nothing is viewable or there is no model @see #getPathForLocation @see #getPathBounds
Class JTree, int getClosestRowForLocation(int, int)

Returns the row to the node that is closest to x y. If no nodes are viewable or there is no model returns -1. Otherwise it always returns a valid row. To test if the returned object is exactly at x y get the bounds for the node at the returned row and test x y against that. @param x an intinteger giving the number of pixels horizontally from the left edge of the display area minus any left margin @param y an intinteger giving the number of pixels vertically from the top of the display area minus any top margin @return the row closest to the location -1 if nothing is viewable or there is no model @see #getRowForLocation @see #getRowBounds
Class JTree, TreeModel getDefaultTreeModel()

Creates and returns a sample TreeModel. Used primarily for beanbuilders. to show something interesting. @return the default TreeModel
Class JTree, Enumeration getDescendantToggledPaths(TreePath)

Returns an Enumeration of TreePaths that have been expanded that are descendants of parent.
Class JTree, TreePath getEditingPath()

Returns the path to the element that is currently being edited. @return the TreePath for the node being edited
Class JTree, Enumeration getExpandedDescendants(TreePath)

Returns an Enumeration of the descendants of the path parent that are currently expanded. If pathparent is not currently expanded this will return null. If you expand/collapse nodes while iterating over the returned Enumeration this may not return all the expanded paths or may return paths that are no longer expanded. @param parent the path which is to be examined @return an Enumeration of the descendents of parent or null if parent is not currently expanded
Class JTree, Object getLastSelectedPathComponent()

Returns the last path component in the first node of the current selection. @return the last Object in the first selected node's TreePath or null if nothing is selected @see TreePath#getLastPathComponent
Class JTree, TreePath getLeadSelectionPath()

Returns the path ofidentified the last node addedas to the selectionlead. @return the TreePath of the last nodepath added toidentified as the selection.lead
Class JTree, int getLeadSelectionRow()

Returns the row index of the last nodecorresponding added to the selectionlead path. @return an intinteger giving the row index of the last node added to thelead selectionpath where 0 is the first row in the display; or -1 if leadPath is null
Class JTree, int getMaxSelectionRow()

GetsReturns the last selected row. @return an intinteger designating the last selected row where 0 is the first row in the display
Class JTree, int getMinSelectionRow()

Gets the first selected row. @return an intinteger designating the first selected row where 0 is the first row in the display
Class JTree, TreeModel getModel()

Returns the TreeModel that is providing the data. @return the TreeModel that is providing the data
Class JTree, TreePath[] getPathBetweenRows(int, int)

Returns JTreePath instances representing the path between index0 and index1 (including index1). Returns null if there is no tree. @param index0 an intinteger specifying a display row where 0 is the first row in the display @param index0index1 an intinteger specifying a second display row @return an array of TreePath objects one for each node between index0 and index1 inclusive; or null if there is no tree
Class JTree, Rectangle getPathBounds(TreePath)

Returns the Rectangle that the specified node will be drawn into. Returns null if any component in the path is hidden (under a collapsed parent).

Note:
This method returns a valid rectangle even if the specified node is not currently displayed. @param path the TreePath identifying the node @return the Rectangle the node is drawn in or null

Class JTree, TreePath getPathForLocation(int, int)

Returns the path for the node at the specified location. @param x an intinteger giving the number of pixels horizontally from the left edge of the display area minus any left margin @param y an intinteger giving the number of pixels vertically from the top of the display area minus any top margin @return the TreePath for the node at that location
Class JTree, TreePath getPathForRow(int)

Returns the path for the specified row. --If row is not visible null is returned.- @param row an intinteger specifying a row @return the TreePath to the specified node null if row <0 or row > getRowCount()
Class JTree, Dimension getPreferredScrollableViewportSize()

Returns the preferred display size of a JTree. The height is determined from getVisibleRowCount and the width is the current preferred width. @return a Dimension object containing the preferred size
Class JTree, Rectangle getRowBounds(int)

Returns the Rectangle that the node at the specified row is drawn in. @param row the row to be drawn where 0 is the first row in the display @return the Rectangle the node is drawn in
Class JTree, int getRowForLocation(int, int)

Returns the row for the specified location. @param x an intinteger giving the number of pixels horizontally from the left edge of the display area minus any left margin @param y an intinteger giving the number of pixels vertically from the top of the display area minus any top margin @return the row corresponding to the location or -1 if the location is not within the bounds of a displayed cell @see #getClosestRowForLocation
Class JTree, int getRowForPath(TreePath)

Returns the row that displays the node identified by the specified path. @param path the TreePath identifying a node @return an intinteger specifying the display row where 0 is the first row in the display or -1 if any of the elements in path are hidden under a collapsed parent.
Class JTree, int getRowHeight()

Returns the height of each row. If the returned value is less than or equal to 0 the height for each row is determined by the renderer. @param the height of each cell in pixels. Zero; zero or negative if the height of each row is determined by the tree cell renderer
Class JTree, int getScrollableBlockIncrement(Rectangle, int, int)

Returns the amount for a block inrecmentincrement which is the height or width of visibleRect based on orientation. @param visibleRect Thethe view area visible within the viewport @param orientation Eithereither SwingConstants.VERTICAL or SwingConstants.HORIZONTAL. @param direction Lessless than zero to scroll up/left greater than zero for down/right. @return Thethe "block" increment for scrolling in the specified direction. @see JScrollBar#setBlockIncrement(int)
Class JTree, int getScrollableUnitIncrement(Rectangle, int, int)

Returns the amount to increment when scrolling. The amount is the height of the first displayed row that isn't completely in view or if it is totally displayed the height of the next row in the scrolling direction. @param visibleRect Thethe view area visible within the viewport @param orientation Eithereither SwingConstants.VERTICAL or SwingConstants.HORIZONTAL. @param direction Lessless than zero to scroll up/left greater than zero for down/right. @return Thethe "unit" increment for scrolling in the specified direction @see JScrollBar#setUnitIncrement(int)
Class JTree, boolean getScrollsOnExpand()

Returns true if the tree scrolls to show previously hidden children. @return true if when a node is expanded as many of the descendants as possible are scrolled to be visible.
Class JTree, TreeSelectionModel getSelectionModel()

Returns the model for selections. This should always return a non-null value. If you don't want to allow anything to be selected set the selection model to null which forces an empty selection model to be used. @param the TreeSelectionModel in use @see #setSelectionModel
Class JTree, TreePath getSelectionPath()

Returns the path to the first selected node. @return the TreePath for the first selected node or null if nothing is currently selected
Class JTree, TreePath[] getSelectionPaths()

Returns the paths of all selected values. @return an array of TreePath objects indicating the selected nodes or null if nothing is currently selected.
Class JTree, int[] getSelectionRows()

Returns all of the currently selected rows. This method is simply forwarded to the TreeSelectionModel. If nothing is selected null or an empty array withwill be returned based on the TreeSelectionModel implementation. @return an array of intsintegers that identifies all currently selected rows where 0 is the first row in the display
Class JTree, String getToolTipText(MouseEvent)

Overrides JComponent's getToolTipText method in order to allow renderer's tips to be used if it has text set.

NOTE: For JTree to properly display tooltips of its renderers JTree must be a registered component with the ToolTipManager. This can be done by invoking ToolTipManager.sharedInstance().registerComponent(tree). This is not done automaticlyautomatically @param event the MouseEvent that initiated the ToolTip display @return a string containing the tooltip or null if event is null

Class JTree, String getUIClassID()

Returns the name of the L&F class that renders this component. @return the string "TreeUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JTree, boolean hasBeenExpanded(TreePath)

Returns true if the node identified by the path has ever been expanded. @return true if the path has ever been expanded
Class JTree, boolean isCollapsed(TreePath)

Returns true if the value identified by path is currently collapsed this will return false if any of the values in path are currently not being displayed. @param path the TreePath to check @return true if any of the nodes in the node's path are collapsed false if all nodes in the path are expanded
Class JTree, boolean isEditable()

Returns true if the tree is editable. @return true if the tree is editable.
Class JTree, boolean isExpanded(TreePath)

Returns true if the node identified by the path is currently expanded @param path the TreePath specifying the node to check @return false if any of the nodes in the node's path are collapsed true if all nodes in the path are expanded
Class JTree, boolean isPathSelected(TreePath)

Returns true if the item identified by the path is currently selected. @param path a TreePath identifying a node @return true if the node is selected
Class JTree, boolean isRowSelected(int)

Returns true if the node identitifed by row is selected. @param row an intinteger specifying a display row where 0 is the first row in the display @return true if the node is selected
Class JTree, boolean isVisible(TreePath)

Returns true if the value identified by path is currently viewable which means it is either the root or all of its parents are exapndedexpanded. Otherwise this method returns false. @return true if the node is viewable otherwise false
Class JTree, void makeVisible(TreePath)

Ensures that the node identified by path is currently viewable. @param path the TreePath to make visible
Class JTree, String paramString()

Returns a string representation of this JTree. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JTree.
Class JTree, void removeDescendantToggledPaths(Enumeration)

Removes any descendants of the TreePaths in toRemove that have been expanded.
Class JTree, void removeSelectionInterval(int, int)

Removes the nodes between index0 and index1 inclusive from the selection. @param index0 an intinteger specifying a display row where 0 is the first row in the display @param index0index1 an intinteger specifying a second display row
Class JTree, void removeSelectionPath(TreePath)

Removes the node identified by the specified path from the current selection. @param path the TreePath identifying a node
Class JTree, void removeSelectionPaths(TreePath[])

Removes the nodes identified by the specified paths from the current selection. @param paths an array of TreePath objects that specifies the nodes to remove
Class JTree, void removeTreeExpansionListener(TreeExpansionListener)

Removes a listener for TreeExpansion events. @param tel the TreeExpansionListener to remove
Class JTree, void removeTreeSelectionListener(TreeSelectionListener)

Removes a TreeSelection listener. @param tsl the TreeSelectionListener to remove
Class JTree, void removeTreeWillExpandListener(TreeWillExpandListener)

Removes a listener for TreeWillExpand events. @param tel the TreeWillExpandListener to remove
Class JTree, void scrollPathToVisible(TreePath)

Makes sure all the path components in path are expanded (except for the last path component) and scrolls so that the node identified by the path is displayed. Only works when this JTree is contained in a JSrollPaneJScrollPane. @param path the TreePath identifying the node to bring into view
Class JTree, void scrollRowToVisible(int)

Scrolls the item identified by row until it is displayed. The minimum of amount of scrolling necessary to bring the row into view is performed. Only works when this JTree is contained in a JSrollPaneJScrollPane. @param row an intinteger specifying the row to scroll where 0 is the first row in the display
Class JTree, void setCellEditor(TreeCellEditor)

Sets the cell editor. A null value implies that the tree cannot be edited. If this represents a change in the cellEditor the propertyChange method is invoked on all listeners. @param cellEditor the TreeCellEditor to use @beaninfo bound: true description: The cell editor. A null value implies the tree cannot be edited.
Class JTree, void setCellRenderer(TreeCellRenderer)

Sets the TreeCellRenderer that will be used to draw each cell. @param x the TreeCellRenderer that is to render each cell @beaninfo bound: true description: The TreeCellRenderer that will be used to draw each cell.
Class JTree, void setExpandedState(TreePath, boolean)

Sets the expanded state of thethis receiverJTree. If state is true all parents of path and path are marked as expanded. If state is false all parents of path are marked EXPANDED but path itself is marked collapsed.

This will fail if a TreeWillExpandListener vetos it.

Class JTree, void setInvokesStopCellEditing(boolean)

Determines what happens when editing is interrupted by selecting another node in the tree a change in the tree's data or by some other means. Setting this property to true causes the changes to be automatically saved when editing is interrupted.

Fires a property change for the INVOKES_STOP_CELL_EDITING_PROPERTY. @param newValue true means that stopCellEditing is invoked when editing is interruped and data is saved. False; false means that cancelCellEditing is invoked and changes are lost. @beaninfo bound: true description: Determines what happens when editing is interrupted selecting another node in the tree a change in the tree's data or some other means.

Class JTree, void setModel(TreeModel)

Sets the TreeModel that will provide the data. @param newModel the TreeModel that is to provide the data @beaninfo bound: true description: The TreeModel that will provide the data.
Class JTree, void setRootVisible(boolean)

Determines whether or not the root node from the TreeModel is visible. @param rootVisible true if the root node of the tree is to be displayed @see #rootVisible @beaninfo bound: true description: Whether or not the root node from the TreeModel is visible.
Class JTree, void setRowHeight(int)

Sets the height of each cell in pixels. If the specified value is less than or equal to zero the current cell renderer is queried for each row's height. @param rowHeight the height of each cell in pixels @beaninfo bound: true description: The height of each cell.
Class JTree, void setScrollsOnExpand(boolean)

Determines whether or not when a node is expanded as many of the descendants are scrolled to be inside the viewport as possible. The default is true. @beaninfo bound: true description: Indicates if a node descendent should be scrolled when expanded.
Class JTree, void setSelectionInterval(int, int)

Selects the nodes between index0 and index1 inclusive. @param index0 an intinteger specifying a display row where 0 is the first row in the display @param index0index1 an intinteger specifying a second display row
Class JTree, void setSelectionModel(TreeSelectionModel)

Sets the tree's selection model. When a null value is specified an emptyemtpy electionModelselectionModel is used which does not allow selections. @param selectionModel the TreeSelectionModel to use or null to disable selections @see TreeSelectionModel @beaninfo bound: true description: The tree's selection model.
Class JTree, void setSelectionPath(TreePath)

Selects the node identified by the specified path. If any component of the path is hidden (under a collapsed node) and getExpandsSelectedPaths is true it is exposed (made viewable). @param path the TreePath specifying the node to select
Class JTree, void setSelectionPaths(TreePath[])

Selects the nodes identified by the specified array of paths. If any component in any of the paths is hidden (under a collapsed node) and getExpandsSelectedPaths is true it is exposed (made viewable). @param paths an array of TreePath objects that specifies the nodes to select
Class JTree, void setSelectionRows(int[])

Selects the nodes corresponding to each of the specified rows in the display. If a particular element of rows is <0 or >= getRowCount it will be ignored. If none of the elements in rows are valid rows the selection will be cleared. That is it will be as if clearSelection was invoked. @param rows an array of ints specifying the rows to select where 0 indicates the first row in the display
Class JTree, void setVisibleRowCount(int)

Sets the number of rows that are to be displayed. This will only work if the reciever is contained in a JScrollPane and will adjust the preferred size and size of that scrollpane. @param newCount the number of rows to display @beaninfo bound: true description: The number of rows that are to be displayed.
Class JTree, void startEditingAtPath(TreePath)

Selects the node identified by the specified path and initiates editing. The edit-attempt fails if the CellEditor does not allow editing for the specified item. @param path the TreePath identifying a node
Class JTree, boolean stopEditing()

Ends the current editing session. (The DefaultTreeCellEditor object saves any edits that are currently in progress on a cell. Other implementations may operate differently.) Has no effect if the tree isn't being edited.
Note:
To make edit-saves automatic whenever the user changes their position in the tree use #setInvokesStopCellEditing
@return true if editing was in progress and is now stopped false if editing was not in progress
Class JTree, void updateUI()

Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager. @see JComponent#updateUI
Class JTree, String CELL_EDITOR_PROPERTY

Bound property name for cellEditor.
Class JTree, String CELL_RENDERER_PROPERTY

Bound property name for cellRenderer.
Class JTree, String EDITABLE_PROPERTY

Bound property name for editable.
Class JTree, String INVOKES_STOP_CELL_EDITING_PROPERTY

Bound property name for messagesStopCellEditing.
Class JTree, String LARGE_MODEL_PROPERTY

Bound property name for largeModel.
Class JTree, String ROOT_VISIBLE_PROPERTY

Bound property name for rootVisible.
Class JTree, String ROW_HEIGHT_PROPERTY

Bound property name for rowHeight.
Class JTree, String SCROLLS_ON_EXPAND_PROPERTY

Bound property name for scrollsOnExpand.
Class JTree, String SHOWS_ROOT_HANDLES_PROPERTY

Bound property name for showsRootHandles.
Class JTree, String TREE_MODEL_PROPERTY

Bound property name for treeModel.
Class JTree, String VISIBLE_ROW_COUNT_PROPERTY

Bound property name for visibleRowCount.
Class JTree, TreeCellEditor cellEditor

Editor for the entries. Default is null (tree is not editable).
Class JTree, TreeCellRenderer cellRenderer

The cell used to draw nodes. If null the UI uses a default cellRenderer.
Class JTree, boolean invokesStopCellEditing

If true when editing is to be stopped by way of selection changing data in tree changing or other means stopCellEditing is invoked and changes are saved. If false cancelCellEditing is invoked and changes are discarded. Default is false.
Class JTree, TreeSelectionRedirector selectionRedirector

Creates a new event and passed it off the selectionListeners.
Class JTree, TreeModelListener treeModelListener

Updates the expandedState.
Class JTree, int visibleRowCount

Number of rows to make visible at one time. This value is used for the Scrollable interface. It determines the preferred size of the display area.

Class JViewport

The "viewport" or "porthole" through which you see the underlying information. When you scroll what moves is the viewport. ItsIt is like peering through a camera's viewfinder. Moving the viewfinder upwards brings new things into view at the top of the picture and loses things that were at the bottom.

By default JViewport is opaque. To change this use the setOpaque method.

NOTE:We have implemented a faster scrolling algorithm that does not require a buffer to draw in. The algorithm works as follows:

  1. The view and parent view and checked to see if they are JComponents if they aren't stop and repaint the whole viewport.
  2. If the viewport is obscured by an ancestor stop and repaint the whole viewport.
  3. Compute the region that will become visible if it is as big as the viewport stop and repaint the whole view region.
  4. Obtain the ancestor Windows graphics and do a copyArea on the scrolled region.
  5. Message the view to repaint the newly visible region.
  6. The next time paint is invoked on the viewport if the clip region is smaller than the viewport size a timer is kicked off to repaint the whole region.
In general this approach is much faster. Compared to the backing store approach this avoids the overhead of maintaining an offscreen buffer and having to do two copyAreascopyAreas. Compared to the non backing store case this approach will greatly reduce the painted region.

This approach can cause slower times than the backing store approach when the viewport is obscured by another window or partially offscreen. When another window obscures the viewport the copyArea will copy garbage and a paint event will be generated by the system to inform us we need to paint the newly exposed region. The only way to handle this is to repaint the whole viewport which can cause slower performance than the backing store case. In most applications very rarely will the user be scrolling while the viewport is obscured by another window or offscreen so this optimization is usually worth the performance hit when obscured. To turn this behavior on put the client property "EnableWindowBlit" (a method will added to enable/disable this in the future). Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.63 0484 03/2214/9900 @author Hans Muller @author Philip Milne @see JScrollPane


Class JViewport.AccessibleJViewport

TheThis class usedimplements toaccessibility support obtainfor the accessibleJViewport class. role forIt provides thisan implementation of the Java Accessibility API appropriate to viewport user-interface objectelements.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.


Class JViewport, constructor JViewport()

CreateCreates a JViewport.
Class JViewport, void addChangeListener(ChangeListener)

AddAdds a ChangeListener to the list that's is notified each time the view's size position or the viewport's extent size has changed. @param l the ChangeListener to add @see #removeChangeListener @see #setViewPosition @see #setViewSize @see #setExtentSize
Class JViewport, void addImpl(Component, Object, int)

Sets the Viewport'JViewports one lightweight child which can be null. (Since there is only one child which occupies the entire viewport the constraints and index arguments are ignored.) @param child the Componentlightweight child of ______________the viewport @param constraints the Objectconstraints to be ______________respected @param index the int ______________index @see #setView
Class JViewport, boolean computeBlit(int, int, Point, Point, Dimension, Rectangle)

Computes the parameters for a blit where the backing store image currently contains oldLoc in the upper left hand corner and we're scrolling to newLoc. The parameters are modified to return the values required for the blit. @param dx the horizontal delta @param dy the vertical delta @param blitFrom the Point we're blitting from @param blitTo the Point we're blitting to @param blitSize the Dimension of the area to blit @param blitPaint the area to blit @return true if the parameters are modified and we're ready to blit; false otherwise
Class JViewport, LayoutManager createLayoutManager()

Subclassers can override this to install a different layout manager (or null) in the constructor. Returns a new JViewportLayoutViewportLayout object. @return a LayoutManager
Class JViewport, ViewListener createViewListener()

CreateCreates a listener for the view. @return a ViewListener
Class JViewport, void firePropertyChange(String, Object, Object)

Notifies listeners of a property change. This is subclassed to update the windowBlit ivarproperty. (The putClientProperty property is final). @param propertyName a string containing the property name @param oldValue the old value of the property @param newValue the new value of the property
Class JViewport, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JComponentJViewport. For viewports the AccessibleContext takes the form of an AccessibleJViewport. A new AccessibleJViewport instance is created if necessary. @return an AccessibleJViewport that serves as the AccessibleContext of this JComponentJViewport
Class JViewport, Dimension getExtentSize()

Returns the size of the visible part of the view in view coordinates. @return a Dimension object giving the size of the view
Class JViewport, Insets getInsets()

Returns the insets (border) dimensions as (0 0 0 0) since borders are not supported on a JViewport. @return newa Insets(0Rectange 0 0of zero 0)dimension and zero origin @see #setBorder
Class JViewport, Insets getInsets(Insets)

Returns an Insets object containing this JViewport's inset values. The passed-in Insets object will be reinitialized and all existing values within this object are overwritten. @param insets the Insets object which can be reused. @return this viewports inset values @see #getInsets @beaninfo expert: true
Class JViewport, String getUIClassID()

ReturnReturns the UIDefaults key useda to look upstring that specifies the name of the swing.plaf.ComponentUIL&F class that defines the look and feelrenders for this component. Most applications will never need to call this method. Subclasses of JComponent that support pluggable look and feel should override this method to @return a UIDefaults key that maps to the ComponentUI subclass that defines their look andstring feel."ViewportUI" @return The UIDefaults key for a ComponentUIsee subclass.JComponent#getUIClassID @see UIDefaults#getUI @beaninfo expert: true description: UIClassID
Class JViewport, Component getView()

Returns the Viewport'JViewports one child or null. @return the viewports child or null if none exists @see #setView
Class JViewport, Point getViewPosition()

Returns the view coordinates that appear in the upper left hand corner of the viewport or 0 0 if there's no view. @return a Point object giving the upper left coordinates
Class JViewport, Rectangle getViewRect()

ReturnReturns a rectangle whose origin is getViewPosition and size is getExtentSize(). This is the visible part of the view in view coordinates. @return a Rectangle giving the visible part of the view using view coordinates.
Class JViewport, Dimension getViewSize()

If the view's size hasn't been explicitly set return the preferred size otherwise return the view's current size. If there is no view return 0 0. @return a Dimension object specifying the size of the view
Class JViewport, boolean isBackingStoreEnabled()

Returns true if this viewport is maintaining an offscreen image of its contents. @return true if scrollMode is BACKINGSTORE_SCROLL_MODE @deprecated As of Java 2 platform v1.3 replaced by getScrollMode().
Class JViewport, boolean isOptimizedDrawingEnabled()

The JViewport overrides the default implementation of this method (in JComponent) to return false. This ensures that the drawing machinery will call the Viewport's paint() implementation rather than messaging the JViewport's children directly. @return false
Class JViewport, void paint(Graphics)

Depending on whether the backingStore is enabled either paint the image through the backing store or paint just the recently exposed part using the backing store to "blit" the remainder.
The term "blit" is the pronounced version of the PDP-10 BLT (BLock Transfer) instruction which copied a block of bits. (In case you were curious.)
@param g the Graphics context within which to paint
Class JViewport, String paramString()

Returns a string representation of this JViewport. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JViewport.
Class JViewport, void remove(Component)

Removes the Viewport's one lightweight child. @see #setView
Class JViewport, void removeChangeListener(ChangeListener)

RemoveRemoves a ChangeListener from the list that's notified each time the views size position or the viewports extent size has changed. @param l the ChangeListener to remove @see #addChangeListener
Class JViewport, void repaint(long, int, int, int, int)

WeAlways always repaint in our parentthe parents coordinate system to make sure only one paint is performed by the RepaintManager. @param tm maximum time in milliseconds before update @param x the x coordinate (pixels over from left) @param y the y coordinate (pixels down from top) @param width the width @param height the height @see java.awt.Component#update(java.awt.Graphics)
Class JViewport, void reshape(int, int, int, int)

Sets the bounds of this viewport. If the viewports width or height has changed fire a StateChanged event. @param x left edge of the origin @param y top edge of the origin @param w width in pixels @param h height in pixels @see JComponent#reshape(int int int int)
Class JViewport, void scrollRectToVisible(Rectangle)

Overridden to scroll the view so that Rectangle within the view becomes visible. @param contentRect the Rectangle to display
Class JViewport, void setBackingStoreEnabled(boolean)

If true if this viewport will maintain an offscreen image of its contents. The image is used to reduce the cost of small one dimensional changes to the viewPosition. Rather than repainting the entire viewport we use Graphics.copyArea() to effect some of the scroll. @param enabled if true maintain an offscreen backing store @deprecated As of Java 2 platform v1.3 replaced by setScrollMode().
Class JViewport, void setBorder(Border)

The viewport "scrolls" it's child (called the "view") by the normal parent/child clipping (typically the view is moved in the opposite direction of the scroll). A non-null border or non-zero insets isn't supported to prevent the geometry of this component from becoming complex enough to inhibit subclassing. To create a JViewport with a border add it to a JPanel that has a border.

Note: If border is non-null this method will throw an exception as borders are not supported on a JViewPort. @param border the Border to set @exception IllegalArgumentException this method is not implemented

Class JViewport, void setExtentSize(Dimension)

SetSets the size of the visible part of the view using view coordinates. @param newExtent a Dimension object specifying the size of the view
Class JViewport, void setView(Component)

Sets the Viewport'JViewports one lightweight child (view) which can be null. @param view the viewports new lightweight child @see #getView
Class JViewport, void setViewPosition(Point)

Sets the view coordinates that appear in the upper left hand corner of the viewport does nothing if there's no view. @param p a Point object giving the upper left coordinates
Class JViewport, void setViewSize(Dimension)

Sets the view coordinates that appear in the upper left hand corner of the viewport and the size of the view. @param newSize a Dimension object specifying the size and location of the new view coordinates or null if there is no view
Class JViewport, Dimension toViewCoordinates(Dimension)

ConvertConverts a size in pixel coordinates to view coordinates. Subclasses of viewport that support "logical coordinates" will override this method. @param size a Dimension object using pixel coordinates @return a Dimension object converted to view coordinates
Class JViewport, Point toViewCoordinates(Point)

ConvertConverts a point in pixel coordinates to view coordinates. Subclasses of viewport that support "logical coordinates" will override this method. @param p a Point object using pixel coordinates @return a Point object converted to view coordinates
Class JViewport, void updateUI()

ResetsNotification the UI property to a value from the current look and feel. JComponent subclasses must override this method likeUIFactory this:that public voidthe updateUI()L&F {has setUI((SliderUI)UIManagerchanged.getUI(this); } @see #setUI @see UIManager#getLookAndFeel @see UIManagerJComponent#getUIupdateUI
Class JViewport, boolean backingStore

True when this viewport is maintaining an offscreen image of its contents so that some scrolling can take place using fast "bit-blit" operations instead of by accessing the view object to construct the display. The default is false. @deprecated As of Java 2 platform v1.3 @see #setScrollMode
Class JViewport, boolean isViewSizeSet

True when the viewport dimensions have been determined. The default is false.
Class JViewport, Point lastPaintPosition

The last viewPosition that we've painted so we know how much of the backing store image is valid.
Class JViewport, boolean scrollUnderway

The scrollUnderway flag is used for components like JList. When the downarrow key is pressed on a JList and the selected cell is the last in the list the scrollpane autoscrolls. Here the old selected cell needs repainting and so we need a flag to make the viewport do the optimisedoptimized painting only when there is an explicit call to setViewPosition(Point). When setBounds() is called through other routes the flag is off and the view repaints normally. Another approach would be to remove this from the ViewportJViewport class and have the JList manage this case by using setBackingStoreEnabled(). The default is false.

Class JWindow

A JWindow is a container that can be displayed anywhere on the user's desktop. It does not have the title bar window-management buttons or other trimmings associated with a JFrame but it is still a "first-class citizen" of the user's desktop and can exist anywhere on it.

The JWindow component contains a JRootPane as it's only child. The contentPane() should be the parent of any children of the JWindow. From the older java.awt.Window object you would normally do something like this:

 window.add(child); 
However using JWindow you would code:
 window.getContentPane().add(child); 
The same is true of setting LayoutManagersLayoutManagers
removing components listing children etc. All these methods should normally be sent to the contentPane() instead of the JWindow itself. The contentPane() will always be non-null. Attempting to set it to null will cause the JWindow to throw an exception. The default contentPane() will have a BorderLayout manager set on it.

Please see the JRootPane documentation for a complete description of the contentPane() glassPane() and layeredPane() components.

In a multi-screen environment you can create a JWindow on a different screen device. See java.awt.Window for more information.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions see the JWindow key assignments.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JRootPane @beaninfo attribute: isContainer true attribute: containerDelegate getContentPane description: A toplevel window which has no system border or controls. @version 1.27 0435 01/2221/9901 @author David Kloba


Class JWindow.AccessibleJWindow

TheThis class usedimplements toaccessibility support obtainfor the AccessibleRoleJWindow forclass. It provides an implementation of the Java Accessibility API appropriate to window thisuser-interface objectelements.
Class JWindow.AccessibleJWindow, AccessibleComponent getAccessibleComponent()

Get the AccessibleComponent associated with this object if one exists. Otherwise return null. @return the component
Class JWindow.AccessibleJWindow, void setBackground(Color)

Set the background color of this object. (For transparency see isOpaque.) @param c the new Color for the background @see Component#isOpaque
Class JWindow.AccessibleJWindow, void setLocation(Point)

Sets the location of the object relative to the parent. @param p the Point object specifying the location of the object's upper left corner

Class JWindow, constructor JWindow(Frame)

Creates a window with the specified owner frame. If owner is null the shared owner will be used. @param owner the frame from which the window is displayed
Class JWindow, constructor JWindow(Window)

Creates a window with the owner and the specified ownerGraphicsConfiguration windowof a screen device. @param owner the window fromto act as owner @param whichgc the windowGraphicsConfiguration that is used to construct the new Window; if gc is null the system default GraphicsConfiguration is assumed @exception IllegalArgumentException if gc is not from a screen device. @exception IllegalArgumentException if owner is displayednull @since 1.3
Class JWindow, void addImpl(Component, Object, int)

By default children may not be added directly to a this component they must be added to its contentPane instead. For example:
 thisComponent.getContentPane().add(child) 
An attempt to add to directly to this component will cause an runtime exception to be thrown. Subclasses can disable this behavior. @param comp the component to be enhanced @param constraints the constraints to be enforced on the component @param index the index of the component @see #setRootPaneCheckingEnabled @exception Error if called with rootPaneChecking true
Class JWindow, JRootPane createRootPane()

Called by the constructor methods to create the default rootPane.
Class JWindow, AccessibleContext getAccessibleContext()

GetGets the AccessibleContext associated with this JWindow. For JWindows the AccessibleContext takes the form of an AccessibleJWindow. A new AccessibleJWindow instance is created if necessary. @return an AccessibleJWindow that serves as the AccessibleContext of this JWindow
Class JWindow, Container getContentPane()

Returns the contentPaneContainer which is the objectcontentPane for this window. @return the Container which is the contentPane property @see #setContentPane @see RootPaneContainer#getContentPane
Class JWindow, Component getGlassPane()

Returns the glassPane objectComponent for this window. @return the Component which is the glassPane property @see #setGlassPane @see RootPaneContainer#getGlassPane
Class JWindow, JLayeredPane getLayeredPane()

Returns the layeredPane object for this window. @return the JLayeredPanelayeredPane objectproperty @see #setLayeredPane @see RootPaneContainer#getLayeredPane
Class JWindow, JRootPane getRootPane()

Returns the rootPane object for this window. @return the rootPane property for this window @see #setRootPane @see RootPaneContainer#getRootPane
Class JWindow, boolean isRootPaneCheckingEnabled()

Returns whether calls to add and setLayout will cause an exception to be thrown. @return true if add and setLayout are checked @see #addImpl @see #setLayout @see #setRootPaneCheckingEnabled
Class JWindow, String paramString()

Returns a string representation of this JWindow. This method is intended to be used only for debugging purposes and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null. @return a string representation of this JWindow.
Class JWindow, void setContentPane(Container)

Sets the contentPane property for this window. This method is called by the constructor. @param contentPane the contentPane objectnew for this windowcontentPane @exception java.awt.IllegalComponentStateException (a runtime exception) if the content pane parameter is null @see #getContentPane @see RootPaneContainer#setContentPane @beaninfo hidden: true description: The client area of the window where child components are normally inserted.
Class JWindow, void setGlassPane(Component)

Sets the glassPane property. This method is called by the constructor. @param glassPane the glassPane object for this window @see #getGlassPane @see RootPaneContainer#setGlassPane @beaninfo hidden: true description: A transparent pane used for menu rendering.
Class JWindow, void setLayeredPane(JLayeredPane)

Sets the layeredPane property. This method is called by the constructor. @param layeredPane the new layeredPane object for this window @exception java.awt.IllegalComponentStateException (a runtime exception) if the content pane parameter is null @see #getLayeredPane @see RootPaneContainer#setLayeredPane @beaninfo hidden: true description: The pane which holds the various window layers.
Class JWindow, void setLayout(LayoutManager)

By default the layout of this component may not be set the layout of its contentPane should be set instead. For example:
 thisComponent.getContentPane().setLayout(new BorderLayout()) 
An attempt to set the layout of this component will cause an runtime exception to be thrown. Subclasses can disable this behavior. @param manager the layout manager for the window @see #setRootPaneCheckingEnabled @exception Error if called with rootPaneChecking true
Class JWindow, void setRootPane(JRootPane)

Sets the new rootPane propertyobject for this window. This method is called by the constructor. @param root the rootPane object fornew thisrootPane windowproperty @see #getRootPane @beaninfo hidden: true description: the RootPane object for this window.
Class JWindow, void setRootPaneCheckingEnabled(boolean)

Determines whether calls to add and setLayout will cause an exception to be thrown. @param enabled a boolean value true if checking is to be enabled which cause the exceptions to be thrown @see #addImpl @see #setLayout @see #isRootPaneCheckingEnabled @beaninfo hidden: true description: Whether the add and setLayout methods throw exceptions when invoked.
Class JWindow, void windowInit()

Called by the constructors to init the JWindow properly.
Class JWindow, AccessibleContext accessibleContext

The accessible context property.
Class JWindow, JRootPane rootPane

The JRootPane instance that manages the contentPane and optional menuBar for this frame as well as the glassPane. @see #getRootPane @see #setRootPane
Class JWindow, boolean rootPaneCheckingEnabled

If true then calls to add and setLayout will cause an exception to be thrown. @see #isRootPaneCheckingEnabled @see #setRootPaneCheckingEnabled

Class KeyStroke

A KeyStroke instance represents a key being typed on the keyboard -- it contains both a char code for the key and a modifier (alt shift ctrl meta or a combination).

KeyStroke objects are used to define high-level (semantic) action events. Instead of trapping every keystroke and throwing away the ones you are not interested in those keystrokes you care about automatically initiate actions on the components they are registered with.

KeyStroke objects handle both character-code generating keystrokes you would trap with a KeyTyped event handler and key-code generating keystrokes (like Enter or F1) that you would trap with a KeyPressed event handler.

KeyStroke objects are immutable and unique.

All KeyStroke objects are cached. To get one use getKeyStroke.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JComponent#registerKeyboardActionjavax.swing.text.Keymap @see #getKeyStroke @version 1.31 1137 02/1002/9800 @author Arnaud Weber

Class KeyStroke, KeyStroke getKeyStroke(char)

Return a shared instance of a key stroke that is activated when the key is pressed (i.e.that is a KeyStroke for the KeyEvent.KEY_TYPED event). @param keyChar the character value for a keyboard key @return a KeyStroke object for that key

Class ListCellRenderer

Identifies components that can be used as "rubber stamps" to paint the cells in a JList. For example to use a JLabel as a ListCellRenderer you would write something like this:
 class MyCellRenderer extends JLabel implements ListCellRenderer { public MyCellRenderer() { setOpaque(true); } public Component getListCellRendererComponent( JList list Object value int index boolean isSelected boolean cellHasFocus) { setText(value.toString()); setBackground(isSelected Color.red : Color.white); setForeground(isSelected Color.white : Color.black); return this; } } 
@see JList @see DefaultListCellRenderer @version 1.12 0814 02/2602/9800 @author Hans Muller

Class ListSelectionModel

This interface represents the current state of the selection for any of the components that display a list of values with stable indices. The selection is modeled as a set of intervals each interval represents a contiguous range of selected list elements. The methods for modifying the set of selected intervals all take a pair of indices index0 and index1 that represent a closed interval i.e. the interval includes both index0 and index1. @version 1.15 1017 02/2102/9800 @author Hans Muller @author Philip Milne @see DefaultListSelectionModel

Class LookAndFeel

Completely characterizes a look and feel from the point of view of the pluggable look and feel components. @version 1.18 0824 02/2602/9800 @author Tom Ball @author Hans Muller
Class LookAndFeel, KeyBinding[] makeKeyBindings(Object[])

Convenience method for building lists of KeyBindings.

Return an array of KeyBindings one for each KeyStroke Action pair in keyBindingList. A KeyStroke can either be a string in the format specified by the private parseKeyStrokeKeyStroke.getKeyStroke method or a KeyStroke object.

Actions are strings. Here's an example:

 JTextComponent.KeyBinding[] multilineBindings = makeKeyBindings( new Object[] { "UP" DefaultEditorKit.upAction "DOWN" DefaultEditorKit.downAction "PAGE_UP" DefaultEditorKit.pageUpAction "PAGE_DOWN" DefaultEditorKit.pageDownAction "ENTER" DefaultEditorKit.insertBreakAction "TAB" DefaultEditorKit.insertTabAction }); 
@param keyBindingList an array of KeyStroke Action pairs @return an array of KeyBindings

Class MenuElement

Any component that can be placed into a menu should implement this interface. This interface is used by MenuSelection to handle selection and navigation in menu hierarchies. @version 1.6 088 02/2602/9800 @author Arnaud Weber

Class MenuSelectionManager

A MenuSelectionManager owns the selection in menu hierarchy. @version 1.20 1123 02/2002/9800 @author Arnaud Weber

Class MutableComboBoxModel

A mutable version of ComboBoxModel. @version 1.5 088 02/2602/9800 @author Tom Santos
Class MutableComboBoxModel, void addElement(Object)

Adds an item to the end of the model. @param obj the Object to be added
Class MutableComboBoxModel, void insertElementAt(Object, int)

Adds an item at a specific index @param obj the Object to be added @param index location to add the object
Class MutableComboBoxModel, void removeElement(Object)

AddsRemoves an item tofrom the endmodel. @param ofobj the model.Object to be removed
Class MutableComboBoxModel, void removeElementAt(int)

Removes an item at a specific index @param index location of object to be removed

Class OverlayLayout

A layout manager to arrange components over the top of each other. The requested size of the container will be the largest requested size of the children taking alignment needs into consideration. The alignment is based upon what is needed to properly fit the children in the allocation area. The children will be placed such that their alignment points are all on top of each other.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.17 0819 02/2802/9800 @author Timothy Prinzing


Class ProgressMonitor

A class to monitor the progress of some operation. If it looks like itthe operation will take a while a progress dialog will be popped up. When the ProgressMonitor is created it is given a numeric range and a descriptive string. As the operation progresses call the setProgress method to indicate how far along the [min max] range the operation is. Initially there is no ProgressDialog. After the first millisToDecideToPopup milliseconds (default 500) the progress monitor will predict how long the operation will take. If it is longer than millisToPopup (default 2000 2 seconds) a ProgressDialog will be popped up.

From time to time when the Dialog box is visible the progress bar will be updated when setProgress is called. setProgress won't always update the progress bar it will only be done if the amount of progress is visibly significant.

For further documentation and examples see How to Monitor Progress a section in The Java Tutorial. @see ProgressMonitorInputStream @author James Gosling @version 1.18 1022 02/2102/9800

Class ProgressMonitor, constructor ProgressMonitor(Component, Object, String, int, int)

Constructs a graphic object that shows progress typically by filling in a rectangular bar as the process nears completion. @param parentComponent the parent component for the dialog box @param message a descriptive message that will be shown to the user to indicate what operation is being monitored. This does not change as the operation progresses. See the message parameters to methods in JOptionsPaneJOptionPane#message for the range of values. @param note a short note describing the state of the operation. As the operation progresses you can call setNote to change the note displayed. This is used for example in operations that iterate through a list of files to show the name of the file being processes. If note is initially null there will be no note line in the dialog box and setNote will be ineffective @param min the lower bound of the range @param max the upper bound of the range @see JDialog @see JOptionPane

Class ProgressMonitorInputStream

Monitors the progress of reading from some InputStream. This ProgressMonitor is normally invoked in roughly this form:
 InputStream in = new BufferedInputStream( new ProgressMonitorInputStream( parentComponent "Reading " + fileName new FileInputStream(fileName))); 

This creates a progress monitor to monitor the progress of reading the input stream. If it's taking a while a ProgressDialog will be popped up to inform the user. If the user hits the Cancel button an InterruptedIOException will be thrown on the next read. All the right cleanup is done when the stream is closed.

For further documentation and examples see How to Monitor Progress a section in The Java Tutorial. @see ProgressMonitor @see JOptionPane @author James Gosling @version 1.13 1016 02/2002/9800


Class Renderer

Defines the requirements for an object responsible for "rendering" (displaying) a value. @version 1.7 089 02/2602/9800 @author Arnaud Weber

Class RepaintManager

This class manages repaint requests allowing the number of repaints to be minimized for example by collapsing multiple requests into a single repaint for members of a component tree. @version 1.35 0439 02/2202/9900 @author Arnaud Weber

Class RootPaneContainer

This interface is implemented by components that have a single JRootPane child: JDialog JFrame JWindow JApplet JInternalFrame. The methods in this interface are just covers for the JRootPane properties e.g. getContentPane() is generally implemented like this:
 public Container getContentPane() { return getRootPane().getContentPane(); } 
This interface serves as a marker for Swing GUI builders that need to treat components like JFrame that contain a single JRootPane specially. For example in a GUI builder dropping a component on a RootPaneContainer would be interpreted as frame.getContentPane().add(child). @see JRootPane @see JFrame @see JDialog @see JWindow @see JApplet @see JInternalFrame @version 1.9 0811 02/2602/9800 @author Hans Muller

Class ScrollPaneConstants

Constants used with the JScrollPane component. @version 1.11 0814 02/2602/9800 @author Hans Muller

Class ScrollPaneLayout

The layout manager used by JScrollPane. JScrollPaneLayout is responsible for nine components: a viewport two scrollbars a row header a column header and four "corner" components.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see JScrollPane @see JViewport @version 1.34 0447 02/2202/9900 @author Hans Muller

Class ScrollPaneLayout, void addLayoutComponent(String, Component)

Adds the specified component to the layout. The layout is identified using one of:
  • JScrollPane.VIEWPORT
  • JScrollPane.VERTICAL_SCROLLBAR
  • JScrollPane.HORIZONTAL_SCROLLBAR
  • JScrollPane.ROW_HEADER
  • JScrollPane.COLUMN_HEADER
  • JScrollPane.LOWER_LEFT_CORNER
  • JScrollPane.LOWER_RIGHT_CORNER
  • JScrollPane.UPPER_LEFT_CORNER
  • JScrollPane.UPPER_RIGHT_CORNER
@param s the component identifier @param comp the the component to be added
Class ScrollPaneLayout, Component addSingletonComponent(Component, Component)

The method used to replaceremove an existing component (if any) with a new one. Used to add each different kind of component toSince a JScrollPane since there can be one and only one left corner vertical scrollbar and so on. So only one of each subcomponent is allowed the old one is removed (if it exists) when a new one is added.

This method returns newC. If oldC is not equal to newC and is non-null it will be removed from its parent. @param oldC the Component to replace @param newC the Component to add @return the newC

Class ScrollPaneLayout, JScrollBar getHorizontalScrollBar()

Returns the JScrollbarJScrollBar object that handles horizontal scrolling. @return the JScrollbarJScrollBar object that handles horizontal scrolling @see JScrollPane#getHorizontalScrollBar
Class ScrollPaneLayout, JScrollBar getVerticalScrollBar()

Returns the JScrollbarJScrollBar object that handles vertical scrolling. @return the JScrollbarJScrollBar object that handles vertical scrolling @see JScrollPane#getVerticalScrollBar
Class ScrollPaneLayout, JScrollBar hsb

The scrollpanes horizontal scrollbar child. Default is a JScrollBar. @see JScrollPane#setHorizontalScrollbarsetHorizontalScrollBar
Class ScrollPaneLayout, JScrollBar vsb

The scrollpanes vertical scrollbar child. Default is a JScrollBar. @see JScrollPane#setVerticalScrollbarsetVerticalScrollBar

Class Scrollable

An interface that provides information to a scrolling container like JScrollPane. A complex component that's likely to be used as a viewin a JScrollPane viewport (or other scrolling container) should implement this interface. @see JViewport @see JScrollPane @see JScrollBar @version 1.4 086 02/2602/9800 @author Hans Muller

Class SizeRequirements

For the convenience of layout managers calculates information about the size and position of components. All size and position calculation methods are class methods that take arrays of SizeRequirements as arguments. The SizeRequirements class supports two types of layout:
tiled
The components are placed end-to-end starting at coordinate 0 (the leftmost or topmost position).
aligned
The components are aligned as specified by each component's X or Y alignment value.

Each SizeRequirements object contains information about either the width (and X alignment) or height (and Y alignment) of a single component or a group of components:

minimum
The smallest reasonable width/height of the component or component group in pixels.
preferred
The natural width/height of the component or component group in pixels.
maximum
The largest reasonable width/height of the component or component group in pixels.
alignment
The X/Y alignment of the component or component group.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see Component#getMinimumSize @see Component#getPreferredSize @see Component#getMaximumSize @see Component#getAlignmentX @see Component#getAlignmentY @version 1.24 1026 02/2002/9800 @author Timothy Prinzing


Class SwingConstants

A collection of constants generally used for positioning and orienting components on the screen. @version 1.9 0811 02/2602/9800 @author Jeff Dinkins @author Ralph Kar (orientation support)

Class SwingUtilities

A collection of utility methods for Swing. @version 1.80 0494 02/2202/9900 @author unknown
Class SwingUtilities, Rectangle computeIntersection(int, int, int, int, Rectangle)

Convenience to calculate anthe intersection of two rectangles without allocating a new rectangle. ReturnIf destthe two rectangles don't intersect then the returned rectangle begins at (0 0) and has zero width and height. @param x the X coordinate of the first rectangle's top-left point @param y the Y coordinate of the first rectangle's top-left point @param width the width of the first rectangle @param height the height of the first rectangle @param dest the second rectangle @return dest modified to specify the intersection
Class SwingUtilities, MouseEvent convertMouseEvent(Component, MouseEvent, Component)

Returns a MouseEvent similar to sourceEvent except that its x and y members have been converted to destination's coordinate system. If source is null sourceEvent x and y members are assumed to be into destination's root component coordinate system. If destination is null the returned MouseEvent will be in source's coordinate system. sourceEvent will not be changed. A new event is returned. the source field of the returned event will be set to destination if destination is non null use the translateMouseEvent() method to translate a mouse event from one component to another without changing the source.
Class SwingUtilities, Accessible getAccessibleChild(Component, int)

Return the nth Accessible child of the object.

Note: as of the Java 2 platform v1.3 it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead of using this method. @param i zero-based index of child @return the nth Accessible child of the object

Class SwingUtilities, int getAccessibleChildrenCount(Component)

Returns the number of accessible children in the object. If all of the children of this object implement Accessible than this method should return the number of children of this object.

Note: as of the Java 2 platform v1.3 it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead of using this method. @return the number of accessible children in the object.

Class SwingUtilities, int getAccessibleIndexInParent(Component)

Get the index of this object in its accessible parent.

Note: as of the Java 2 platform v1.3 it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead of using this method. @return -1 of this object does not have an accessible parent. Otherwise the index of the child in its accessible parent.

Class SwingUtilities, AccessibleStateSet getAccessibleStateSet(Component)

Get the state of this object.

Note: as of the Java 2 platform v1.3 it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead of using this method. @return an instance of AccessibleStateSet containing the current state set of the object @see AccessibleState

Class SwingUtilities, void invokeAndWait(Runnable)

Causes doRun.run() to be executed synchronously on the AWT event dispatching thread. This call will block until all pending AWT events have been processed and (then) doRun.run() returns. This method should be used when an application thread needs to update the GUI. It should not be called from the EventDispatchThread. Here's an example that creates a new application thread that uses invokeAndWait() to print a string from the event dispatching thread and then when that's finished print a string from the application thread.
 final Runnable doHelloWorld = new Runnable() { public void run() { System.out.println("Hello World on " + Thread.currentThread()); } }; Thread appThread = new Thread() { public void run() { try { SwingUtilities.invokeAndWait(doHelloWorld); } catch (Exception e) { e.printStackTrace(); } System.out.println("Finished on " + Thread.currentThread()); } }; appThread.start(); 
Note that if the Runnable.run() method throws an uncaught exception (on the event dispatching thread) it's caught and rethrown as an InvocationTargetException on the callers thread.

Additional documentation and examples for this method can be found in How to Use Threads in The Java Tutorial.

As of 1.3 this method is just a cover for java.awt.EventQueue.invokeAndWait(). @exception InterruptedException Ifif we're interrupted while waiting for the event dispatching thread to finish excecuting doRun.run() @exception InvocationTargetException Ifif doRun.run() throws @see #invokeLater

Class SwingUtilities, void invokeLater(Runnable)

Causes doRun.run() to be executed asynchronously on the AWT event dispatching thread. This will happen after all pending AWT events have been processed. This method should be used when an application thread needs to update the GUI. In the following example the invokeAndWait()invokeLater callscall queues the doHelloWorld Runnable forobject doHelloWorld on the event dispatching thread and then prints a message.
 Runnable doHelloWorld = new Runnable() { public void run() { System.out.println("Hello World on " + Thread.currentThread()); } }; SwingUtilities.invokeAndWaitinvokeLater(doHelloWorld); System.out.println("WaitingThis ...might well be displayed before the other message."); 
If invokeAndWaitinvokeLater is called from the event dispatching thread e.g.-- for example from a JButtonsJButton's ActionListener -- the doRun.run() will still be deferred tilluntil all pending events have been processed. Note that if the doRun.run() throws an uncaught exception the event dispatching thread will unwind (not the current thread).

Additional documentation and examples for this method can be found in How to Use Threads in The Java Tutorial.

As of 1.3 this method is just a cover for java.awt.EventQueue.invokeLater(). @see #invokeAndWait

Class SwingUtilities, boolean isEventDispatchThread()

Returns true if the current thread is an AWT event dispatching thread.

As of 1.3 this method is just a cover for java.awt.EventQueue.isEventDispatchThread(). @return true if the current thread is an AWT event dispatching thread

Class SwingUtilities, void updateComponentTreeUI(Component)

A simple minded look and feel change: ask each node in the tree to updateUI() i.e.-- that is to initialize its UI property with the current look and feel.

Class Timer

ObjectCauses subclass that causes an action to occur at a predefined rate. For example an animation object can use a Timer as the trigger for drawing its next frame. For documentation and examples of using timers see How to Use Timers in The Java Tutorial.

Each Timer has a list of ActionListeners and a delay ( the time between actionPerfomedactionPerformed() calls). When delay milliseconds have passed a Timer sends the actionPerformed() message to its listeners. This cycle repeats until stop() is called or halts immediately if the JimerTimer is configured to send its message just once.

Using a Timer involves first creating it then starting it using the start() method.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.28 0432 02/2202/9900 @author Dave Moore


Class ToolTipManager

Manages all the ToolTips in the system. @see JComponent#createToolTip @version 1.40 0444 06/2201/99 @author Dave Moore @author Rich Schiavi
Class ToolTipManager, void registerComponent(JComponent)

Register a component for tooltip management.

This will register key bindings to show and hide the tooltip text only if component has focus bindings. This is done so that components that are not normally focus traversable such as JLabel are not made focus traversable as a result of invoking this method. @param component a JComponent object @see JComponent#isFocusTraversable

Class ToolTipManager, void setDismissDelay(int)

Specifies the dismisal delay value. @param microSecondsmilliseconds an int specifying the number of microsecondsmilliseconds to delay (after the cursor has moved on) before taking away the tooltip @see #getDismissDelay
Class ToolTipManager, void setInitialDelay(int)

Specifies the initial delay value. @param microSecondsmilliseconds an int specifying the number of microsecondsmilliseconds to delay (after the cursor has paused) before displaying the tooltip @see #getInitialDelay
Class ToolTipManager, void setLightWeightPopupEnabled(boolean)

When displaying the JToolTip the ToolTipManager choose to use a light weight JPanel if it fits. This method allows you to disable this feature. You have to do disable it if your application mixes light weight and heavy weights components. @deprecated As of Swing1.1 replaced by setToolTipWindowUsePolicy(int).
Class ToolTipManager, void setReshowDelay(int)

Specifies the time to delay before reshowing the tooltip. @param microSecondsmilliseconds an int specifying the time in microsecondsmilliseconds to delay before reshowing the tooltip if the cursor stops again @see #getReshowDelay

Class UIDefaults

A table of defaults for Swing components. Applications can set/get default values via the UIManager.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @see UIManager @version 1.31 0437 02/2202/9900 @author Hans Muller


Class UIDefaults.ActiveValue

This class enables one to store an entry in the defaults table that's constructed each time it's looked up with one of the getXXX(key) methods. Here's an example of an ActiveValue that constructs a DefaultListCellRenderer:
 Object cellRendererActiveValue = new UIDefaults.ActiveValue() { public Object createValue(UIDefaults table) { return new DefaultListCellRenderer(); } }; uiDefaultsTable.put("MyRenderer" cellRendererActiveValue); 
@see UIDefaults#get
Class UIDefaults.ActiveValue, Object createValue(UIDefaults)

Creates the value retrieved from the UIDefaults table. The object is created each time it is accessed. @param table a UIDefaults table @return the created Object

Class UIDefaults.LazyValue

This class enables one to store an entry in the defaults table that isn't constructed until the first time it's looked up with one of the getXXX(key) methods. Lazy values are useful for defaults that are expensive to construct or are seldom retrieved. The first time a LazyValue is retrieved its "real value" is computed by calling LazyValue.createValue() and the real value is used to replace the LazyValue in the UIDefaults table. Subsequent lookups for the same key return the real value. Here's an example of a LazyValue that constructs a Border:
 Object borderLazyValue = new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { return new BorderFactory.createLoweredBevelBorder(); } }; uiDefaultsTable.put("MyBorder" borderLazyValue); 
@see UIDefaults#get
Class UIDefaults.LazyValue, Object createValue(UIDefaults)

Creates the actual value retrieved from the UIDefaults table. When an object that implements this interface is retrieved from the table this method is used to create the real value which is then stored in the table and returned to the calling method. @param table a UIDefaults table @return the created Object

Class UIDefaults, constructor UIDefaults(Object[])

Create a defaults table initialized with the specified key/value pairs. For example:
 Object[] uiDefaults = { "Font" new Font("Dialog" Font.BOLD 12) "Color" Color.red "five" new Integer(5) } UIDefaults myDefaults = new UIDefaults(uiDefaults); 
@param keyValueList an array of objects containing the key/value pairs
Class UIDefaults, void addPropertyChangeListener(PropertyChangeListener)

AddAdds a PropertyChangeListener to the listener list. The listener is registered for all properties.

A PropertyChangeEvent will get fired whenever a default is changed. @param listener Thethe PropertyChangeListener to be added @see java.beans.PropertyChangeSupport

Class UIDefaults, void firePropertyChange(String, Object, Object)

Support for reporting bound property changes. If oldValue and newValue are not equal and the PropertyChangeEventx listener list isn't empty then fire a PropertyChange event to each listener. @param propertyName Thethe programmatic name of the property that was changed. @param oldValue Thethe old value of the property. @param newValue Thethe new value of the property. @see java.beans.PropertyChangeSupport
Class UIDefaults, Object get(Object)

Returns the value for key. If the value is a UIDefaults.LazyValue then the real value is computed with LazyValue.createValue() the table entry is replaced and the real value is returned. If the value is an UIDefaults.ActiveValue the table entry is not replaced - the value is computed with ActiveValue.createValue() for each get() call. @param key the desired key @return the value for key @see LazyValue @see ActiveValue @see java.util.Hashtable#get
Class UIDefaults, Border getBorder(Object)

If the value of key is a Border return it otherwise return null. @param key the desired key @return if the value for key is a Border return the Border object; otherwise return null
Class UIDefaults, Color getColor(Object)

If the value of key is a Color return it otherwise return null. @param key the desired key @return if the value for key is a Color return the Color object; otherwise return null
Class UIDefaults, Dimension getDimension(Object)

If the value of key is a Dimension return it otherwise return null. @param key the desired key @return if the value for key is a Dimension return the Dimension object; otherwise return null
Class UIDefaults, Font getFont(Object)

If the value of key is a Font return it otherwise return null. @param key the desired key @return if the value for key is a Font return the Font object; otherwise return null
Class UIDefaults, Icon getIcon(Object)

If the value of key is an Icon return it otherwise return null. @param key the desired key @return if the value for key is an Icon return the Icon object; otherwise return null
Class UIDefaults, Insets getInsets(Object)

If the value of key is aan Insets return it otherwise return null. @param key the desired key @return if the value for key is an Insets return the Insets object; otherwise return null
Class UIDefaults, int getInt(Object)

If the value of key is aan Integer return its integer value otherwise return 0. @param key the desired key @return if the value for key is an Integer return its value otherwise return 0
Class UIDefaults, String getString(Object)

If the value of key is a String return it otherwise return null. @param key the desired key @return if the value for key is a String return the String object; otherwise return null
Class UIDefaults, ComponentUI getUI(JComponent)

CreateCreates an ComponentUI implementation for the specified component. In other words create the look and feel specific delegate object for target. This is done in two steps:
  • LookupLook up the name of the ComponentUI implementation class under the value returned by target.getUIClassID().
  • Use the implementation classes static createUI() method to construct a look and feel delegate.
@param target the JComponent which needs a UI @return the ComponentUI object
Class UIDefaults, Class getUIClass(String)

Returns the L&F class that renders this component. @param uiClassID a string containing the class ID @return the Class object returned by getUIClass(uiClassID null)
Class UIDefaults, Class getUIClass(String, ClassLoader)

The value of get(uidClassID) must be the String name of a class that implements the corresponding ComponentUI class. If the class hasn't been loaded before this method looks up the class with uiClassLoader.loadClass() if a non null class loader is provided classForName() otherwise.

If a mapping for uiClassID exists or if the specified class can't be found return null.

This method is used by getUI it's usually not neccessary to call it directly. @param uiClassID a string containing the class ID @param uiClassLoader the object which will load the class @return Thethe value of Class.forName(get(uidClassID)). @see #getUI

Class UIDefaults, void getUIError(String)

If getUI() fails for any reason it calls this method before returning null. Subclasses may choose to do more or less here. @param msg Messagemessage string to print. @see #getUI
Class UIDefaults, Object put(Object, Object)

SetSets the value of key to value. If key is a string and the new value isn't equal to the old one fire a PropertyChangeEvent. If value is null the key is removed from the table. @param key the unique Object who's value will be used to retreiveretrieve the data value associated with it @param value the new Object to store as data under that key @return the previous Object value or null @see #putDefaults @see java.util.Hashtable#put
Class UIDefaults, void putDefaults(Object[])

PutPuts all of the key/value pairs in the database and unconditionally generategenerates one PropertyChangeEvent. The events oldValue and newValue will be null and its propertyName will be "UIDefaults". @param keyValueList an array of key/value pairs @see #put @see java.util.Hashtable#put
Class UIDefaults, void removePropertyChangeListener(PropertyChangeListener)

RemoveRemoves a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. @param listener Thethe PropertyChangeListener to be removed @see java.beans.PropertyChangeSupport

Class UIManager

This class keeps track of the current look and feel and its defaults.

We manage three levels of defaults: user defaults look and feel defaults system defaults. A call to UIManager.get() checks all three levels in order and returns the first non-null value for a key if any. A call to UIManager.put() just affects the user defaults. Note that a call to setLookAndFeel() doesn't affect the user defaults it just replaces the middle defaults "level".

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.74 0583 02/2802/9900 @author Thomas Ball @author Hans Muller

Class UIManager, String getCrossPlatformLookAndFeelClassName()

Returns the name of the LookAndFeel class that implements the default cross platform look and feel i.e.-- the "Java Look and Feel" or (JLF). @return a string with the JLF implementation-class @see #setLookAndFeel @see #getSystemLookAndFeelClassName
Class UIManager, LookAndFeelInfo[] getInstalledLookAndFeels()

Return an array of objects that provide some information about the LookAndFeel implementations that have been installed with this javasoftware development kit. The LookAndFeel info objects can be used by an application to construct a menu of look and feel options for the user or to set the look and feel at start up time. Note that we do not return the LookAndFeel classes themselves here to avoid the cost of unnecessarily loading them.

Given a LookAndFeelInfo object one can set the current look and feel like this:

 UIManager.setLookAndFeel(info.getClassName()); 
@see #setLookAndFeel
Class UIManager, Object put(Object, Object)

Stores an object in the defaults table. @param key an Object specifying the retrieval key @param value the Object to store @return the Object returned by UIDefaults.#put

Class UnsupportedLookAndFeelException

An exception that indicates the request look & feel management classes are not present on the user's system.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @author unattributed @version 1.10 0812 02/2802/9800


Class ViewportLayout

The default layout manager for JViewport. JViewportLayoutViewportLayout defines a policy for layout that should be useful for most applications. The viewport makes its view the same size as the viewport however it will not make the view smaller than its minimum size. As the viewport grows the view is kept bottom justified until the entire view is visible subsequently the view is kept top justified.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence. @version 1.27 0429 02/2202/9900 @author Hans Muller

Class ViewportLayout, void layoutContainer(Container)

Called by the AWT when the specified container needs to be laid out. @param parent the container to lay out @exception AWTError if the target isn't the container specified to the BoxLayout constructor
Class ViewportLayout, Dimension minimumLayoutSize(Container)

Returns the minimum dimensions needed to layout the components contained in the specified target container. @param target the component which needs to be laid out @return a Dimension object containing the minimum dimensions @see #preferredLayoutSize
Class ViewportLayout, Dimension preferredLayoutSize(Container)

Returns the preferred dimensions for this layout given the components in the specified target container. @param target the component which needs to be laid out @return a Dimension object containing the preferred dimensions @see #minimumLayoutSize

Class WindowConstants

Constants used to control the window-closing operation. The setDefaultCloseOperation and getDefaultCloseOperation methods provided by JFrame JInternalFrame and JDialog use these constants. For exampleexamples of setting the default window-closing operation see JFrame#setDefaultCloseOperationResponding to Window-Closing Events a section in The Java Tutorial. @version 1.8 1113 02/1302/9800 @author Amy Fowler