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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.41 0246 12/0203/0001 @author Georges Saab @see Action


Class AbstractButton

Defines common behaviors for buttons and menu items. For further information see How to Use Buttons Check Boxes and 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.133 02153 12/0903/01 @author Jeff Dinkins


Class AbstractButton.AccessibleAbstractButton

This 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class AbstractButton.ButtonChangeListener

Extends 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class AbstractButton, void configurePropertiesFromAction(Action)

Factory method which sets the ActionEvent source's properties according to values from the Action instance. The properties which are set may differ for subclasses. By default the properties which get set are Text Icon Enabled ToolTipText ActionCommand and Mnemonic.

If the Action passed in is null the following things will occur:

@param a the Action from which to get the properties or null @since 1.3 @see Action @see #setAction
Class AbstractButton, void fireActionPerformed(ActionEvent)

Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fireevent methodparameter. @param eevent the ActionEvent object @see EventListenerList
Class AbstractButton, void fireItemStateChanged(ItemEvent)

Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fireevent methodparameter. @param event the ItemEvent object @see EventListenerList
Class AbstractButton, void fireStateChanged()

Notifies 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 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 necesarynecessary) by the L&F. --> @return the disabledSelectedIcon property @see #getPressedIcon @see #setDisabledIcon
Class AbstractButton, int getHorizontalTextPosition()

Returns the horizontal position of the text relative to the icon. @return the horizontalTextPosition property one of the following values:
Class AbstractButton, boolean isBorderPainted()

ReturnsGets whether the border shouldborderPainted be paintedproperty. @return true if the border shouldvalue be paintedof the falseborderPainted otherwiseproperty @see #setBorderPainted
Class AbstractButton, boolean isContentAreaFilled()

ChecksGets whether the "content area" of the button should becontentAreaFilled filledproperty. @return the contentAreaFilled property @see #setFocusPaintedsetContentAreaFilled
Class AbstractButton, boolean isFocusPainted()

ReturnsGets whether focus shouldthe bepaintFocus paintedproperty. @return the paintFocus property @see #setFocusPainted
Class AbstractButton, boolean isFocusTraversable()

IdentifiesReturns whether or not this componentComponent can receivebecome the focus owner. @return true if this componentComponent canis receivefocusable; thefalse focusotherwise @see #setFocusable @since JDK1.1 @deprecated As of 1.4 replaced by isFocusable().
Class AbstractButton, boolean isRolloverEnabled()

ChecksGets whether rollover effectsthe arerolloverEnabled enabledproperty. @return the value of the rolloverEnabled property @see #setFocusPaintedsetRolloverEnabled
Class AbstractButton, void paintBorder(Graphics)

Paint the button's border if BorderPainted property is true and the button has a border. @param g the Graphics context in which to paint @see #paint @see #setBorder
Class AbstractButton, void setBorderPainted(boolean)

Sets whetherthe borderPainted property. If true and the button has a border should bethe border is painted. The default value for the borderPainted property is true. @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 whetherthe contentAreaFilled property. If true the button shouldwill paint the content area or leave it transparent. If you wish to have a transparent button for example andsuch as an icon only button for example then you should set this to false. Do not call setOpaque(false). Whether theThe default buttonvalue for followsthe the RepaintManagercontentAreaFilled's concept of opacityproperty is L&F depandanttrue.

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 effectsthe content should be paintedfilled; if false the content area is not filled @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 setFocusPainted(boolean)

Sets whetherthe paintFocus property which must be true for the focus shouldstate to be painted. The default value for the paintFocus property is true. Some look and feels might not paint focus state; they will ignore this property. @param b if true the focus state isshould be painted @see #isFocusPainted @beaninfo bound: true attribute: visualUpdate true description: Whether focus should be painted
Class AbstractButton, void setHorizontalTextPosition(int)

Sets the horizontal position of the text relative to the icon. @param textPosition one of the following values: @exception IllegalArgumentException if textPosition is not one of the legal values listed above @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 position of the text relative to the icon.
Class AbstractButton, void setMnemonic(char)

SpecifiesThis method is now obsolete please use setMnemonic(int) to set the mnemonic valuefor a button. This method is only designed to handle character values which fall between 'a' and 'z' or 'A' and 'Z'. @param mnemonic a char specifying the mnemonic value @see #setMnemonic(int) @beaninfo bound: true attribute: visualUpdate true description: the keyboard character mnemonic
Class AbstractButton, void setMnemonic(int)

Sets the keyboard mnemonic on the current model. The mnemonic is the key which when combined with the look and feel's mouseless modifier (usually Alt) will activate this button if focus is contained somewhere within this button's ancestor window.

A mnemonic must correspond to a single key on the keyboard and should be specified using one of the VK_XXX keycodes defined in java.awt.event.KeyEvent. Mnemonics are case-insensitive therefore a key event with the corresponding keycode would cause the button to be activated whether or not the Shift modifier was pressed.

If the character defined by the mnemonic is found within the button's label string the first occurrence of it will be underlined to indicate the mnemonic to the user. If the corresponding character is not contained within the button's label then it will be displayed near the label in a look and feel dependent manner (commonly to the right surrounded by parenthesis). @param mnemonic the key code which represents the mnemonic @see java.awt.event.KeyEvent @beaninfo bound: true attribute: visualUpdate true description: the keyboard character mnemonic

Class AbstractButton, void setRolloverEnabled(boolean)

Sets whetherthe rolloverEnabled property which must be true for rollover effects shouldto beoccur. enabledThe default value for the rolloverEnabled property is false. Some look and feels might not implement rollover effects; they will ignore this property. @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 setUI(ButtonUI)

Sets the L&F object that renders this component. @param ui the ButtonUI L&F object @see #getUI @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the LookAndFeel.
Class AbstractButton, void updateUI()

NotificationResets from the UIFactoryUI property thatto a value from the L&Fcurrent look has changedand feel. 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 CONTENT_AREA_FILLED_CHANGED_PROPERTY

Identifies a change from rolloverto enabled to disabled or back to enabledhaving the button paint the content area.
Class AbstractButton, String ROLLOVER_ENABLED_CHANGED_PROPERTY

Identifies a change in thefrom rollover button'senabled to disabled or back to enabled.

Class AbstractCellEditor

@version 1.4 028 12/0203/0001 A base class for CellEditors providing default implementations for the methods in the CellEditor interface except getCellEditorValue(). Like the other abstract implementations in Swing also manages a list of 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @author Philip Milne


Class AbstractListModel

The Abstractabstract definition for the data model thethat 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.22 0230 12/0203/0001 @author Hans Muller

Class AbstractListModel, void addListDataListener(ListDataListener)

AddAdds a listener to the list that's notified each time a change to the data model occurs. @param l the ListDataListener to be added
Class AbstractListModel, void fireContentsChanged(Object, int, int)

AbstractListModel subclasses must call this method after one or more elements of the list change. The changed elements are specified by athe closed interval index0 index1 i.e.-- the range that includes both index0endpoints and index1are included. Note that index0 need not be less than or equal to index1. @param source Thethe ListModel that changed typically "this". @param index0 Oneone end of the new interval. @param index1 Thethe other end of the new interval. @see EventListenerList @see DefaultListModel
Class AbstractListModel, void fireIntervalAdded(Object, int, int)

AbstractListModel subclasses must call this method after one or more elements are added to the model. The new elements are specified by a closed interval index0 index1 i.e.-- the range that includesenpoints both index0 andare index1included. Note that index0 need not be less than or equal to index1. @param source Thethe ListModel that changed typically "this". @param index0 Oneone end of the new interval. @param index1 Thethe other end of the new interval. @see EventListenerList @see DefaultListModel
Class AbstractListModel, void fireIntervalRemoved(Object, int, int)

AbstractListModel subclasses must call this method after one or more elements are removed from the model. The new elements are specified by a closed interval index0 index1 i.e. the range that includes both index0 and index1. Note that index0 need not be less than or equal to index1. @param source Thethe ListModel that changed typically "this". @param index0 Oneone end of the new interval. @param index1 Thethe other end of the new interval. @see EventListenerList @see DefaultListModel
Class AbstractListModel, EventListener[] getListeners(Class)

ReturnReturns an array of all the objects currently registered as FooListeners upon this model. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal such as FooListener.class. For example you can query a list model m for its list data listeners ofwith the givenfollowing typecode: that

ListDataListener[] ldls = (ListDataListener[])(m.getListeners(ListDataListener.class));
wereIf addedno such tolisteners exist this modelmethod returns an empty array. @returnsparam alllistenerType the type of thelisteners requested; this parameter should specify an interface that descends from java.util.EventListener @return an array of all objects recievingregistered as listenerTypeFooListeners notificationson from this model or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @see #getListDataListeners @since 1.3
Class AbstractListModel, void removeListDataListener(ListDataListener)

RemoveRemoves a listener from the list that's notified each time a change to the data model occurs. @param l the ListDataListener to be removed

Class Action

The Action interface provides a useful extension to the ActionListener 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:

Certain containers including menus and tool bars know how to add an Action object. When an Action object is added to such a container the container:
  1. Creates a component that is appropriate for that container (a tool 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 intialinitial 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 tool 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 AbstractActio). 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 th is reason you should take care to only use Actions where their benefits are desired and use simple ActionListeners elsewhere. @version 1.2124 0212/0203/0001 @author Georges Saab @see AbstractAction

Class Action, String ACCELERATOR_KEY

The key used for storing a KeyStroke to be used as the accelerator for the action. @since 1.3
Class Action, String MNEMONIC_KEY

The key used for storing an int key code to be used as the mnemonic for the action. @since 1.3

Class ActionMap

ActionMap provides mappings from Objects (called keys or Action names) to Actions. An ActionMap is usually used with an InputMap to locate a particular action when a key is pressed. As with InputMap an ActionMap can have a parent that is searched for keys not defined in the ActionMap.

As with InputMap if you create a cycle eg:

 ActionMap am = new ActionMap(); ActionMap bm = new ActionMap(): am.setParent(bm); bm.setParent(am); 
some of the methods will cause a StackOverflowError to be thrown. @see InputMap @version 1.8 0211 12/0203/0001 @author Scott Violet

Class BorderFactory

Factory class for vending standard Border objects. Wherever 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.23 0225 12/0203/0001 @author David Kloba
Class BorderFactory, TitledBorder createTitledBorder(Border)

Creates 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 (leading) and using the default font and text color. and@param border determined by the current lookBorder andobject feel.to (Theadd Motif and Windows look and feelsthe title to if null the useBorder an etchedis determined border;by The Javathe current look and feel uses a gray border.) @param border thetitle a BorderString object to addcontaining the text of the title to @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.

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.2224 0212/0203/0001 @author Hans Muller @see DefaultBoundedRangeModel

Class BoundedRangeModel, void setRangeProperties(int, int, int, int, boolean)

This method sets all of the model's data with a single method call. The method results in a single change event being generated. This is convenient when you need to adjust all the model data simulaneouslysimultaneously and do not want individual change events to occur. @param value an int giving the current value @param extent an int giving the amount by which the value can "jump" @param min an int giving the minimum value @param max an int giving the maximum value @param isAdjusting a boolean true if a series of changes are in progress @see #setValue @see #setExtent @see #setMinimum @see #setMaximum @see #setValueIsAdjusting

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 futureAs release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see BoxLayout @author Timothy Prinzing @version 1.36 0837 12/0503/0001


Class Box.Filler

An implementation of a lightweight component that participates in layout but has no view.

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class BoxLayout

A layout manager that allows multiple components to be layedlaid 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 (unlikemanager JPanel which defaults to flowis constructed with an axis layout).parameter You can nest multiple boxes and add components tothat specifies the type of layout that will be themdone. to get theThere are four arrangementchoices: you

X_AXIS want.- The BoxLayout manager that places each ofComponents are laid out horizontally from left to itsright.
managed
Y_AXIS components from left to right or- Components are laid out vertically from top to bottom.
When
LINE_AXIS you- Components are laid out the way words are createlaid out in a BoxLayout you specify whetherline based on the itscontainer's majorComponentOrientation axisproperty. isIf the Xcontainer's axisComponentOrientation (whichis meanshorizontal then components are laid out horizontally otherwise they are laid out vertically. For horizontal orientations if the container's ComponentOrientation is left to right placement)then or Y axiscomponents are laid (topout left to bottomright placement).otherwise Componentsthey are arrangedlaid from leftout right to rightleft. (orFor vertical orientations components are always laid out from top to bottom).
in
PAGE_AXIS - Components are laid out the same order as they were addedway text lines are laid out toon a page based on the container's ComponentOrientation property. InsteadIf the ofcontainer's usingComponentOrientation BoxLayout directly many programs use the Boxis horizontal then components are laid out class.vertically The Box class provides aotherwise they are laid out lightweighthorizontally. For horizontal orientations if the container's thatComponentOrientation uses ais left BoxLayoutto right then components are laid out left to right otherwise they are laid out right to left.  Box also provides handyFor vertical orientations components methodsare always laid out from top to helpbottom.
you use BoxLayout

For all welldirections components are arranged in the same order as they were added to the container.

BoxLayout attempts to arrange components at their preferred widths (for left to righthorizontal layout) or heights (for top to bottomvertical layout). For a left to righthorizontal 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 ana 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;. ifIf that fails it aligns them horizontally according to their X alignments. For PAGE_AXIS layout horizontal alignment is done based on the leading edge of the component. In other words an X alignment value of 0.0 means the left edge of a component if the container's ComponentOrientation is left to right and it means the right edge of the component otherwise.

Instead of using BoxLayout directly many programs use the Box class. The Box class is a lightweight container that uses a BoxLayout. It also provides handy methods to help you use BoxLayout well. Adding components to multiple nested boxes is a powerful way to get the arrangement you want.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see Box @see Componentjava.awt.ComponentOrientation @see JComponent#getAlignmentX @see ComponentJComponent#getAlignmentY @author Timothy Prinzing @version 1.2529 0312/0203/01

Class BoxLayout, constructor BoxLayout(Container, int)

Creates a layout manager that will lay out components either left to right or top to bottom as specified inalong the axisgiven parameteraxis. @param target the container that needs to be laid out @param axis the axis to lay out components along. ForCan left-to-rightbe layoutone specifyof: BoxLayout.X_AXIS; for top-to-bottomBoxLayout.Y_AXIS layoutBoxLayout.LINE_AXIS specifyor BoxLayout.YPAGE_AXIS @exception AWTError if the value of axis is invalid

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 any set of objects that inherit from AbstractButton. Typically a button group contains instances of JRadioButton JRadioButtonMenuItem or JToggleButton. It 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 futureAs release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.27 0232 12/0203/0001 @author Jeff Dinkins

Class ButtonGroup, constructor ButtonGroup()

Creates a new ButtonGroup.
Class ButtonGroup, void add(AbstractButton)

Adds the button to the group. @param b the button to be added
Class ButtonGroup, int getButtonCount()

Returns the number of buttons in the group. @return the button count
Class ButtonGroup, Enumeration getElements()

ReturnReturns all the buttons that are participating in this group. @return an Enumeration of the buttons in this group
Class ButtonGroup, ButtonModel getSelection()

ReturnReturns the model of the selected button. @return the selected button model.
Class ButtonGroup, boolean isSelected(ButtonModel)

Returns thewhether a ButtonModel is selected. @return valuetrue forif the button. is selected otherwise returns false
Class ButtonGroup, void remove(AbstractButton)

Removes the button from the group. @param b the button to be removed
Class ButtonGroup, void setSelected(ButtonModel, boolean)

Sets the selected value for the ButtonModel. Only one button in the group may be selected at a time. @param the ButtonModel @param true if this button is to be selected otherwise false

Class ButtonModel

State Model for buttons. This model is used for check boxes and radio buttons which are special kinds of buttons as well as for normal buttons. For check boxes and radio 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 check box or radio 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.23 0224 12/0203/0001 @author Jeff Dinkins

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 approchapproach and provide a companion object which implements the CellEditor interface (See JCellEditor for example). The wrapper approchapproach 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.19 0222 12/0203/0001 @author Alan Chung

Class CellEditor, void addCellEditorListener(CellEditorListener)

AddAdds a listener to the list that's notified when the editor starts stops or cancels editing. @param l the CellEditorListener
Class CellEditor, void cancelCellEditing()

TellTells the editor to cancel editing and not accept any partially edited value.
Class CellEditor, Object getCellEditorValue()

Returns the value contained in the editor. @return the value contained in the editor
Class CellEditor, boolean isCellEditable(EventObject)

AskAsks the editor if it can start editing using anEvent. anEvent is in the invoking component coordinate system. The editor can not assume the Component returned by getCellEditorComponent() is installed. This method is intended for the use of client to avoid the cost of setting up and installing the editor component if editing is not possible. If editing can be started this method returns true. @param anEvent the event the editor should use to consider whether to begin editing or not. @return true if editing can be started. @see #shouldSelectCell
Class CellEditor, void removeCellEditorListener(CellEditorListener)

RemoveRemoves a listener from the list that's notified @param l the CellEditorListener
Class CellEditor, boolean shouldSelectCell(EventObject)

TheReturns return value of shouldSelectCell() is a boolean indicatingtrue whetherif the editing cell should be selected orfalse nototherwise. 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; otherwise returns false @see #isCellEditable
Class CellEditor, boolean stopCellEditing()

TellTells the editor to stop editing and accept any partially edited value as the value of the editor. The editor returns false if editing was not stopped; this is useful for editors which validatesthat validate and can not accept invalid entries. @return true if editing was stopped; false otherwise

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 propogatepropagate 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.34 0836 12/0503/0001 @author Hans Muller

Class CellRendererPane, void invalidate()

Overridden to avoid propogatingpropagating a invalidate up the tree when the cell renderer child is configured.
Class CellRendererPane, void paintComponent(Graphics, Component, Container, int, int, int, int, boolean)

Paint a cell renderer component c on graphics object g. Before the component is drawn it's reparented to this (if that's neccessarynecessary) it's bounds are set to w h and the graphics object is (effectively) translated to x y. If it's a JComponent double buffering is temporarily turned off. After the component is painted it's bounds are reset to -w -h 0 0 so that if it's the last renderer component painted it will not start consuming input. The Container p is the component we're actually drawing on typically it's equal to this.getParent(). If shouldValidate is true the component c will be validated before painted.

Class ComboBoxEditor

The editor component used for JComboBox components. @version 1.10 0211 12/0203/0001 @author Arnaud Weber

Class ComboBoxModel

ComboBoxDataModelA isdata model for a combo box. This interface extends ListDataModel and adds the concept withof a selected item. ThisThe selected item is generally the item which is visible in the model since itcombo box display isarea.

The selected item may not alwaysnecessarily inbe managed by the underlying ListModel. This disjoint behavior allows for the temporary storage and retrieval of a selected item listin the model. @version 1.13 12/03/01 @author Arnaud Weber

Class ComboBoxModel, Object getSelectedItem()

ReturnReturns the selected item @return The selected item or null if there is no selection
Class ComboBoxModel, void setSelectedItem(Object)

Set the selected item. The implementation of this method should notify all registered ListDataListeners that the contents have changed. @param anItem the list object to select or null to clear the selection

Class ComponentInputMap

A ComponentInputMap is an InputMap associated with a particular JComponent. The component is automatically notified whenever the ComponentInputMap changes. ComponentInputMaps are used for WHEN_IN_FOCUSED_WINDOW bindings. @version 1.6 027 12/0203/0001 @author Scott Violet

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.20 0722 12/2603/0001 @author Dave Karlton

Class DebugGraphics, int BUFFERED_OPTION

Show buffered operations in a seperateseparate Frame.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.35 0242 12/0203/0001 @author David Kloba @author Hans Muller @see BoundedRangeModel

Class DefaultBoundedRangeModel, constructor DefaultBoundedRangeModel(int, int, int, int)

Initializes value extent minimum and maximum. Adjusting is false. Throws an IllegalArgumentException if the following constraints aren't satisfied:
 min < value < value+extent < max 
Class DefaultBoundedRangeModel, void addChangeListener(ChangeListener)

Adds a ChangeListener. The change listeners are run each time any one of the Bounded Range model properties changes. @param l the ChangeListener to add @see #removeChangeListener @see BoundedRangeModel#addChangeListener
Class DefaultBoundedRangeModel, void fireStateChanged()

RunRuns each ChangeListenersChangeListener's stateChanged() method. @see #setRangeProperties @see EventListenerList
Class DefaultBoundedRangeModel, int getExtent()

ReturnReturns the model's extent. @return the model's extent @see #setExtent @see BoundedRangeModel#getExtent
Class DefaultBoundedRangeModel, EventListener[] getListeners(Class)

ReturnReturns an array of all the objects currently registered as FooListeners upon this model. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal such as FooListener.class. For example you can query a DefaultBoundedRangeModel instance m for its change listeners ofwith the givenfollowing typecode: that

ChangeListener[] cls = (ChangeListener[])(m.getListeners(ChangeListener.class));
wereIf addedno such listeners toexist this modelmethod returns an empty array. @returnsparam alllistenerType the type of thelisteners requested; this parameter should specify an interface that descends from java.util.EventListener @return an array of all objects recievingregistered as listenerTypeFooListeners notificationson from this model or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @see #getChangeListeners @since 1.3
Class DefaultBoundedRangeModel, int getMaximum()

ReturnReturns the model's maximum. @return the model's maximum @see #setMaximum @see BoundedRangeModel#getMaximum
Class DefaultBoundedRangeModel, int getMinimum()

ReturnReturns the model's minimum. @return the model's minimum @see #setMinimum @see BoundedRangeModel#getMinimum
Class DefaultBoundedRangeModel, int getValue()

ReturnReturns the model's current value. @return the model's current value @see #setValue @see BoundedRangeModel#getValue
Class DefaultBoundedRangeModel, boolean getValueIsAdjusting()

Returns true if the value is in the process of changing as a result of actions being taken by the user. @return the value of the valueIsAdjusting property @see #setValue @see BoundedRangeModel#getValueIsAdjusting
Class DefaultBoundedRangeModel, void removeChangeListener(ChangeListener)

Removes a ChangeListener. @param l the ChangeListener to remove @see #addChangeListener @see BoundedRangeModel#removeChangeListener
Class DefaultBoundedRangeModel, void setRangeProperties(int, int, int, int, boolean)

Sets all of the BoundedRangeModel properties after forcing the arguments to obey the usual constraints:
 minimum < value < value+extent < maximum 

At most one ChangeEvent is generated. @see BoundedRangeModel#setRangeProperties @see #setValue @see #setExtent @see #setMinimum @see #setMaximum @see #setValueIsAdjusting

Class DefaultBoundedRangeModel, void setValueIsAdjusting(boolean)

Sets the valueIsAdjusting property. @see #getValueIsAdjusting @see #setValue @see BoundedRangeModel#setValueIsAdjusting
Class DefaultBoundedRangeModel, String toString()

Returns a string that displays all of the BoundedRangeModel properties.
Class DefaultBoundedRangeModel, ChangeEvent changeEvent

Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property. The source of events generated here is always "this".

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.32 0241 12/0203/0001 @author Jeff Dinkins

Class DefaultButtonModel, constructor DefaultButtonModel()

Constructs a default JButtonModel.
Class DefaultButtonModel, void addActionListener(ActionListener)

Adds an ActionListener to the button. @param l the listener to add
Class DefaultButtonModel, void addChangeListener(ChangeListener)

Adds a ChangeListener to the button. @param l the listener to add
Class DefaultButtonModel, void addItemListener(ItemListener)

Adds an ItemListener to the button. @param l the listener to add
Class DefaultButtonModel, String getActionCommand()

Returns the action command for this button. @return the String that identifies the generated event @see #setActionCommand
Class DefaultButtonModel, ButtonGroup getGroup()

Returns the group that this button belongs to. Normally used with radio buttons which are mutually exclusive within their group. @return a ButtonGroup that this button belongs to @since 1.3
Class DefaultButtonModel, EventListener[] getListeners(Class)

ReturnReturns an array of all the objects currently registered as FooListeners upon this model. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal such as FooListener.class. For example you can query a DefaultButtonModel instance m for its action listeners ofwith the givenfollowing typecode: that

ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));
were added toIf no such listeners exist this modelmethod returns an empty array. @returns allparam listenerType the type of thelisteners requested; this parameter should specify an interface that descends from java.util.EventListener @return an array of all objects recievingregistered as listenerTypeFooListeners notificationson from this model or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @see #getActionListeners @see #getChangeListeners @see #getItemListeners @since 1.3
Class DefaultButtonModel, Object[] getSelectedObjects()

OverridenOverridden to return null.
Class DefaultButtonModel, boolean isEnabled()

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

Indicates ifwhether button has been pressed. @return true if the button has been pressed
Class DefaultButtonModel, void removeActionListener(ActionListener)

Removes an ActionListener from the button. @param l the listener to remove
Class DefaultButtonModel, void removeChangeListener(ChangeListener)

Removes a ChangeListener from the button. @param l the listener to remove
Class DefaultButtonModel, void removeItemListener(ItemListener)

Removes an ItemListener from the button. @param l the listener to remove
Class DefaultButtonModel, void setActionCommand(String)

Sets the actionCommand string that gets sent as part of the event when the button is pressed. @param s the String that identifies the generated event
Class DefaultButtonModel, void setGroup(ButtonGroup)

Identifies the group this button belongs to -- needed for radio buttons which are mutually exclusive within their group. @param group the ButtonGroup this button belongs to
Class DefaultButtonModel, void setSelected(boolean)

Selects or deselects the button. @param b true selects the button false deselects the button.
Class DefaultButtonModel, ChangeEvent changeEvent

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

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.38 0246 12/0203/0001 @author Alan Chung @author Philip Milne

Class DefaultCellEditor, constructor DefaultCellEditor(JCheckBox)

Constructs a DefaultCellEditor object that uses a check box. @param x a JCheckBox object ...
Class DefaultCellEditor, constructor DefaultCellEditor(JComboBox)

Constructs a DefaultCellEditor object that uses a combo box. @param x a JComboBox object ...
Class DefaultCellEditor, constructor DefaultCellEditor(JTextField)

Constructs a DefaultCellEditor that uses a text field. @param x a JTextField object ...
Class DefaultCellEditor, int getClickCountToStart()

ClickCountToStartReturns controls the number of clicks requiredneeded to start editing. @returns the number of clicks needed to start editing
Class DefaultCellEditor, Component getComponent()

Returns the a reference to the editor component. @return the editor Component

Class DefaultComboBoxModel

The default model for combo boxes. @version 1.11 0215 12/0203/0001 @author Arnaud Weber @author Tom Santos

Class DefaultDesktopManager

This is an implementaionimplementation of the DesktopManager. It currently implements a the basic behaviors for managing JInternalFramesJInternalFrames in an arbitrary parent. JInternalFramesJInternalFrames that are not children of a JDesktop will use this component to handle their desktop-like actions. @see JDesktopPane @see JInternalFrame @version 1.41 0245 12/0203/0001 @author David Kloba @author Steve Wilson
Class DefaultDesktopManager, void activateFrame(JInternalFrame)

This will activate f moving it to the front. It will set the current active frame's (if any) IS_SELECTED_PROPERTY to false. There can be only one active frame across all Layers. @param f the JInternalFrame to be activated
Class DefaultDesktopManager, void closeFrame(JInternalFrame)

Removes the frame and if necessary the desktopIcon from its parent. @param f the JInternalFrame to be removed
Class DefaultDesktopManager, void deiconifyFrame(JInternalFrame)

Removes the desktopIcon from its parent and adds its frame to the parent. @param f the JInternalFrame to be de-iconified
Class DefaultDesktopManager, void dragFrame(JComponent, int, int)

Moves the visible location of the frame being dragged to the location specified. The means by which this occurs can vary depending on the dragging algorithm being used. The actual logical location of the frame might not change until endDraggingFrame is called.
Class DefaultDesktopManager, void iconifyFrame(JInternalFrame)

Removes the frame from its parent and adds its desktopIcon to the parent. @param f the JInternalFrame to be iconified
Class DefaultDesktopManager, void maximizeFrame(JInternalFrame)

Resizes the frame to fill its parents bounds. @param the frame to be resized
Class DefaultDesktopManager, void minimizeFrame(JInternalFrame)

Restores the frame back to its size and position prior to a maximizeFrame() call. @param f the JInternalFrame to be restored
Class DefaultDesktopManager, void removeIconFor(JInternalFrame)

ConvienceConvenience method to remove the desktopIcon of f is necessary.
Class DefaultDesktopManager, void resizeFrame(JComponent, int, int, int, int)

Calls setBoundsForFrame() with the new values. @param f the component to be resized @param newX the new x-coordinate @param newY the new y-coordinate @param newWidth the new width @param newHeight the new height
Class DefaultDesktopManager, void setBoundsForFrame(JComponent, int, int, int, int)

This moves the JComponent and repaints the damaged areas.
Class DefaultDesktopManager, void setPreviousBounds(JInternalFrame, Rectangle)

Stores the bounds of the component just before a maximize call. @param f the component about to be resized @param r the normal bounds to be saved away
Class DefaultDesktopManager, void setWasIcon(JInternalFrame, Boolean)

Sets that the component has been iconized and the bounds of the desktopIcon are valid.

Class DefaultFocusManager

Default swingThis class has been obsoleted by the 1.4 focus managerAPIs. While client code may still use this class developers are strongly encouraged to use java.awt.KeyboardFocusManager and java.awt.DefaultKeyboardFocusManager instead. Please see the Focus implementationSpecification for more information. @see Focus Specification @version 1.15 0726 12/1303/9901 @author Arnaud Weber @author David Mendenhall

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.18 0721 12/2603/0001 @author Philip Milne @author Hans Muller


Class DefaultListCellRenderer.UIResource

A subclass of DefaultListCellRenderer that implements UIResource. DefaultListCellRenderer doesn't implement UIResource directly so that applications can safely override the cellRenderer property with DefaultListCellRenderer subclasses.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class DefaultListModel

This class loosely implements the java.util.Vector API in that it implements the 1.1.x version of java.util.Vector has no collection class support and notifies the ListDataListenersListDataListeners 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.26 0231 12/0203/0001 @author Hans Muller

Class DefaultListModel, void add(int, Object)

Inserts the specified element at the specified position in this list.

Throws an ArrayIndexOutOfBoundsException if the index is out of range (index < 0 || index >= size()). @param index index at which the specified element is to be inserted. @param element element to be inserted.

Class DefaultListModel, void addElement(Object)

Adds the specified component to the end of this list. @param obj the component to be added. @see Vector#addElement(Object)
Class DefaultListModel, boolean contains(Object)

Tests ifwhether the specified object is a component in this list. @param elem an object. @return true if the specified object is the same as a component in this list @see Vector#contains(Object)
Class DefaultListModel, void copyInto(Object[])

Copies the components of this list into the specified array. The array must be big enough to hold all the objects in this list else an IndexOutOfBoundsException is thrown. @param anArray the array into which the components get copied. @see Vector#copyInto(Object[])
Class DefaultListModel, Object elementAt(int)

Returns the component at the specified index. Throws an ArrayIndexOutOfBoundsException if the index is negative or not less than the size of the list.
Note: Although this method is not deprecated the preferred method to use is get(int) which implements the List interface defined in the 1.2 Collections framework.
@param index an index into this list. @return the component at the specified index. @see #get(int) @see Vector#elementAt(int)
Class DefaultListModel, Enumeration elements()

Returns an enumeration of the components of this list. @return an enumeration of the components of this list. @see Vector#elements()
Class DefaultListModel, void ensureCapacity(int)

Increases the capacity of this list if necessary to ensure that it can hold at least the number of components specified by the minimum capacity argument. @param minCapacity the desired minimum capacity. @see Vector#ensureCapacity(int)
Class DefaultListModel, Object firstElement()

Returns the first component of this list. Throws a NoSuchElementException if this vector has no components *. @return the first component of this list @see Vector#firstElement()
Class DefaultListModel, Object get(int)

Returns the element at the specified position in this list.

Throws an ArrayIndexOutOfBoundsException if the index is out of range (index < 0 || index >= size()). @param index index of element to return.

Class DefaultListModel, Object getElementAt(int)

Returns the component at the specified index.
Note: Although this method is not deprecated the preferred method to use is get(int) which implements the List interface defined in the 1.2 Collections framework.
@param index an index into this list. @return the component at the specified index. @exception ArrayIndexOutOfBoundsException if the index is negative or not lessgreater than the current size of this list. given. @see #get(int)
Class DefaultListModel, int getSize()

Returns the number of components in this list.

This method is identical to size() which implements the List interface defined in the 1.2 Collections framework. This method exists in conjunction with setSize() so that "size" is identifiable as a JavaBean property. @return the number of components in this list. @see #size()

Class DefaultListModel, int indexOf(Object)

Searches for the first occurenceoccurrence of the given argumentelem. @param elem an object. @return the index of the first occurrence of the argument in this list; returns -1 if the object is not found. @see Vector#indexOf(Object)
Class DefaultListModel, int indexOf(Object, int)

Searches for the first occurenceoccurrence of the given argumentelem beginning the search at index. @param elem an object.desired component @param index the index from which to startbegin searching from. @return the index ofwhere the first occurrence of the object argument in thiselem list at positionis found after index or later in the list; returns -1 if the objectelem is not found. in the list @see Vector#indexOf(Object int)
Class DefaultListModel, void insertElementAt(Object, int)

Inserts the specified object as a component in this list at the specified index.

Throws an ArrayIndexOutOfBoundsException if the index is invalid.

Note: Although this method is not deprecated the preferred method to use is add(int Object) which implements the List interface defined in the 1.2 Collections framework.
@param obj the component to insert. @param index where to insert the new component. @exception ArrayIndexOutOfBoundsException if the index was invalid. @see #add(int Object) @see Vector#insertElementAt(Object int)
Class DefaultListModel, boolean isEmpty()

Tests ifwhether this list has noany components. @return true if and only if this list has no components that is its size is zero; false otherwise. @see Vector#isEmpty()
Class DefaultListModel, Object lastElement()

Returns the last component of the list. Throws a NoSuchElementException if this vector has no components *. @return the last component of the list @see Vector#lastElement()
Class DefaultListModel, int lastIndexOf(Object)

Returns the index of the last occurrence of the specified object in this listelem. @param elem the desired component. @return the index of the last occurrence of the specified objectelem in thisthe list; returns -1 if the object is not found. @see Vector#lastIndexOf(Object)
Class DefaultListModel, int lastIndexOf(Object, int)

Searches backwards for the specified objectelem starting from the specified index and returns an index to it. @param elem the desired component. @param index the index to start searching from. @return the index of the last occurrence of the specified objectelem in this list at position less than index in the list; returns -1 if the object is not found. @see Vector#lastIndexOf(Object int)
Class DefaultListModel, Object remove(int)

Removes the element at the specified position in this list. Returns the element that was removed from the list.

Throws an ArrayIndexOutOfBoundsException if the index is out of range (index < 0 || index >= size()). @param index the index of the element to removed.

Class DefaultListModel, void removeAllElements()

Removes all components from this list and sets its size to zero.
Note: Although this method is not deprecated the preferred method to use is clear() which implements the List interface defined in the 1.2 Collections framework.
@see #clear() @see Vector#removeAllElements()
Class DefaultListModel, boolean removeElement(Object)

Removes the first (lowest-indexed) occurrence of the argument from this list. @param obj the component to be removed. @return true if the argument was a component of this list; false otherwise. @see Vector#removeElement(Object)
Class DefaultListModel, void removeElementAt(int)

Deletes the component at the specified index.

Throws an ArrayIndexOutOfBoundsException if the index is invalid.

Note: Although this method is not deprecated the preferred method to use is remove(int) which implements the List interface defined in the 1.2 Collections framework.
@param index the index of the object to remove. @see #remove(int) @see Vector#removeElementAt(int)
Class DefaultListModel, void removeRange(int, int)

Deletes the components at the specified range of indexes. The removal is inclusive so specifying a range of (1 5) removes the component at index 1 and the component at index 5 as well as all components in between.

Throws an ArrayIndexOutOfBoundsException if the index was invalid. Throws an IllegalArgumentException if fromIndex > toIndex. @param fromIndex the index of the lower end of the range @param toIndex the index of the upper end of the range @see #remove(int)

Class DefaultListModel, Object set(int, Object)

Replaces the element at the specified position in this list with the specified element.

Throws an ArrayIndexOutOfBoundsException if the index is out of range (index < 0 || index >= size()). @param index index of element to replace. @param element element to be stored at the specified position. @return the element previously at the specified position.

Class DefaultListModel, void setElementAt(Object, int)

Sets the component at the specified index of this list to be the specified object. The previous component at that position is discarded.

Throws an ArrayIndexOutOfBoundsException if the index is invalid.

Note: Although this method is not deprecated the preferred method to use is set(int Object) which implements the List interface defined in the 1.2 Collections framework.
@param obj what the component is to be set to. @param index the specified index. @see #set(int Object) @see Vector#setElementAt(Object int)
Class DefaultListModel, void setSize(int)

Sets the size of this list. @param newSize the new size of this list. @see Vector#setSize(int)
Class DefaultListModel, int size()

Returns the number of components in this list. @return the number of components in this list. @see Vector#size()
Class DefaultListModel, Object[] toArray()

Returns an array containing all of the elements in this list in the correct order. Throws an ArrayStoreException if the runtime type of the array a is not a supertype of the runtime type of every element in this list. @param a the array into which the elements of the list are to be stored if it is big enough; otherwise a new array of the same runtime type is allocated for this purpose. @return an array containing the elements of the list. @see Vector#toArray()

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.55 0265 12/0203/0001 @author Philip Milne @author Hans Muller @see ListSelectionModel

Class DefaultListSelectionModel, EventListener[] getListeners(Class)

Returns an array of all the objects currently registered as FooListeners upon this model. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal such as FooListener.class. For example you can query a DefaultListSelectionModel instance m for its list selection listeners ofwith the givenfollowing typecode: that

ListSelectionListener[] lsls = (ListSelectionListener[])(m.getListeners(ListSelectionListener.class));
wereIf addedno such tolisteners exist this modelmethod returns an empty array. @param listenerType the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener @return allan array of theall objects receivingregistered as listenerTypeFoo notificationsListeners fromon this model or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @see #getListSelectionListeners @since 1.3

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.25 0232 12/0203/0001 @author Dave Moore

Class DefaultSingleSelectionModel, void addChangeListener(ChangeListener)

Adds a ChangeListener to the button.
Class DefaultSingleSelectionModel, EventListener[] getListeners(Class)

ReturnReturns an array of all the objects currently registered as FooListeners upon this model. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal such as FooListener.class. For example you can query a DefaultSingleSelectionModel instance m for its change listeners ofwith the givenfollowing typecode: that

ChangeListener[] cls = (ChangeListener[])(m.getListeners(ChangeListener.class));
wereIf addedno such listeners toexist this modelmethod returns an empty array. @returnsparam alllistenerType the type of thelisteners requested; this parameter should specify an interface that descends from java.util.EventListener @return an array of all objects recievingregistered as listenerTypeFooListeners notificationson from this model or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @see #getChangeListeners @since 1.3
Class DefaultSingleSelectionModel, void removeChangeListener(ChangeListener)

Removes a ChangeListener from the button.

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.10 0212 12/0203/0001 @author David Kloba
Class DesktopManager, void dragFrame(JComponent, int, int)

The user has moved the frame. Calls to this method will be preceededpreceded by calls to beginDraggingFrame(). Normally f will be a JInternalFrame.
Class DesktopManager, void resizeFrame(JComponent, int, int, int, int)

The user has resized the component. Calls to this method will be preceededpreceded by calls to beginResizingFrame(). Normally f will be a JInternalFrame.
Class DesktopManager, void setBoundsForFrame(JComponent, int, int, int, int)

This is a primativeprimitive reshape method.

Class FocusManager

SwingThis class has been obsoleted by the 1.4 focus APIs. While client code may still use this class developers are strongly encouraged to use java.awt.KeyboardFocusManager and java.awt.DefaultKeyboardFocusManager instead. Please see the Focus Specification for more information. @see Focus ManagerSpecification @version 1.11 0223 12/0203/0001 @author Arnaud Weber @author David Mendenhall
Class FocusManager, void disableSwingFocusManager()

DisableChanges Swing's focus manager for the callingcurrent threadKeyboardFocusManager's thread group. Call thisdefault methodFocusTraversalPolicy ifto your applicationDefaultFocusTraversalPolicy. mixes@see java.awt components and swing's components.DefaultFocusTraversalPolicy Your@see applicationjava.awt.KeyboardFocusManager#setDefaultFocusTraversalPolicy will@deprecated then useas of the1.4 awt focusreplaced by managerKeyboardFocusManager.setDefaultFocusTraversalPolicy(FocusTraversalPolicy)
Class FocusManager, FocusManager getCurrentManager()

ReturnReturns the FocusManagercurrent KeyboardFocusManager instance for the calling thread's Therecontext. is@return onethis FocusManagerthread's percontext's KeyboardFocusManager thread@see group#setCurrentManager
Class FocusManager, boolean isFocusManagerEnabled()

ReturnReturns whether Swing'sthe focus manager isapplication has invoked enableddisableSwingFocusManager(). @see #disableSwingFocusManager @deprecated As of 1.4 replaced by KeyboardFocusManager.getDefaultFocusTraversalPolicy()
Class FocusManager, void processKeyEvent(Component, KeyEvent)

This method is called by JComponentsinitiates when a key eventfocus occurs.traversal JComponent gives key events tooperation if and only if the focusKeyEvent manager first then torepresents a focus traversal key listenersfor then to the keyboard UIspecified dispatcherfocusedComponent. This method should lookIt at theis key event and changeexpected that focusedComponent is the focused component if thecurrent key event matches thefocus owner although this receiver'sneed focus manager hot keysnot be the case. ForIf example the defaultit is not focus managertraversal will change the focusnevertheless proceed as if the key event matches TABfocusedComponent or Shift + TABwere the focus owner. The@param focus managerfocusedComponent should callthe Component consume()that onis anEventthe ifbasis anEventfor has beena focus processed.traversal focusedComponentoperation isif the component thatspecified currently has theevent represents a focus. Note: FocusManager will receive bothtraversal KEY_PRESSEDkey andfor KEY_RELEASEDthe keyComponent events.@param If onee the event is consumed thethat other one should be consumedmay represent a focus traversal too.key
Class FocusManager, void setCurrentManager(FocusManager)

SetSets the FocusManagercurrent thatKeyboardFocusManager should be usedinstance for the forcalling thread's context. If null is specified then the current KeyboardFocusManager is replaced with a new instance of DefaultKeyboardFocusManager.

If a SecurityManager is installed the calling thread must be granted the AWTPermission "replaceKeyboardFocusManager" in order to replace the the current KeyboardFocusManager. aFocusManagerIf this permission is not granted this method will bethrow a SecurityException and the defaultcurrent focusKeyboardFocusManager managerwill forbe unchanged. @param newManager the callingnew KeyboardFocusManager for this thread's threadcontext @see #getCurrentManager group@see java.awt.DefaultKeyboardFocusManager @throws SecurityException if the calling thread does not have permission to replace the current KeyboardFocusManager

Class FocusManager, String FOCUS_MANAGER_CLASS_PROPERTY

This propertyfield is obsolete and its nameuse is useddiscouraged to getsince its specification is incompatible with the FocusManager1.4 implementationfocus thatAPIs. should be used forThe current FocusManager is no longer a givenproperty of the UI. Client code must query for the current FocusManager using KeyboardFocusManager.getCurrentKeyboardFocusManager(). See the Focus Specification for more information. @see java.awt.KeyboardFocusManager#getCurrentKeyboardFocusManager @see Focus Specification

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.12 0213 12/0203/0001

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.46 0449 12/0603/0001 @author Jeff Dinkins @author Lynn Monsanto


Class ImageIcon.AccessibleImageIcon

This class implements accessibility support for the ImageIcon class. It provides an implementation of the Java Accessibility API appropriate to image icon 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class InputMap

InputMap provides a binding between an input event (currently only KeyStrokes are used) and an Object. InputMaps are usually used with an ActionMap to determine an Action to perform when a key is pressed. An InputMap can have a parent that is searched for bindings not defined in the InputMap.

As with ActionMap if you create a cycle eg:

 InputMap am = new InputMap(); InputMap bm = new InputMap(): am.setParent(bm); bm.setParent(am); 
some of the methods will cause a StackOverflowError to be thrown. @version 1.9 0211 12/0203/0001 @author Scott Violet @since 1.3

Class InputVerifier

The purpose of this class is to help clients support smooth focus navigation through GUIs with text fields. Such GUIs often need to ensure that the text entered by the user is valid (for example that it's in the proper format) before allowing the user to navigate out of the text field. To do this clients create a subclass of InputVerifier and using JComponent's setInputVerifier method attach an instance of their subclass to the JComponent whose input they want to validate. Before focus is transfered to another Swing component that requests it the input verifier's shouldYieldFocus method is called. Focus is transfered only if that method returns true.

The following example has two text fields with the first one expecting the string "pass" to be entered by the user. If that string is entered in the first text field then the user can advance to the second text field either by clicking in it or by pressing TAB. However if another string is entered in the first text field then the user will be unable to transfer focus to the second text field.

 import java.awt.*; import java.util.*; import java.awt.event.*; import javax.swing.*; // This program demonstrates the use of the Swing InputVerifier class. // It creates two text fields; the first of the text fields expects the // string "pass" as input and will allow focus to advance out of it // only after that string is typed in by the user. public class VerifierTest extends JFrame { public VerifierTest () { JTextField tf; tftf1 = new JTextField ("TextField1Type \"pass\" here"); getContentPane().add (tftf1 BorderLayout.NORTH); tftf1.setInputVerifier(new PassVerifier()); tfJTextField tf2 = new JTextField ("TextField2"); getContentPane().add (tftf2 BorderLayout.SOUTH); addWindowListener (new MyWAdapter ()); } public static void main (String [] args) { FrameWindowListener fl = new VerifierTest (); f.pack(); f.showWindowAdapter(); } class MyWAdapter extends WindowAdapter { public void windowClosing(WindowEvent evente) { System.exit (0); } }; addWindowListener(l); } class PassVerifier extends InputVerifier { public boolean verify(JComponent input) { JTextField tf = (JTextField) input; Stringreturn "pass = ".equals(tf.getText()); if} (pass.equals} public static void main("pass")String[] args) return{ true;Frame else returnf = falsenew VerifierTest(); }f.pack(); f.setVisible(true); } } 
@since 1.3

Class JApplet

An extended version of java.applet.Applet that adds support for the JFC/Swing component architecture. You can find task-oriented documentation about using JApplet in The Java Tutorial in the section How to Make Applets.

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.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer true attribute: containerDelegate getContentPane description: Swing's Applet subclass. @version 1.44 0853 12/0503/0001 @author Arnaud Weber

Class JApplet, constructor JApplet()

Creates a swing applet instance.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale

Class JApplet, 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 BorderLayoutGridLayout(1 2)) 
An attempt to set the layout of this component will cause an runtime exception to be thrown. Subclasses can disable this behavior. @see #setRootPaneCheckingEnabled @exception Error if called with rootPaneChecking true
Class JApplet, void update(Graphics)

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

Class JButton

An implementation of a "push" button. See How to Use Buttons Check Boxes and Radio Buttons in The Java Tutorial for information and examples of using buttons.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: An implementation of a \"push\" button. @version 1.84 0492 12/0603/0001 @author Jeff Dinkins


Class JButton.AccessibleJButton

This class implements accessibility support for the JButton class. It provides an implementation of the Java Accessibility API appropriate to button 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JButton, constructor JButton(Action)

Creates a button where properties are taken from the Action supplied. @param a the Action used to specify the new button @since 1.3
Class JButton, constructor JButton(String, Icon)

Creates a button with initial text and an icon. @param text the text of the button. @param icon the Icon image to display on the button
Class JButton, void configurePropertiesFromAction(Action)

Factory method which sets the AbstractButton's properties according to values from the Action instance. The properties which get set may differ for AbstractButton subclasses. By default the properties which get set are Text Icon Enabled ToolTipText ActionCommand and ToolTipTextMnemonic. @param a the Action from which to get the properties or null @since 1.3 @see Action @see #setAction
Class JButton, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JButton. For JButtonsJButtons 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 JButton @beaninfo expert: true description: The AccessibleContext associated with this Button.
Class JButton, String getUIClassID()

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

Returns whether orGets the value notof the defaultButton property which if true means that this button is the current default button for its JRootPane. Most look and feels render the default button ondifferently and may potentially provide bindings to access the RootPanedefault button. @return "boolean"the value of the defaultButton property @see JRootPane#setDefaultButton @see #isDefaultCapable @beaninfo description: Whether or not this button is the default button
Class JButton, boolean isDefaultCapable()

ReturnsGets whether or notthe this button isvalue of the capabledefaultCapable ofproperty. being@return the default buttonvalue onof the RootPane. @returndefaultCapable "boolean"property @see #setDefaultCapable @see #isDefaultButton @see JRootPane#setDefaultButton
Class JButton, String paramString()

Returns a string representation of this JButton. 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 JButton.
Class JButton, void removeNotify()

Overrides JComponent.removeNotify to check if this button is currently set as the default button on the RootPane and if so sets the RootPane's default button to null to ensure the RootPane doesn't hold onto an invalid button reference.
Class JButton, void setDefaultCapable(boolean)

Sets whetherthe ordefaultCapable notproperty which determines whether this button can be made the default button for its root pane. The default value of the defaultCapable property is true unless otherwise specified by the look and feel. @param defaultCapable true if this button will be capable of being the default button on the RootPane.; @returnotherwise "boolean"false @see #isDefaultCapable @beaninfo bound: true attribute: visualUpdate true description: Whether or not this button can be the default button
Class JButton, void updateUI()

NotificationResets from the UIFactoryUI property to thata value from the L&Fcurrent look has changedand feel. @see JComponent#updateUI

Class JCheckBox

An implementation of a check box -- an item that can be selected or deselected and which displays its state to the user. By convention any number of check boxes in a group can be selected. See How to Use Buttonc Check Boxes and Radio Buttons in The Java Tutorial for examples and information on using check 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see JRadioButton @beaninfo attribute: isContainer false description: A component which can be selected or deselected. @version 1.59 0468 12/0603/0001 @author Jeff Dinkins


Class JCheckBox.AccessibleJCheckBox

This class implements accessibility support for the JCheckBox class. It provides an implementation of the Java Accessibility API appropriate to check box 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JCheckBox, void configurePropertiesFromAction(Action)

Factory method which sets the ActionEvent source's properties according to values from the Action instance. The properties which are set may differ for subclasses. By default the properties which get set are Text IconMnemonic Enabled ActionCommand and ToolTipText. @param a the Action from which to get the properties or null @since 1.3 @see Action @see #setAction
Class JCheckBox, String getUIClassID()

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

ReturnsGets whether the border should bevalue of the paintedborderPaintedFlat flatproperty. @return the value of the borderPaintedFlat property @see #setBorderPaintedFlat
Class JCheckBox, void setBorderPaintedFlat(boolean)

Sets whetherthe borderPaintedFlat property which gives a hint to the border should be paintedlook and feel as flatto the appearance of the check box border. This is usually set to true when a JCheckBox instance is used as a renderer in a component such as a JTable or JTree. The default value for the borderPaintedFlat property is false. This method fires a property changed event. Some look and feels might not implement flat borders; they will ignore this property. @param b if true requests that the border isbe painted flat.; false requests normal borders @see #isBorderPaintedFlat @beaninfo bound: true attribute: visualUpdate true description: Whether the border is painted flat.
Class JCheckBox, void updateUI()

NotificationResets from the UIFactoryUI property to thata value from the L&Fcurrent look has changedand feel. @see JComponent#updateUI

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 check 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 preferred methods are isSelected and setSelected which 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A menu item which can be selected or deselected. @version 1.48 0452 12/0603/0001 @author Georges Saab @author David Karlton


Class JCheckBoxMenuItem.AccessibleJCheckBoxMenuItem

This class implements accessibility support for the JCheckBoxMenuItem class. It provides an implementation of the Java Accessibility API appropriate to checkbox 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


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 three 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 futureAs release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A component that supports selecting a Color. @version 1.30 0441 12/0603/0001 @author James Gosling @author Amy Fowler @author Steve Wilson

Class JColorChooser, void addChooserPanel(AbstractColorChooserPanel)

Adds a color chooser panel to the color chooser. @param panel the AbstractColorChooserPanel to be added
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 @return a new dialog containing the color-chooser pane @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
Class JColorChooser, AbstractColorChooserPanel[] getChooserPanels()

Returns the specified color panels. @return an array of AbstractColorChooserPanel objects
Class JColorChooser, JComponent getPreviewPanel()

Returns the preview panel that shows a chosen color. @return a JComponent object -- the preview panel
Class JColorChooser, ColorSelectionModel getSelectionModel()

Returns the data model that handles color selections. @return a ColorSelectionModel object
Class JColorChooser, ColorChooserUI getUI()

Returns the L&F object that renders this component. @return the ColorChooserUI object that renders this component
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 @exception IllegalArgumentException if panel is not in list of known chooser panels
Class JColorChooser, void setChooserPanels(AbstractColorChooserPanel[])

Specifies the Color Panels used to choose a color value. @param panels an array of AbstractColorChooserPanel objectobjects @beaninfo bound: true hidden: true description: An array of different chooser types.
Class JColorChooser, void setColor(Color)

Sets the current color of the color chooser to the specified color. ThisThe ColorSelectionModel will fire a PropertyChangeEventChangeEvent 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)

Sets the current color of the color chooser to the specified color. @param c an intinteger value that sets the current color in the chooser where the low-order 8 bits specify the Blue value the next 8 bits specify the Green value and the 8 bits above that specify the Red value.
Class JColorChooser, void setSelectionModel(ColorSelectionModel)

SetSets the model containing the selected color. @param newModel the new ColorSelectionModel object @beaninfo bound: true hidden: true description: The model which contains the currently selected color.
Class JColorChooser, void setUI(ColorChooserUI)

Sets the L&F object that renders this component. @param ui the ColorChooserUI L&F object @see UIDefaults#getUI @beaninfo bound: true hidden: true description: The UI object that implements the color chooser's LookAndFeel.
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 @return the selected color or null if the user opted out @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless

Class JComboBox

A component that combines a button or texteditable field and a drop-down list. The user can select a value from the drop-down list which appears at the user's request. If you make the combo box editable then the combo box includes aan texteditable field into which the user can type a value. For examples and information on using combo boxes see How to Use Combo Boxes 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 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder

See How to Use Combo Boxes in The Java Tutorial for further information.

@see ComboBoxModel @see DefaultComboBoxModel @beaninfo attribute: isContainer false description: A combination of a text field and a drop-down list. @version 1.82 02112 12/0920/01 @author Arnaud Weber @author Mark Davidson


Class JComboBox.AccessibleJComboBox

This class implements accessibility support for the JComboBox class. It provides an implementation of the Java Accessibility API appropriate to Combo Box 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JComboBox, void addActionListener(ActionListener)

Adds an ActionListener.

The listenerActionListener will receive an actionActionEvent when a selection has been made. eventIf the usercombo finishes making abox is editable selectionthen an ActionEvent will be fired when editing has stopped. @param l the ActionListener that is to be notified @see #setSelectedItem

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 usesa the defaultmutable 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 @see MutableComboBoxModel
Class JComboBox, void addItemListener(ItemListener)

Adds an ItemListener.

aListener will receive anone or eventtwo ItemEvents when the selected item changes. @param aListener the ItemListener that is to be notified @see #setSelectedItem

Class JComboBox, void contentsChanged(ListDataEvent)

This method is public as an implementation side effect. do not call or override. @see javax.swing.event.ListDataListener
Class JComboBox, void fireActionEvent()

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

Returns the currentlycurrent selected item. @return

If the currentlycombo selectedbox is editable then this value may not have been added to the list object fromcombo box with addItem insertItemAt or the data modelconstructors. @return the current selected Object @see #setSelectedItem

Class JComboBox, Object[] getSelectedObjects()

Returns an array containing the selected item. This method is implemented for compatibility with ItemSelectable. @returnsreturn an array of Objects containing one element -- the selected item
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 thea defaultmutable 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 integer specifying the position at which to add the item @see MutableComboBoxModel
Class JComboBox, void intervalAdded(ListDataEvent)

Invoked items have been added to the internalThis method is public as an implementation side data modeleffect. The "interval" includes the firstdo and last valuesnot call or added. @see javax.swing.eventoverride.ListDataListener
Class JComboBox, void intervalRemoved(ListDataEvent)

Invoked when values have been removed from theThis method is public as an implementation side data modeleffect. The "interval" includes the firstdo and last valuesnot call or removed. @see javax.swing.eventoverride.ListDataListener
Class JComboBox, boolean isFocusTraversable()

Returns true ifwhether thethis componentComponent can receivebecome the focus. In this case the componentowner. returns@return falsetrue if it is editable so that thethis EditorComponent objectis receivesfocusable; thefalse focusotherwise instead@see of#setFocusable the@since componentJDK1.1 @return truedeprecated if the componentAs can receiveof the1.4 focus elsereplaced by falseisFocusable().
Class JComboBox, boolean isLightWeightPopupEnabled()

Returns true if lightweightGets the value of (all-Java)the popupslightWeightPopupEnabled are in use or false if heavyweight (native peer) popups are being usedproperty. @return truethe value if lightweightof the popupslightWeightPopupEnabled areproperty in@see use#setLightWeightPopupEnabled
Class JComboBox, boolean isPopupVisible()

Determines the visibility of the popup. @return true if the popup is visible otherwise returns false
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 usesa the defaultmutable 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 @see MutableComboBoxModel
Class JComboBox, void removeItemAt(int)

Removes the item at anIndex This method works only if the JComboBox uses the default data model. JComboBox usesa the defaultmutable data model when created with the empty constructor and no other model has been set. @param anIndex an int specifying the idexindex of the item to remove where 0 indicates the first item in the list @see MutableComboBoxModel
Class JComboBox, boolean selectWithKeyChar(char)

Selects the list item that correpondscorresponds to the specified keyboard character and returns true if there is an item corresponding to that character. Otherwise returns false. @param keyChar a char typically this is a keyboard key typed by the user
Class JComboBox, void selectedItemChanged()

This protected method is called when the selected itemimplementation changesspecific. ItsDo default implementationnot notifies the item listenersaccess directly or override.
Class JComboBox, void setAction(Action)

Sets the Action for the ActionEvent source. The new Action replaces any previously set Action but does not affect ActionListeners independantlyindependently added with addActionListener. If the Action is already a registered ActionListener for the ActionEvent source it is not re-registered.

A side-effect of setting the Action is that the ActionEvent source's properties are immedately set from the values in the Action (performed by the method configurePropertiesFromAction) and subsequently updated as the Action's properties change (via a PropertyChangeListener created by the method createActionPropertyChangeListener. @param a the Action for the JComboBox or null. @since 1.3 @see Action @see #getAction @see #configurePropertiesFromAction @see #createActionPropertyChangeListener @beaninfo bound: true attribute: visualUpdate true description: the Action instance connected with this ActionEvent source

Class JComboBox, void setActionCommand(String)

Sets the action commnandcommand 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 same listener can then do different things depending on the command it receives
Class JComboBox, void setLightWeightPopupEnabled(boolean)

WhenSets displaying the popuplightWeightPopupEnabled property which provides a hint as to whether or not a lightweight JComboBoxComponent chooseshould be used to usecontain the JComboBox versus a lightheavyweight weightComponent popupsuch ifas a Panel or ita fitsWindow. This method allows you to disableThe decision of lightweight versus heavyweight thisis ultimately up to the featureJComboBox. You haveLightweight windows toare more efficient than heavyweight windows but lightweight and heavyweight components do disable itnot mix ifwell in a GUI. If your application mixes lightlightweight and heavyweight components you should disable lightweight popups. The default value for the lightWeightPopupEnabled property is true unless otherwise specified weightby the look and heavyfeel. weightsSome componentslook and feels always use heavyweight popups no matter what the value of this property.

See the article Mixing Heavy and Light Components on The Swing Connection This method fires a property changed event. @param aFlag if true lightweight popups are desired @beaninfo bound: true expert: true description: When setSet to disablesfalse using light weightto require heavyweight popups.

Class JComboBox, void setRenderer(ListCellRenderer)

Sets the renderer that paints the list items and 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 callingor the selected object's toStringan methodicon. 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 integer specifying the list item to select where 0 specifies the first item in the list and -1 indicates no selection @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 JComboBoxcombo box by specifyingdisplay area to the object in the listargument. If anObject is in the list the display area shows anObject selected.

If anObject is not in the list displaysand the combo box is uneditable it will not change the current selection. For editable combo boxes the selection will change to anObject.

If this constitutes a change in the selected item ItemListeners added to the combo box will be notified with one or two ItemEvents. If there is a current selected item an ItemEvent will be fired and the state change will be ItemEvent.DESELECTED. If anObject is in the list and is not currently selected then an ItemEvent will be fired and the state change will be ItemEvent.SELECTED.

ActionListeners added to the combo box will be notified with an ActionEvent when this method is called. @param anObject the list object to select; use null to clear the selection @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 expertbound: true hidden: true attribute: visualUpdate true description: The ComboBoxUI implementationUI object that definesimplements the combo box look andComponent's feelLookAndFeel.
Class JComboBox, void updateUI()

NotificationResets from the UIFactoryUI property to thata value from the L&Fcurrent look has changedand feel. @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:

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see KeyStroke @see Action @see #setBorder @see #registerKeyboardAction @see JOptionPane @see #setDebugGraphicsOptions @see #setToolTipText @see #setAutoscrolls @version 2.130 07/09/99 @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.

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JComponent, constructor JComponent()

Default JComponent constructor. This constructor does novery little initialization beyond calling the Container constructor. For example the initial layout manager is null. It does however set the component's locale property to the value returned by JComponent.getDefaultLocale. @see #getDefaultLocale
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 /or invisible. Events are also sent when the component or its ancestors are added or removed from the containment hierarchy. @param listener the AncestorListener to register @see AncestorEvent
Class JComponent, void addNotify()

Notifies 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)

Adds 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 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. @param listener the PropertyChangeListener to be added

Class JComponent, void addPropertyChangeListener(String, PropertyChangeListener)

Adds 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 the name of the property to listen on @param listener the PropertyChangeListener to be added

Class JComponent, void addVetoableChangeListener(VetoableChangeListener)

Adds a VetoableChangeListener to the listener list. The listener is registered for all properties. @param listener the 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. @param visibleRect a Rectangle computed as the intersection of all visible rectangles for this component and all of its ancestors -- this is the return value for this method @see #getVisibleRect
Class JComponent, boolean contains(int, int)

Gives 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) @see ComponentUI
Class JComponent, JToolTip createToolTip()

Returns the instance of JToolTip that should be used to display the tooltip. Components typically would not override this method but it can be used to cause different tooltips to be displayed differently. @return the JToolTip used to display this toolTip
Class JComponent, void disable()

overriddenOverridden to ensure Accessibility support. Please use {@alink java.awt.Component.setEnable(boolean)}.
Class JComponent, void enable()

overriddenOverridden to ensure Accessibility support. Please use {@alink java.awt.Component.setEnable(boolean)}.
Class JComponent, void firePropertyChange(String, Object, Object)

Supports 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 intinteger:
 public void setFoo(int newValue) { int oldValue = foo; foo = newValue; firePropertyChange("foo" oldValue newValue); } 
@param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property (as an Object) @param newValue the new value of the property (as an Object) @see java.beans.PropertyChangeSupport
Class JComponent, void firePropertyChange(String, boolean, boolean)

Reports a bound property change. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property (as a boolean) @param oldValue the old value of the property (as a boolean) @see #firePropertyChange(java.lang.String java.lang.Object java.lang.Object)
Class JComponent, void firePropertyChange(String, byte, byte)

Reports a bound property change. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property (as a byte) @param newValue the new value of the property (as a byte) @see #firePropertyChange(java.lang.String java.lang.Object java.lang.Object)
Class JComponent, void firePropertyChange(String, char, char)

Reports a bound property change. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property (as a char) @param newValue the new value of the property (as a char) @see #firePropertyChange(java.lang.String java.lang.Object java.lang.Object)
Class JComponent, void firePropertyChange(String, double, double)

Reports a bound property change. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property (as a double) @param newValue the new value of the property (as a double) @see #firePropertyChange(java.lang.String java.lang.Object java.lang.Object)
Class JComponent, void firePropertyChange(String, float, float)

Reports a bound property change. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property (as a float) @param newValue the new value of the property (as a float) @see #firePropertyChange(java.lang.String java.lang.Object java.lang.Object)
Class JComponent, void firePropertyChange(String, int, int)

Reports a bound property change. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property (as an int) @param newValue the new value of the property (as an int) @see #firePropertyChange(java.lang.String java.lang.Object java.lang.Object)
Class JComponent, void firePropertyChange(String, long, long)

Reports a bound property change. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property (as a long) @param newValue the new value of the property (as a long) @see #firePropertyChange(java.lang.String java.lang.Object java.lang.Object)
Class JComponent, void firePropertyChange(String, short, short)

Reports a bound property change. @param propertyName the programmatic name of the property that was changed @param oldValue the old value of the property (as a short) @param newValue the old value of the property (as a short) @see #firePropertyChange(java.lang.String java.lang.Object java.lang.Object)
Class JComponent, void fireVetoableChange(String, Object, Object)

Supports 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. @param propertyName the name of the property that was listened on @param oldValue the old value of the property @param newValue the new value of the property @exception PropertyVetoException when the attempt to set the property is vetoed by the receiver.component
Class JComponent, AccessibleContext getAccessibleContext()

GetsReturns the AccessibleContext associated with this JComponent. The method implemented by this base class returns null. Classes that extend JComponent should implement this method to return the AccessibleContext associated with the subclass. @return the AccessibleContext of this JComponent
Class JComponent, ActionListener getActionForKeyStroke(KeyStroke)

Returns the object that will perform the action registered for a given keystroke. @return the ActionListener object invoked when the keystroke occurs
Class JComponent, ActionMap getActionMap()

Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding. The returned ActionMap unless otherwise set will have the ActionMap from the UI set as the parent. @return the ActionMap containing the key/action bindings @since 1.3
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()

ReturnsGets truethe ifautoscrolls this component automatically scrolls its contents when dragged (when contained inproperty. a@return component that supports scrollingthe value of the likeautoscrolls JViewport).property @see JViewport @see #setAutoscrolls
Class JComponent, Border getBorder()

Returns the border of this component or null if no border is currently set. @return the border object for this component @see #setBorder
Class JComponent, Rectangle getBounds(Rectangle)

Stores the bounds of this component into "return value" rv and returns 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 component's bounds @return rv; if rv is null return a newly created Rectangle with this component's bounds
Class JComponent, Object getClientProperty(Object)

Returns the value of the property with the specified key. Only properties added with putClientProperty will return a non-null value. @param key the being queried @return the value of this property or null @see #putClientProperty
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 necessary. Otherwise we just configure the specified graphics object's foreground and font. @param g the original Graphics object @return a Graphics object configured for this component
Class JComponent, int getConditionForKeyStroke(KeyStroke)

Returns 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

Class JComponent, int getDebugGraphicsOptions()

Returns the state of graphics debugging. @return a bitwise OR'd flag of zero or more of the following options: @see #setDebugGraphicsOptions
Class JComponent, Graphics getGraphics()

Returns this component's graphics context which lets you draw on a component. Use this method get a Graphics object and then invoke oeprationsoperations on that object to draw on the component. @return this components graphics context
Class JComponent, int getHeight()

Returns 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. @return the current height of this component.
Class JComponent, InputMap getInputMap()

Returns the InputMap that is used when the receivercomponent has focus. This is convenience method for getInputMap(WHEN_FOCUSED). @return the InputMap used when the component has focus @since JDK1.3
Class JComponent, InputMap getInputMap(int)

Returns the InputMap that is used during condition. @param condition one of WHEN_IN_FOCUSED_WINDOW WHEN_FOCUSED WHEN_ANCESTOR_OF_FOCUSED_COMPONENT @return the InputMap for the specified condition @since 1.3
Class JComponent, InputVerifier getInputVerifier()

Returns the input verifier for this component. @return the inputVerifier property @since 1.3 @see InputVerifier
Class JComponent, Insets getInsets()

If a border has been set on this component returns the border's insets; otherwise 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. If insets is null this will allocate a new one. @param insets the Insets object which can be reused @return the Insets object @see #getInsets @beaninfo expert: true
Class JComponent, EventListener[] getListeners(Class)

ReturnReturns an array of all the listenersobjects that werecurrently registered addedas FooListeners toupon this JComponent with. addXXXListener()FooListeners where XXX isare registered using the nameaddFooListener ofmethod.

You can specify the listenerType argument with a class literal such as FooListener.class. For example to get all ofyou can query a theJComponent MouseListenersc for the given Componentits mouse listeners cwith one would writethe following code:

 MouseListener[] mls = (MouseListener[])(c.getListeners(MouseListener.class)) ;
If no such listenerlisteners exist list exists thenthis method returns an empty array. @param listenerType the type of listeners requested; this isparameter returnedshould specify an interface that descends from java.util.EventListener @returns allreturn an array of the listenersall objects forregistered as FooListeners on this JComponentcomponent or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @since 1.3 @see #getVetoableChangeListeners @see #getAncestorListeners
Class JComponent, Point getLocation(Point)

Stores the x y origin of this component into "return value" rv and returns 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 component's location @return rv
Class JComponent, Dimension getMaximumSize()

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

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

Returns the nextComponent focusable componentset by a prior call to setNextFocusableComponent(Component) on this JComponent. @return the Component that will follow this JComponent in the focus traversal cycle or null if the focus manager should choosenone has been explicitly specified the@see #setNextFocusableComponent next@deprecated As of 1.4 focusable componentreplaced by automaticallyFocusTraversalPolicy.
Class JComponent, Dimension getPreferredSize()

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

Returns the KeyStrokes that will initiate registered actions. @return an array of KeyStroke objects @see #registerKeyboardAction
Class JComponent, JRootPane getRootPane()

Returns the JRootPane ancestor for athis component. @return the JRootPane that contains this component or null if no JRootPane is found
Class JComponent, Dimension getSize(Dimension)

Stores the width/height of this component into "return value" rv and returns 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 component's size @return rv
Class JComponent, Point getToolTipLocation(MouseEvent)

Returns the tooltip location in this 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 @return always returns null
Class JComponent, String getToolTipText()

Returns 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 extensive 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 that this component is in or null if not in any container
Class JComponent, String getUIClassID()

Returns 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 Thethe UIDefaults key for a ComponentUI subclass. @see UIDefaults#getUI @beaninfo expert: true description: UIClassID
Class JComponent, boolean getVerifyInputWhenFocusTarget()

GetReturns the value that indicates whether the input verifier for the current focus owner will be called before this component requests focus. @return value of the verifyInputWhenFocusTarget property @see InputVerifier @see #setInputVerifier @see #getInputVerifier @see #setVerifyInputWhenFocusTarget @since 1.3
Class JComponent, Rectangle getVisibleRect()

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

Returns 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. @return the current width of this component.
Class JComponent, int getX()

Returns the current x coordinate of the component's origin. This method is preferable to writing component.getBounds().x or component.getLocation().x because it doesn't cause any heap allocations. @return the current x coordinate of the component's origin
Class JComponent, int getY()

Returns the current y coordinate of the component's origin. This method is preferable to writing component.getBounds().y or component.getLocation().y because it doesn't cause any heap allocations. @return the current y coordinate of the component's origin
Class JComponent, void grabFocus()

SetsRequests that this Component get the input focus onand that this Component's top-level ancestor become the receivingfocused Window. This component if itmust be doesn'tdisplayable already havevisible and itfocusable for the request to be granted.

This method is intended for use by focus managersimplementations. YouClient rarely want to callcode should not use this method; instead it should use requestFocus() instead. @see #requestFocus()

Class JComponent, boolean hasFocus()

Returns true if this Component hasis the keyboard focus owner. This method is obsolete and has been replaced by isFocusOwner(). @return true if this Component hasis the keyboard focus owner; false otherwise @since 1.2
Class JComponent, boolean isDoubleBuffered()

Returns whether thethis receiving component should use a buffer to paint. @return true if this component is double buffered otherwise false
Class JComponent, boolean isFocusTraversable()

IdentifiesReturns whether or not this componentComponent can receivebecome the focus owner. A@return disabledtrue button forif this exampleComponent wouldis returnfocusable; false. otherwise @returnsee true#setFocusable if@since thisJDK1.1 component@deprecated can receiveAs of the1.4 focusreplaced by isFocusable().
Class JComponent, boolean isLightweightComponent(Component)

Returns true if this component is a lightweight that is if it doesn't have a native window system peer. @return true if this component is a lightweight
Class JComponent, boolean isManagingFocus()

OverrideChanges this method and return true if your JComponent manages focus. If your component manages focus the's focus manager will handletraversal keys to yourCTRL+TAB component'sand childrenCTRL+SHIFT+TAB. All keyAlso prevents eventSortingFocusTraversalPolicy will be sent to your key listener including TAB andfrom considering descendants of this JComponent when computing a focus SHIFT+TABtraversal cycle. CONTROL+TAB@see andjava.awt.Component#setFocusTraversalKeys CONTROL+SHIFT+TAB@see willSortingFocusTraversalPolicy move@deprecated the focusAs of to1.4 the nextreplaced by orComponent.setFocusTraversalKeys(int Set) previousand componentContainer.setFocusCycleRoot(boolean).
Class JComponent, boolean isMaximumSizeSet()

Returns true if the maximum size has been set to a non-null value otherwise returns false. @return true if maximumSize is non-null false otherwise
Class JComponent, boolean isMinimumSizeSet()

Returns true if the minimum size has been set to a non-null value otherwise returns false. @return true if minimumSize is non-null false otherwise
Class JComponent, boolean isOptimizedDrawingEnabled()

Returns true if this component tiles its children -- 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 such as JLayeredPane should override this method to return false. @return true if this component's childrenalways don'treturns overlaptrue
Class JComponent, boolean isPaintingTile()

Returns true if the receiving component is currently painting a tile. If this method returns true paint will be called again for another tile. This method returns false if you are not painting a tile or if the last tile is painted. Use this method to keep some state you might need between tiles. @return true if the component is currently painting a tile false otherwise
Class JComponent, boolean isPreferredSizeSet()

Returns true if the preferred size has been set to a non-null value otherwise returns false. @return true if preferredSize is non-null false otherwise
Class JComponent, boolean isRequestFocusEnabled()

Returns whethertrue the receivingif this component canJComponent obtain theshould get focus; by callingotherwise returns requestFocusfalse. @return true if this component should get focus otherwise returns false @see #setRequestFocusEnabled @see Focus Specification @see java.awt.Component#isFocusable
Class JComponent, boolean isValidateRoot()

If this method returns true revalidate() calls by descendants of this component will cause the entire tree beginning with this root to be validated. Returns false by default. JScrollPane overrides this method and returns true. @return always returns false @see #revalidate @see java.awt.Component#invalidate @see java.awt.Container#validate
Class JComponent, void paint(Graphics)

This method isInvoked 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) delegate's paint method should just override paintComponent. @param g the Graphics context in which to paint @see #paintComponent @see #paintBorder @see #paintChildren @see #getComponentGraphics @see #repaint

Class JComponent, void paintBorder(Graphics)

Paints the component's border.

If you override this in a subclass you should not make permanent changes to the passed in Graphics. For example you should not alter the clip Rectangle or modify the transform. If you need to do these operations you may find it easier to create a new Graphics from the passed in Graphics and manipulate it. @param g the Graphics context in which to paint @see #paint @see #setBorder

Class JComponent, void paintChildren(Graphics)

Paints 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. @param g the Graphics context in which to paint @see #paint @see java.awt.Container#paint
Class JComponent, void paintComponent(Graphics)

IfCalls the UI delegate's ispaint non-nullmethod calls its paintif the UI methoddelegate is non-null. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (for example Graphics.translate()).

If you override this in a subclass you should not make permanent changes to the passed in Graphics. For example you should not alter the clip Rectangle or modify the transform. If you need to do these operations you may find it easier to create a new Graphics from the passed in Graphics and manipulate it. Further if you do not invoker super's implementation you must honor the opaque property that is if this component is opaque you must completely fill in the background in a non-opaque color. If you do not honor the opaque property you will likely see visual artifacts. @param g the Graphics object to protect @see #paint @see ComponentUI

Class JComponent, void paintImmediately(Rectangle)

Paints the specified region now. @param r a Rectangle containing the region to be painted
Class JComponent, void paintImmediately(int, int, int, int)

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

It's rarely necessary 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. @param x the x value of the region to be painted @param y the y value of the region to be painted @param w the width of the region to be painted @param h the height of the region to be painted @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 print(Graphics)

Invoke this method to print the receivercomponent. This method will result in invocations to printComponent printBorder and printChildren. It is not recommended that you override this method instead override one of the previously metionedmentioned methods. This method sets the receiverscomponent's state such that the double buffer will not be used eg painting will be done directly on the passed in Graphics. @param g the Graphics context in which to paint @see #printComponent @see #printBorder @see #printChildren
Class JComponent, void printAll(Graphics)

Invoke this method to print the receivercomponent. This method invokes print on the receivercomponent. @param g the Graphics context in which to paint @see #print @see #printComponent @see #printBorder @see #printChildren
Class JComponent, void printBorder(Graphics)

Prints the component's border. This is implemented to invoke paintBorder on the receivercomponent. OverridesOverride this if you wish to print the border differently that it is painted. @param g the Graphics context in which to paint @see #print @since 1.3
Class JComponent, void printChildren(Graphics)

Prints this component's children. This is implemented to invoke paintChildren on the receivercomponent. Override this if you wish to print the children differently than painting. @param g the Graphics context in which to paint @see #print @since 1.3
Class JComponent, void printComponent(Graphics)

This is invoked during a printing operation. This is implemented to invoke paintComponent on the receivercomponent. Override this if you wish to add special painting behavior when printing. @param g the Graphics context in which to paint @see #print @since 1.3
Class JComponent, boolean processKeyBinding(KeyStroke, KeyEvent, int, boolean)

Invoked to process the key bindings for ks as the result of the KeyEvent e. This obtains the appropriate InputMap gets the binding gets the action from the ActionMap and then (if the action is found and the receivercomponent is enabled) invokes notifyAction to notify the action. @param ks the KeyStroke queried @param e the KeyEvent @param condition one of the following values: @param pressed true if the key is pressed @return true if there was a binding to an action and the action was enabled @since 1.3
Class JComponent, void processKeyEvent(KeyEvent)

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

Adds 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. 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. @param key the new client property key @param value the new client property value; if null this method will remove the property @see #getClientProperty @see #addPropertyChangeListener

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 ConditionaCondition 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. @param anAction the Action to be registered @param aCommand the command to be set in the delivered event @param aKeyStroke the KeyStroke to bind to the action @param aCondition the condition that needs to be met see above @see KeyStroke

Class JComponent, void removeAncestorListener(AncestorListener)

Unregisters listener so that it will no longer receive AncestorEvents. @param listener the AncestorListener to be removed @see #addAncestorListener
Class JComponent, void removeNotify()

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

Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties. @param listener the PropertyChangeListener to be removed
Class JComponent, void removePropertyChangeListener(String, PropertyChangeListener)

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

Removes a VetoableChangeListener from the listener list. This removes a VetoableChangeListener that was registered for all properties. @param listener the VetoableChangeListener to be removed
Class JComponent, void repaint(Rectangle)

Adds the specified region to the dirty region list if the component is showing. The component will be repainted after all of the currently pending events have been dispatched. @param r a Rectangle containing the dirty region @see java.awt.Component#isShowing @see RepaintManager#addDirtyRegion
Class JComponent, void repaint(long, int, int, int, int)

Adds the specified region to the dirty region list if the component is showing. The component will be repainted after all of the currently pending events have been dispatched. @param tm this parameter is not used @param x the x value of the dirty region @param y the y value of the dirty region @param width the width of the dirty region @param height the height of the dirty region @see java.awt.Component#isShowing @see RepaintManager#addDirtyRegion
Class JComponent, boolean requestDefaultFocus()

Requests the focus for theon this componentJComponent's FocusTraversalPolicy's thatdefault shouldComponent. have theIf this focusJComponent byis default.a The default implementation will recursivelyfocus cycle root then its requestFocusTraversalPolicy theis focusused. onOtherwise the firstFocusTraversalPolicy component thatof this isJComponent's focus-traversable.cycle-root @returnancestor falseis ifused. the@see focusjava.awt.FocusTraversalPolicy#getDefaultComponent has@deprecated not beenAs of set1.4 otherwise returnreplaced by trueFocusTraversalPolicy.getDefaultComponent(Container).requestFocus()
Class JComponent, void resetKeyboardActions()

Unregisters all the bindings in the 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 reshape(int, int, int, int)

Moves and resizes this component. @param x the new horizontal location @param y the new vertical location @param w the new width @param h the new height @see java.awt.Component#setBounds
Class JComponent, void revalidate()

Supports deferred automatic layout.

Calls invalidate() and then adds this component'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 JViewport override this method and perform the scrolling. @param aRect the visible Rectangle @see JViewport
Class JComponent, void setActionMap(ActionMap)

Sets the ActionMap to am. This does not set the parent of the am to be the ActionMap from the UI (if there was one) it is up to the caller to have done this. @param am the new ActionMap @since 1.3
Class JComponent, void setAlignmentX(float)

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

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

Sets the autoscrolls property. If true this component will automatically scroll its contentsmouse dragged events will be synthetically generated when the mouse is dragged ifoutside of the component's bounds and mouse motion has paused (while the button continues to be held down). The synthetic events make it appear that the drag gesture has resumed in the direction established when containedthe component's boundary was crossed. Components that support autoscrolling must handle mouseDragged events by calling scrollRectToVisible with a rectangle that contains the mouse event's location. All of the Swing components that support item selection and are typically displayed in a JScrollPane (JTable JList JTree JTextArea and JEditorPane) already handle mouse dragged events in this way. To enable autoscrolling in any other component add a mouse motion listener that supportscalls scrollRectToVisible. scrolling such asFor example given JViewporta JPanel myPanel:
 MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() { public void mouseDragged(MouseEvent e) { Rectangle r = new Rectangle(e.getX() e.getY() 1 1); ((JPanel)e.getSource()).scrollRectToVisible(r); } }; myPanel.addMouseMotionListener(doScrollRectToVisible); 
The default value of the autoScrolls property is false
. @seeparam JViewportautoscrolls if true synthetic mouse dragged events are generated when the mouse is dragged outside of a component's bounds and the mouse button continues to be held down; otherwise false @see #getAutoscrolls @see JViewport @see JScrollPane @beaninfo expert: true description: WhetherDetermines if this component automatically scrolls its contents when dragged.
Class JComponent, void setBackground(Color)

Sets the background color of this component. @param bg the desired background Color @see java.awt.Component#getBackground @beaninfo preferred: true bound: true attribute: visualUpdate true description: The background color of the component.
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 (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@param debugOptions determines how the component should display thisthe information; one of the following options: debugOptions is bitwise OR'd into the current value @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)

Sets whether the receivingthis 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'sSwings painting system always useuses 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. @param aFlag if true set this component to be double buffered
Class JComponent, void setEnabled(boolean)

Sets whether or not this component is enabled. A component that is enabled may respond to user input while a component that 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.

Note: Disabling a component does not disable it's children.

Note: Disabling a lightweight component does not prevent it from receiving MouseEvents. @param enabled true if this component should be enabled false otherwise @see java.awt.Component#isEnabled @see java.awt.Component#isLightweight @beaninfo preferred: true bound: true attribute: visualUpdate true description: The enabled state of the component.

Class JComponent, void setFont(Font)

Sets the font for this component. @param the desired Font for this component @see java.awt.Component#getFont @beaninfo preferred: true bound: true attribute: visualUpdate true description: The font for the component.
Class JComponent, void setForeground(Color)

Sets the foreground color of this component. @param fg the desired foreground Color @see java.awt.Component#getForeground @beaninfo preferred: true bound: true attribute: visualUpdate true description: The foreground color of the component.
Class JComponent, void setInputMap(int, InputMap)

Sets the InputMap to use under the condition condition to map. A null value implies you do not want any bindings to be used even from the UI. This will not reinstall the UI InputMap (if there was one). Conditioncondition ishas one of the following values: If condition is WHEN_IN_FOCUSED_WINDOW and map is not a ComponentInputMap an IllegalArgumentException will be thrown. Similarly if condition is not one of the values justlisted mentioned an IllegalArgumentException will be thrown. @param condition one of the values listed above @param map the InputMap to use for the given condition @exception IllegalArgumentException if condition is WHEN_IN_FOCUSED_WINDOW WHEN_FOCUSEDand WHEN_ANCESTOR_OF_FOCUSED_COMPONENTmap is not an instance of ComponentInputMap; or if condition is not one of the legal values specified above @since 1.3
Class JComponent, void setInputVerifier(InputVerifier)

Sets the input verifier for this component. @param inputVerifier the new input verifier @since 1.3 @see InputVerifier @beaninfo bound: true description: The component's input verifier.
Class JComponent, void setMaximumSize(Dimension)

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

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

SpecifiesOverrides the nextdefault componentFocusTraversalPolicy to getfor this theJComponent's focus after this onetraversal cycle by forunconditionally setting the specified exampleComponent whenas the tabnext Component key isin the pressed.cycle Invokeand this methodJComponent toas override the defaultspecified focus-changeComponent's previous Component in the sequencecycle. @beaninfoparam expert:aComponent truethe description:Component Thethat nextshould follow componentthis JComponent to getin the focus aftertraversal thiscycle @see #getNextFocusableComponent @see java.awt.FocusTraversalPolicy @deprecated oneAs of 1.4 replaced by FocusTraversalPolicy
Class JComponent, void setOpaque(boolean)

If true the component paints every pixel within its bounds. Otherwise the component may not paint some or all of its pixels allowing the underlying pixels to show through.

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

Class JComponent, void setPreferredSize(Dimension)

Sets the preferred size of the receivingthis component. If 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)

SetsProvides a hint as to whether the receiving componentor not this canJComponent obtain theshould get focus. by callingThis is requestFocus.only The defaulta hint valueand it is true.up to consumers that are requesting focus Note:to Settinghonor this property. toThis is typically honored false willfor mouse operations but not preventkeyboard theoperations. focus manager from setting the focus toFor example look and feels could verify this componentproperty it will prevent the component from gettingis true before requesting focus during a themouse operation. This would often times be used if you did not want a mouse press on a JComponent to steal focus whenbut did want the focusJComponent isto be traversable requestedvia explicitlythe keyboard. Override isFocusTraversable and return false ifIf you do not want this theJComponent component should never getfocusable at all use the focussetFocusable method instead. @beaninfoparam expert:requestFocusEnabled trueIndicates if description:you Whetherwant thethis JComponent component can obtain theto be focusable or focusnot @see byFocus callingSpecification requestFocus@see java.awt.Component#setFocusable
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 the string to display; if 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)

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

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

 public SliderUI getUI() { return (SliderUI)ui; } 
@param newUI the new UI delegate @see #updateUI @see UIManager#getLookAndFeel @see UIManager#getUI @beaninfo bound: true hidden: true attribute: visualUpdate true description: The component's look and feel delegate.
Class JComponent, void setVerifyInputWhenFocusTarget(boolean)

SetSets the value to indicate whether input verifier for the current focus owner will be called before this component requests focus. The default is true. Set to false on components such as a Cancel button or a scrollbar which should activate even if the input in the current focus owner is not "passed" by the input verifier for that component. @param newflag value for the verifyInputWhenFocusTarget property @see InputVerifier @see #setInputVerifier @see #getInputVerifier @see #getVerifyInputWhenFocusTarget @since 1.3 @beaninfo bound: true description: Whether the Component verifies input before accepting focus.
Class JComponent, void setVisible(boolean)

Makes the component visible or invisible. Overrides Component.setVisible. @param aFlag true to make the component visible; false to make it invisible @beaninfo attribute: visualUpdate true
Class JComponent, void unregisterKeyboardAction(KeyStroke)

This 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 InputMapsInputMaps to be active whereas putting a dummy binding in the InputMap effectively disables the binding from ever happening.

Unregisters a keyboard action. This will remove the binding from the ActionMap (if it exists) as well as the InputMapsInputMaps.

Class JComponent, void update(Graphics)

Calls paint(g). Doesn't clear the background but see ComponentUI.update() which is called by paintComponent. @param g the Graphics context in which to paint @see #paint @see #paintComponent @see javax.swing.plaf.ComponentUI
Class JComponent, void updateUI()

Resets the UI property to a value from the current look and feel. JComponent subclasses must override this method like this:
 public void updateUI() { setUI((SliderUI)UIManager.getUI(this); } 
@see #setUI @see UIManager#getLookAndFeel @see UIManager#getUI
Class JComponent, int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT

Constant used for registerKeyboardAction() that means that the command 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() that means that the command should be invoked when the component has the focus.
Class JComponent, int WHEN_IN_FOCUSED_WINDOW

Constant used for registerKeyboardAction() that 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 AccessibleContext associated with this 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 Looklook and Feelfeel (L&F). Note that JDesktopPane does not support borders.

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 Looklook and Feelfeel (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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see JInternalFrame @see JInternalFrame.JDesktopIcon @see DesktopManager @version 1.37 0444 12/0603/0001 @author David Kloba


Class JDesktopPane.AccessibleJDesktopPane

This class implements accessibility support for the JDesktopPane class. It provides an implementation of the Java Accessibility API appropriate to desktop 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JDesktopPane, constructor JDesktopPane()

Creates a new JDesktopPane.
Class JDesktopPane, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JDesktopPane. 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 JDesktopPane
Class JDesktopPane, JInternalFrame[] getAllFrames()

Returns all JInternalFrames currently displayed in the desktop. Returns iconified frames as well as expanded frames. @return an array of JInternalFrame objects
Class JDesktopPane, JInternalFrame[] getAllFramesInLayer(int)

Returns all JInternalFrames currently displayed in the specified layer of the desktop. Returns iconified frames as well expanded frames. @param layer an int specifying the desktop layer @return an array of JInternalFrame objects @see JLayeredPane
Class JDesktopPane, DesktopManager getDesktopManager()

Returns the DesktopManger that handles desktop-specific UI actions. @param d the DesktopManager currently in use
Class JDesktopPane, int getDragMode()

GetGets the current "dragging style" used by the desktop pane. @return either Live_DRAG_MODE or OUTLINE_DRAG_MODE @see #setDragMode
Class JDesktopPane, JInternalFrame getSelectedFrame()

returnReturns the currently active JInternalFrame in this JDesktopPane or null if no JInternalFrame is currently active. @return the currently active JInternalFrame or null @since 1.3
Class JDesktopPane, DesktopPaneUI getUI()

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

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

Returns a string representation of this JDesktopPane. 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 JDesktopPane.
Class JDesktopPane, void setDesktopManager(DesktopManager)

Sets the DesktopManger that will handle desktop-specific UI actions. @param d the DesktopManager to use
Class JDesktopPane, void setDragMode(int)

SetSets the "dragging style" used by the desktop pane. You may want to change to one mode or another for performance or aesthetic reasons. @param dragMode the style of drag to use for items in the Desktop @see #LIVE_DRAG_MODE @see #OUTLINE_DRAG_MODE @beaninfo bound: true description: Dragging style for internal frame children. enum: LIVE_DRAG_MODE JDesktopPane.LIVE_DRAG_MODE OUTLINE_DRAG_MODE JDesktopPane.OUTLINE_DRAG_MODE
Class JDesktopPane, void setSelectedFrame(JInternalFrame)

setSets the currently active JInternalFrame in this JDesktopPane. @param f Thethe internal frame that's currently selected @since 1.3
Class JDesktopPane, void setUI(DesktopPaneUI)

Sets the L&F object that renders this component. @param ui the DesktopPaneUI L&F object @see UIDefaults#getUI @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the Component's LookAndFeel.
Class JDesktopPane, 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 JDesktopPane, int LIVE_DRAG_MODE

Used toIndicates that indicate you wish to see the entire contents of the item being dragged should appear inside the desktop pane. @see #OUTLINE_DRAG_MODE @see #setDragMode
Class JDesktopPane, int OUTLINE_DRAG_MODE

Used toIndicates that indicate you wish to see only an outline only of the item being dragged should appear inside the desktop pane. @see #LIVE_DRAG_MODE @see #setDragMode

Class JDialog

The main class for creating a dialog window. You can use this class to create a custom dialog or invoke the many class 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 its 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 prinicipleprinciple 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.

In a multi-screen environment you can create a JDialog on a different screen device than its owner. See java.awt.Frame for more information.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see JOptionPane @see JRootPane @beaninfo attribute: isContainer true attribute: containerDelegate getContentPane description: A toplevel window for creating dialog boxes. @version 1.53 0866 12/0503/0001 @author David Kloba @author James Gosling @author Scott Violet

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

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale

Class JDialog, constructor JDialog(Dialog)

Creates a non-modal dialog without a title with the specifedspecified Dialog as its owner.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param owner the non-null Dialog from which the dialog is displayed @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale

Class JDialog, constructor JDialog(Dialog, String)

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

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param owner the non-null Dialog from which the dialog is displayed @param title the String to display in the dialog's title bar @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale

Class JDialog, constructor JDialog(Dialog, String, boolean)

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

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param owner the non-null Dialog 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 other windows to be active at the same time @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale

Class JDialog, constructor JDialog(Dialog, boolean)

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

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param owner the non-null Dialog from which the dialog is displayed @param modal true for a modal dialog false for one that allows other windows to be active at the same time @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale

Class JDialog, constructor JDialog(Frame)

Creates a non-modal dialog without a title with the specifedspecified Frame as its owner. If owner is null a shared hidden frame will be set as the owner of the dialog.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param owner the Frame from which the dialog is displayed @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale

Class JDialog, constructor JDialog(Frame, String)

Creates a non-modal dialog with the specified title and with the specified owner frame. If owner is null a shared hidden frame will be set as the owner of the dialog.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param owner the Frame from which the dialog is displayed @param title the String to display in the dialog's title bar @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale

Class JDialog, constructor JDialog(Frame, String, boolean)

Creates a modal or non-modal dialog with the specified title and the specified owner Frame. If owner is null a shared hidden frame will be set as the owner of this dialog. All constructors defer to this one.

NOTE: Any popup components (JComboBox JPopupMenu JMenuBar) created within a modal dialog will be forced to be lightweight.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param owner the Frame 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 other windows to be active at the same time @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale

Class JDialog, constructor JDialog(Frame, boolean)

Creates a modal or non-modal dialog without a title and with the specified owner Frame. If owner is null a shared hidden frame will be set as the owner of the dialog.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @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 @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale

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 rootPaneCheckingEnabled true
Class JDialog, void processKeyEvent(KeyEvent)

Processes key events occurring on this component andby dispatching them to any registered KeyListener objects.

This method is not called unless key events are enabled for this component. Key events are enabled when one of the following occurs:

Note that this method is not called by the event dispatch thread if appropriatethe component passes them on to components inis not the focus owner of if the dialogcomponent is not showing. This method is called when whichkey events haveare registered interestvia the addKeyListener or enableEvents methods but as of release 1.4 the implementation of the AWT event dispatching thread redirects KeyEvent to the focus owner. Please see the Focus Specification for further information.

If the event parameter is null the behavior is unspecified and may result in theman exception. @param e the key event @see java.awt.Componentevent.KeyEvent @see java.awt.event.KeyListener @see #addKeyListener @see #enableEvents @see #processKeyEventisShowing @since JDK1.1

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 BorderLayoutGridLayout(1 2)) 
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 setLocationRelativeTo(Component)

Sets the location of the dialogwindow relative to the specified component. If the component is not currently showing or c is null the dialogwindow is centered on the screen. If the bottom of the component is offscreen the window is displayed to the right of the component. @param c the component in relation to which the dialogwindow's location is determined @since 1.4
Class JDialog, void update(Graphics)

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 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 HTML 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 HTML 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 HTML EditorKit will generate hyperlink events if the JEditorPane is not editable (JEditorPane.setEditable(false); has been called). If HTML 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 HTML 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).

Newlines
For a discussion on how newlines are handled see DefaultEditorKit.

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 futureAs release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A text component to edit various types of content. @author Timothy Prinzing @version 1.97 04113 12/0603/0001


Class JEditorPane.AccessibleJEditorPane

This class implements accessibility support for the JEditorPane class. It provides an implementation of the Java Accessibility API appropriate to editor 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder

Class JEditorPane.AccessibleJEditorPane, String getAccessibleDescription()

Gets the accessibleDescription property of this object. If this property isn't set returnreturns the content type of this JEditorPane instead (e.g. "plain/text" "html/text" etc). @return the localized description of the object; null if this object does not have a description @see #setAccessibleName

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. AAs futureof 1.4 support for long term releasestorage of Swingall willJavaBeansTM provide support for baseline forhas been added to the serializedjava.beans formpackage. of SwingPlease see objectsjava.beans.XMLEncoder

Class JEditorPane.AccessibleJEditorPaneHTML, Accessible getAccessibleAt(Point)

Returns the Accessible child if one exists contained at the local coordinate Point. @param p The point definingrelative the top-left corner of theto Accessible given in the coordinate spacesystem of thethis object's parent. @return the Accessible if it exists at the specified location; elseotherwise null
Class JEditorPane.AccessibleJEditorPaneHTML, Accessible getAccessibleChild(int)

Returns the nthspecified Accessible child of the object. The Accessible children of an Accessible object are zero-based so the first child of an Accessible child is at index 0 the second child is at index 1 and so on. @param i zero-based index of child @return the nth Accessible child of the object @see #getAccessibleChildrenCount
Class JEditorPane.AccessibleJEditorPaneHTML, int getAccessibleChildrenCount()

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. @return the number of accessible children inof the object.

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 @exception NullPointerException if the type parameter is null
Class JEditorPane, boolean isManagingFocus()

Turns offChanges this tabJComponent's focus traversal oncekeys to CTRL+TAB and CTRL+SHIFT+TAB. Also prevents SortingFocusTraversalPolicy from considering descendants of this JComponent when computing a focus is gainedtraversal cycle. @returnsee truejava.awt.Component#setFocusTraversalKeys to@see indicateSortingFocusTraversalPolicy that@deprecated the focusAs of is1.4 beingreplaced managed;by orComponent.setFocusTraversalKeys(int Set) falseand otherwiseContainer.setFocusCycleRoot(boolean).
Class JEditorPane, void processComponentKeyEvent(KeyEvent)

OverriddenProcesses toany key handleevents processingthat the ofcomponent tab/shiftitself tabrecognizes. IfThis is called after the focus manager and any interested elisteners identifieshave been given a tabchance to steal away the editorevent. This panemethod is notcalled editableonly andif the event has components then thenot yet been FocusManagerconsumed. is asked to pass focusThis method is called prior to the next/previouskeyboard componentUI logic. @param

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

Class JEditorPane, void processKeyEvent(KeyEvent)

MakeOverrides sureprocessKeyEvent that TABto process and Shift-TAB events get consumed so that awt doesn't attempt focus traversal. @param e the current key event
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. If the type is not recognized the content will be loaded using the EditorKit registered for plain text text/plain. @param type the non-null mime type for the content editing support @see #getContentType @beaninfo description: the type of content @throw NullPointerException if the type parameter is null

Class JEditorPane, void setPage(URL)

Sets the current URL 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 URL 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 separate 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. It will also be fired on the event-dispatch thread. 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 JFileChooser

JFileChooser provides a simple mechanism for the user to choose 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 for the user's home directory that sees only .jpg and .gif images:

 JFileChooser chooser = new JFileChooser(); // Note: source for ExampleFileFilter can be found in FileChooserDemo // under the demo/jfc directory in the Java 2 SDK Standard Edition. ExampleFileFilter filter = new ExampleFileFilter(); 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 fontfile. @version 1.6892 0212/0903/01 @author Jeff Dinkins
Class JFileChooser, constructor JFileChooser()

Constructs a JFileChooser pointing to the user's default directory. This default depends on the operating system. It is typically the "My Documents" folder on Windows and the user's home directory on Unix.
Class JFileChooser, constructor JFileChooser(File)

Constructs a JFileChooser using the given File as the path. Passing in a null file causes the file chooser to point to the user's default directory. This default depends on the operating system. It is typically the "My Documents" folder on Windows and the user's home directory on Unix. @param currentDirectory a File object specifying the path to a file or directory
Class JFileChooser, constructor JFileChooser(String)

Constructs a JFileChooser using the given path. Passing in a null string causes the file chooser to point to the user's default directory. This default depends on the operating system. It is typically the "My Documents" folder on Windows and the user's home directory on Unix. @param currentDirectoryPath a String giving the path to a file or directory
Class JFileChooser, void addActionListener(ActionListener)

Adds an ActionListener to the buttonfile chooser. @param l the listener to be added @see #approveSelection @see #cancelSelection
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 #resetChoosableFileFilterresetChoosableFileFilters
Class JFileChooser, void approveSelection()

Called by the UI when the user hits the Approve button (labeled "Open" or "Save" by default). This can also be called by the programmer. This method causes an action event to fire with the command string equal to APPROVE_SELECTION. @see #APPROVE_SELECTION
Class JFileChooser, void cancelSelection()

Called by the UI when the user chooses the Cancel button. This can also be called by the programmer. This method causes an action event to fire with the command string equal to CANCEL_SELECTION. @see #CANCEL_SELECTION
Class JFileChooser, void fireActionPerformed(String)

Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameterscommand passed into the fire methodparameter. @see EventListenerList
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 #resetChoosableFileFilterresetChoosableFileFilters
Class JFileChooser, boolean getControlButtonsAreShown()

Returns a boolean indicating whether the accept and cancel buttons arevalue shownof in the filecontrolButtonsAreShown chooserproperty. @return true if the accept &value cancelof buttons are shown;the otherwisecontrolButtonsAreShown falseproperty @see #setControlButtonsAreShown @since 1.3
Class JFileChooser, void removeActionListener(ActionListener)

Removes an ActionListener from the buttonfile chooser. @param l the listener to be removed @see #addActionListener
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 #resetChoosableFileFilterresetChoosableFileFilters
Class JFileChooser, void setAcceptAllFileFilterUsed(boolean)

Determines ifwhether the AcceptAll FileFilter is used as an available choice in the choosable filter list. If false the AcceptAll file filter is removed from the list of available file filters. If true the AcceptAll file filter will become the the actively used file filter. @beaninfo preferred: true bound: true description: Sets whether the AcceptAll FileFilter is used as an available choice in the choosable filter list. @see #isAcceptAllFileFilterUsed @see #getAcceptAllFileFilter @see #setFileFilter @since 1.3
Class JFileChooser, void setControlButtonsAreShown(boolean)

Sets the property that indicates whether the approve and cancel buttons are shown in the file chooser. This property is true by default. Look and feels that always show these buttons will ignore the value of this property. This method fires a property-changed event using the string value of CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY as the name of the property. @param b false if control buttons should not be shown; otherwise true @beaninfo preferred: true bound: true description: Sets whether the approve & cancel buttons are shown. @see #getControlButtonsAreShown @see #CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY @since 1.3
Class JFileChooser, void setCurrentDirectory(File)

Sets the current directory. Passing in null sets the file chooser to point to the user's default directory. This default depends on the operating system. It is typically the "My Documents" folder on Windows and the user's home directory on Unix. 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 directory or hits the root of the file system. @beaninfo preferred: true bound: true description: The directory that the JFileChooser is showing files of. @param dir the current directory to point to @see #getCurrentDirectory
Class JFileChooser, int showDialog(Component, String)

Pops a custom file chooser dialog with a custom approve button. For example the following code pops up a file chooser with a "Run Application" button (instead of the normal "Save" or "Open" button):
 filechooser.showDialog(parentFrame "Run Application"); 
Alternatively the following code does the same thing:
 JFileChooser chooser = new JFileChooser(null); chooser.setApproveButtonText("Run Application"); chooser.showDialog(parentFrame 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 file chooser on popdown:

@exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless
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 file chooser on popdown: @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @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 file chooser on popdown: @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see #showDialog
Class JFileChooser, void updateUI()

NotificationResets from the UIFactoryUI property to thata value from the L&Fcurrent look has changedand feel. @see JComponent#updateUI

Class JFrame

An extended version of java.awt.Frame that adds support for the JFC/Swing component architecture. You can find task-oriented documentation about using JFrame in The Java Tutorial in the section How to Make Frames.

The JFrame class is slightly incompatible with Frame. Like all other JFC/Swing top-level containers a JFrame contains a JRootPane as its only child. The content pane provided by the root pane should as a rule contain all the non-menu components displayed by the JFrame. This is different from the AWT Frame case. For example to add a child to an AWT frame you'd write:

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

Unlike a Frame a JFrame has some notion 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 behave the same as a Frame instance use setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE).

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

In a multi-screen environment you can create a JFrame on a different screen device. See java.awt.Frame for 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @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.79 0890 12/0503/0001 @author Jeff Dinkins @author Georges Saab @author David Kloba

Class JFrame, constructor JFrame()

Constructs a new frame that is initially invisible.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see Component#setSize @see Component#setVisible @see JComponent#getDefaultLocale

Class JFrame, constructor JFrame(GraphicsConfiguration)

Creates a Frame in the specified GraphicsConfiguration of a screen device and a blank title.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param gc the GraphicsConfiguration that is used to construct the new Frame; if gc is null the system default GraphicsConfiguration is assumed @exception IllegalArgumentException if gc is not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale @since 1.3

Class JFrame, constructor JFrame(String)

Creates a new initially invisible Frame with the specified title.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param title the title for the frame @exception HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see Component#setSize @see Component#setVisible @see JComponent#getDefaultLocale

Class JFrame, constructor JFrame(String, GraphicsConfiguration)

Creates a JFrame with the specified title and the specified GraphicsConfiguration of a screen device.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param title the title to be displayed in the frame's border. A null value is treated as an empty string "". @param gc the GraphicsConfiguration that is used to construct the new JFrame with; if gc is null the system default GraphicsConfiguration is assumed @exception IllegalArgumentException if gc is not from a screen device. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see JComponent#getDefaultLocale @since 1.3

Class JFrame, void processKeyEvent(KeyEvent)

Processes key events occurring on this component andby dispatching them to any registered KeyListener objects.

This method is not called unless key events are enabled for this component. Key events are enabled when one of the following occurs:

Note that this method is not called by the event dispatch thread if appropriatethe component passes them on to components inis not the focus owner of if the framecomponent is not showing. This method is called when whichkey events haveare registered interestvia the addKeyListener or enableEvents methods but as of release 1.4 the implementation of the AWT event dispatching thread redirects KeyEvent to the focus owner. Please see the Focus Specification for further information.

If the event parameter is null the behavior is unspecified and may result in theman exception. @param e the key event @see java.awt.Componentevent.KeyEvent @see java.awt.event.KeyListener @see #addKeyListener @see #enableEvents @see #processKeyEventisShowing @since JDK1.1

Class JFrame, void setDefaultCloseOperation(int)

Sets the operation that will happen by default when the user initiates a "close" on this frame. You must specify one of the following choices:

The value is set to HIDE_ON_CLOSE by default. @param operation the operation which should be performed when the user closes the frame @exception IllegalArgumentException if defaultCloseOperation value isn't one of the above valid values @see #addWindowListener @see #getDefaultCloseOperation @see WindowConstants @beaninfo preferred: true bound: 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 JFrameWindowConstants.EXIT_ON_CLOSE description: The frame's default close operation.

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:
 thiComponentthisComponent.getContentPane().setLayout(new BorderLayoutGridLayout(1 2)) 
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 @exception Error if called with rootPaneChecking true @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. For task-oriented documentation and examples of using internal frames see How to Use Internal Frames a section in The Java Tutorial.

Generally you add JInternalFrames to a JDesktopPane. The UI delegates the look-and-feel-specific actions to the DesktopManager object maintained by the JDesktopPane.

The JInternalFrame contentPanecontent pane is where you add child components. So to create a JInternalFrame that has a number of buttons arranged with athe content pane's default BorderLayout object you might do something like this:

 JComponent c = (JComponent) frameinternalFrame.getContentPane(); c.setLayout(new BorderLayout()); c.add(new JButton() BorderLayout.NORTH); c.add(new JButton() BorderLayout.CENTER); 
The contentPanecontent pane is actually managed by an instance of JRootPane which also manages a layoutPanelayout glassPanepane glass pane and optional menuBarmenu bar for the internal frame. Please see the JRootPane documentation for a complete description of these components.

For the keyboard keys used by this component in the standard Looklook and Feel (L&F)feel 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see InternalFrameEvent @see JDesktopPane @see DesktopManager @see JInternalFrame.JDesktopIcon @see JRootPane @version 1.116 02135 12/0903/01 @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

This class implements accessibility support for the JInternalFrame class. It provides an implementation of the Java Accessibility API appropriate to internal frame 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder

Class JInternalFrame.AccessibleJInternalFrame, String getAccessibleName()

Get the accessible name of this object. @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()

GetGets the AccessibleValue associated with this object. In the implementation of the Java Accessibility API for this class returnreturns this object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object
Class JInternalFrame.AccessibleJInternalFrame, Number getCurrentAccessibleValue()

Get the value of this object as a Number. @return value of the object -- can be null if this object does not have a value
Class JInternalFrame.AccessibleJInternalFrame, Number getMaximumAccessibleValue()

Get the maximum value of this object as a Number. @return Maximum value of the object; null if this object does not have a maximum value
Class JInternalFrame.AccessibleJInternalFrame, Number getMinimumAccessibleValue()

Get the minimum value of this object as a Number. @return Minimum value of the object; null if this object does not have a minimum value
Class JInternalFrame.AccessibleJInternalFrame, boolean setCurrentAccessibleValue(Number)

Set the value of this object as a Number. @return Truetrue if the value was set.

Class JInternalFrame.JDesktopIcon

This component represents an iconified version of a JInternalFrame. This API should NOT BE USED by Swing applications as it will go away in future versions of Swing as its functionality is moved into JInternalFrame. This class is public only so that UI objects can display a desktop icon. If an application wants to display a desktop icon it should create a JInternalFrame instance and iconify 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @author David Kloba


Class JInternalFrame.JDesktopIcon.AccessibleJDesktopIcon

This class implements accessibility support for the JInternalFrame.JDesktopIcon class. It provides an implementation of the Java Accessibility API appropriate to desktop icon 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder

Class JInternalFrame.JDesktopIcon.AccessibleJDesktopIcon, AccessibleRole getAccessibleRole()

GetGets the role of this object. @return an instance of AccessibleRole describing the role of the object @see AccessibleRole
Class JInternalFrame.JDesktopIcon.AccessibleJDesktopIcon, AccessibleValue getAccessibleValue()

GetGets the AccessibleValue associated with this object. In the implementation of the Java Accessibility API for this class returnreturns this object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object
Class JInternalFrame.JDesktopIcon.AccessibleJDesktopIcon, Number getCurrentAccessibleValue()

GetGets the value of this object as a Number. @return value of the object -- can be null if this object does not have a value
Class JInternalFrame.JDesktopIcon.AccessibleJDesktopIcon, Number getMaximumAccessibleValue()

GetGets the maximum value of this object as a Number. @return Maximummaximum value of the object; null if this object does not have a maximum value
Class JInternalFrame.JDesktopIcon.AccessibleJDesktopIcon, Number getMinimumAccessibleValue()

GetGets the minimum value of this object as a Number. @return Minimumminimum value of the object; null if this object does not have a minimum value
Class JInternalFrame.JDesktopIcon.AccessibleJDesktopIcon, boolean setCurrentAccessibleValue(Number)

SetSets the value of this object as a Number. @return Truetrue if the value was set.

Class JInternalFrame.JDesktopIcon, constructor JInternalFrame.JDesktopIcon(JInternalFrame)

CreateCreates an icon for an internal frame. @param f the JInternalFrame for which the icon is created
Class JInternalFrame.JDesktopIcon, JDesktopPane getDesktopPane()

ConvienceConvenience method to ask the icon for the Desktop object it belongs to. @return the JDesktopPane that contains this icon's internal frame or null if none found
Class JInternalFrame.JDesktopIcon, JInternalFrame getInternalFrame()

Returns the JInternalFrame that this DesktopIcon is associated with. @return the JInternalFrame with which this icon is associated with
Class JInternalFrame.JDesktopIcon, DesktopIconUI getUI()

Returns the L&Flook-and-feel object that renders this component. @return the DesktopIconUI object that renders this component
Class JInternalFrame.JDesktopIcon, String getUIClassID()

Returns the name of the L&Flook-and-feel class that renders this component. @return the string "DesktopIconUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JInternalFrame.JDesktopIcon, void setInternalFrame(JInternalFrame)

Sets the JInternalFrame thatwith which this DesktopIcon is associated with. @param f the JInternalFrame with which this icon is associated with
Class JInternalFrame.JDesktopIcon, void setUI(DesktopIconUI)

Sets the L&Flook-and-feel object that renders this component. @param ui the DesktopIconUI L&Flook-and-feel object @see UIDefaults#getUI
Class JInternalFrame.JDesktopIcon, void updateUI()

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

Class JInternalFrame, constructor JInternalFrame(String)

Creates a non-resizable non-closable non-maximizable non-iconifiable JInternalFrame with the specified title. Note that passing in a null title results in unspecified behavior and possibly an exception. @param title the non-null 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 internal 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 internal frame can be resized @param closable if true the internal 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 internal frame can be resized @param closable if true the internal frame can be closed @param maximizable if true the internal 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 constructorsJInternalFrame defer toconstructors use this one. @param title the String to display in the title bar @param resizable if true the internal frame can be resized @param closable if true the internal frame can be closed @param maximizable if true the internal frame can be maximized @param iconifiable if true the internal frame can be iconified
Class JInternalFrame, void addImpl(Component, Object, int)

ByEnsures that by default children may notcannot be added directly to a this component. theyInstead children must be added to its contentPanecontent insteadpane. For example:
 thisComponent.getContentPane().add(child) 
An attempt to add to directly to this component will cause ana runtime exception to be thrown. Subclasses can disable this behavior. @param comp the Component to be added @param constraints the object containing the constraints if any @param index the index @see #setRootPaneCheckingEnabled @exception Error if called with isRootPaneChecking true
Class JInternalFrame, void addInternalFrameListener(InternalFrameListener)

Adds the specified internal frame listener to receive internal frame events from this internal frame. @param l the internal frame listener
Class JInternalFrame, void dispose()

DisposesMakes of this internal frame invisible unselected and closed. If the frame is not already closed athis method fires an INTERNAL_FRAME_CLOSED event. The results of invoking this method are similar to setClosed(true) but dispose always succeeds in closing the internal frame-closed and does not fire an INTERNAL_FRAME_CLOSING event. is@see postedjavax.swing.event.InternalFrameEvent#INTERNAL_FRAME_CLOSED @see #setVisible @see #setSelected @see #setClosed
Class JInternalFrame, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JInternalFrame. For internal frames the AccessibleContext takes the form of an AccessibleJInternalFrame object. A new AccessibleJInternalFrame instance is created if necessary. @return an AccessibleJInternalFrame that serves as the AccessibleContext of this JInternalFrame @see AccessibleJInternalFrame
Class JInternalFrame, int getDefaultCloseOperation()

Returns the default operation whichthat occurs when the user initiates a "close" on this windowinternal frame. @return the operation that will occur when the user closes the internal frame @see #setDefaultCloseOperation
Class JInternalFrame, JDesktopIcon getDesktopIcon()

Returns the JDesktopIcon used when this JInternalFrame is iconified. @return the JDesktopIcon displayed on the desktop @see #setDesktopIcon
Class JInternalFrame, JDesktopPane getDesktopPane()

Convenience method that searchssearches the anscestorancestor heirarchyhierarchy for a JDesktop instance. If JInternalFrame finds none the desktopIcon tree is searched. @return the JDesktopPane this internal frame belongs to or null if none is found
Class JInternalFrame, Component getFocusOwner()

If this JInternalFrame is active returnreturns the child whichthat has focus. Otherwise returnreturns null. At present this method works only for JComponent children. @return the component with focus or null if no children have focus assigned to them. @since 1.3
Class JInternalFrame, Icon getFrameIcon()

Returns the image displayed in the title bar of thethis internal frame (usually in the top-left corner). @return the Icon displayed in the title bar @see #setFrameIcon
Class JInternalFrame, Component getGlassPane()

Returns the glassPaneglass objectpane for this internal frame. @return the glassPaneglass objectpane @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 internal frame @see #setJMenuBar
Class JInternalFrame, int getLayer()

Convenience method for getting the layer attribute of this component. @return an Integer object specifying this frame's desktop layer @see JLayeredPane
Class JInternalFrame, JLayeredPane getLayeredPane()

Returns the layeredPanelayered objectpane for this internal frame. @return thea layeredPaneJLayeredPane 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 menubarmenu bar or null if none has been set @deprecated As of Swing version 1.0.3 replaced by getJMenuBar().
Class JInternalFrame, Rectangle getNormalBounds()

If the JInternalFrame is not in maximized state returnreturns getBounds(); otherwise returnreturns the bounds that the JInternalFrame would be restored to. @return a Rectangle containing the bounds of this frame when in the normal state @since 1.3
Class JInternalFrame, JRootPane getRootPane()

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

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

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

Returns the name of the L&Flook-and-feel class whichthat renders this component. @return the string "InternalFrameUI" @see JComponent#getUIClassID @see UIDefaults#getUI @beaninfo description: UIClassID
Class JInternalFrame, String getWarningString()

Gets the warning string that is displayed with this windowinternal frame. Since an internal frame is always secure (since it's fully contained within a window whichthat might need a warning string) this method always returns null. @return null @see java.awt.Window#getWarningString
Class JInternalFrame, boolean isClosable()

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

Returns whether this JInternalFrame is currently closed. @return true if thethis internal frame is closed false otherwise
Class JInternalFrame, boolean isIcon()

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

ReturnsGets whether the JInternalFrameiconable can beproperty iconifiedwhich by somedefault useris actionfalse. @return truethe value ifof the frameiconable canproperty. be@see iconified#setIconifiable
Class JInternalFrame, boolean isMaximizable()

ReturnsGets whether the JInternalFrame canvalue beof maximized by somethe usermaximizable actionproperty. @return truethe value ifof the framemaximizable canproperty be@see maximized#setMaximizable
Class JInternalFrame, boolean isMaximum()

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

Returns whether the JInternalFrame can be resized by some user action. @return true if thethis internal frame can be resized false otherwise
Class JInternalFrame, boolean isRootPaneCheckingEnabled()

Returns whether calls to add and setLayout cause an exception to be thrown. @return true if add and setLayout are checked @see #addImpl @see #setLayout @see #setRootPaneCheckingEnabled
Class JInternalFrame, boolean isSelected()

Returns whether the JInternalFrame is the currently "selected" or active frame. @return true if thethis internal frame is currently selected (active) @see #setSelected
Class JInternalFrame, void moveToBack()

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

Convenience method that moves this component to position 0 if its parent is a JLayeredPane.
Class JInternalFrame, void pack()

Causes subcomponents of this JInternalFrame to be laid out at their preferred size. @see java.awt.Window#pack
Class JInternalFrame, String paramString()

Returns a string representation of this JInternalFrame. 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 JInternalFrame.
Class JInternalFrame, void reshape(int, int, int, int)

Moves and resizes this component. Unlike other components this implementation also forces re-layout so that frame decorations such as the title bar are always redisplayed. @param x an intinteger giving the component's new horizontal position measured in pixels from the left of its container @param y an intinteger giving the component's new vertical position measured in pixels from the bottom of its container @param width an intinteger giving the component's new width in pixels @param height an intinteger giving the component's new height in pixels
Class JInternalFrame, void restoreSubcomponentFocus()

This method directsRequests the internal frame to restore focus to the last subcomponent that had focus. This is used by the UI when the user selected thethis internal frame e.g.-- for example by clicking on the title bar. @since 1.3
Class JInternalFrame, void setClosable(boolean)

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

CallingCloses this internal frame if the argument is true. Do not invoke this method with a valuefalse argument; the result of invoking truesetClosed(false) is unspecified.

If the internal frame is already closed this method does nothing and returns immediately. Otherwise this method begins by firing an INTERNAL_FRAME_CLOSING event. Then this method sets the closed property to closetrue unless a listener vetoes the property change. This method finishes by making the internal frame invisible and unselected and then firing an INTERNAL_FRAME_CLOSED event. @param

bNote: To reuse an internal frame that has been closed you must add it to a booleancontainer where(even trueif you never removed it from its meansprevious "closecontainer). Typically this container will be the JDesktopPane that previously contained the internal frame". @param b must be true @exception PropertyVetoException when the attempt to set the property is vetoed by the JInternalFrame @see #isClosed() @see #setDefaultCloseOperation @see #dispose @see javax.swing.event.InternalFrameEvent#INTERNAL_FRAME_CLOSING @beaninfo bound: true constrained: true description: Indicates thatwhether thethis internal frame has been closed.

Class JInternalFrame, void setContentPane(Container)

Sets this JInternalFrame's contentcontentPane paneproperty. @param c the contentPanecontent objectpane for this internal 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 internal frame where child components are normally inserted.
Class JInternalFrame, void setDefaultCloseOperation(int)

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

DO_NOTHING_ON_CLOSE - do not
Do do anythingnothing. - requireThis requires the program to handle the operation in the windowClosing method of a registered InternalFrameListener object.
HIDE_ON_CLOSE - automatically hide
Automatically make the windowinternal afterframe invokinginvisible.
DISPOSE_ON_CLOSE any registered
Automatically InternalFrameListenerdispose of the internal frame.

The default value objects is DISPOSE_ON_CLOSE. - automatically hide and disposeBefore performing the specified close operation the window after invoking anyinternal frame fires an registeredINTERNAL_FRAME_CLOSING InternalFrameListenerevent. objects@param The value is set tooperation one of the following constants defined DISPOSEin javax.swing.WindowConstants (an interface implemented by JInternalFrame): DO_NOTHING_ON_CLOSE byHIDE_ON_CLOSE default.or DISPOSE_ON_CLOSE @see #addInternalFrameListener @see #getDefaultCloseOperation @see #setVisible @see #dispose @see InternalFrameEvent#INTERNAL_FRAME_CLOSING

Class JInternalFrame, void setDesktopIcon(JDesktopIcon)

Sets the JDesktopIcon associated with this JInternalFrame. @param d the JDesktopIcon to display on the desktop @see #getDesktopIcon @beaninfo bound: true description: The icon shown when this internal frame is minimized.
Class JInternalFrame, void setFrameIcon(Icon)

Sets an image to be displayed in the titlebar of thethis internal frame (usually in the top-left corner). This image is not the desktopIcon object which is the image displayed in the JDesktop when thethis internal frame is iconified. Passing null to this function is valid but the L&Flook and feel can choose the appropriate behavior for that situation such as displaying no icon or a default icon for the L&Flook and feel. @param icon the Icon to display in the title bar @see #getFrameIcon @beaninfo bound: true description: The icon shown in the top-left corner of thethis internal frame.
Class JInternalFrame, void setGlassPane(Component)

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

Iconizes andIconifies or de-iconizesiconifies this internal frame if the look and feel supports iconification. If the internal frame's state changes to iconified this method fires an INTERNAL_FRAME_ICONIFIED event. If the state changes to de-iconified an INTERNAL_FRAME_DEICONIFIED event is fired. @param b a boolean where true means to iconify thethis internal frame and false means to de-iconify it @exception PropertyVetoException when the attempt to set the property is vetoed by the JInternalFrame @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED @beaninfo bound: true constrained: true description: The image displayed when this internal frame is minimized.
Class JInternalFrame, void setIconifiable(boolean)

Sets that the JInternalFrameiconable canproperty which must be true for the user to be madeable to make the JInternalFrame an icon. by someSome look userand feels might not implement iconification; they will ignore this actionproperty. @param b a boolean where true means thethis internal frame can be iconified @beaninfo preferred: true bound: true description: Determines whether this internal frame can be iconified.
Class JInternalFrame, void setJMenuBar(JMenuBar)

Sets the JMenuBarmenuBar property for this JInternalFrame. @param m the JMenuBar to use in this internal frame @see #getJMenuBar @beaninfo bound: true preferred: true description: The menubarmenu bar for accessing pulldown menus from this internal frame.
Class JInternalFrame, void setLayer(Integer)

Convenience method for setting the layer attribute of this component. @param layer an Integer object specifying this frame's desktop layer @see JLayeredPane @beaninfo expert: true description: Specifies what desktop layer is used.
Class JInternalFrame, void setLayer(int)

Convenience method for setting the layer attribute of this component. The method setLayer(Integer) should be used for layer values predefined in JLayeredPane. When using setLayer(int) care must be taken not to accidentally clash with those values. @param layer an intinteger specifying this internal frame's desktop layer @since 1.3 @see #setLayer(Integer) @see JLayeredPane @beaninfo expert: true description: Specifies what desktop layer is used.
Class JInternalFrame, void setLayeredPane(JLayeredPane)

Sets this JInternalFrame's layeredPane property. @param layered the layeredPaneJLayeredPane object for this internal 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)

ByEnsures that by default the layout of this component may notcannot be set. Instead the layout of its contentPanecontent pane should be set instead. For example:
 thisComponent.getContentPane().setLayout(new BorderLayoutGridLayout(1 2)) 
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 isRootPaneChecking true
Class JInternalFrame, void setMaximizable(boolean)

Sets thatthe maximizable property which determines whether the JInternalFrame can be maximized by some user action. Some look and feels might not support maximizing internal frames; they will ignore this property. @param b atrue boolean where true means theto specify that this internal frame canshould be maximizedmaximizable; false to specify that it should not be @beaninfo bound: true preferred: true description: Determines whether this internal frame can be maximized.
Class JInternalFrame, void setMaximum(boolean)

Maximizes and restores thethis internal 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 thethis internal frame and false restores it @exception PropertyVetoException when the attempt to set the property is vetoed by the JInternalFrame @beaninfo bound: true constrained: true description: Indicates whether thethis internal frame is maximized.
Class JInternalFrame, void setMenuBar(JMenuBar)

Sets the JMenuBarmenuBar property for this JInternalFrame. @param m the JMenuBar to use in this internal frame @see #getJMenuBar @deprecated As of Swing version 1.0.3 replaced by setJMenuBar(JMenuBar m).
Class JInternalFrame, void setNormalBounds(Rectangle)

Sets the normal bounds for this internal frame the bounds that thethis internal frame would be restored to from its maximized state. This method is intended for use only by desktop managers. @param r the bounds that thethis internal frame should be restored to @since 1.3
Class JInternalFrame, void setResizable(boolean)

Sets thatwhether the JInternalFrame can be resized by some user action. @param b a boolean where true means thethis internal frame can be resized @beaninfo preferred: true bound: true description: Determines whether thethis internal frame can be resized by the user.
Class JInternalFrame, void setRootPane(JRootPane)

Sets the rootPane property for this JInternalFrame. This method is called by the constructor. @param root the new rootPaneJRootPane object @beaninfo bound: true hidden: true description: The rootPaneroot pane used by this internal frame.
Class JInternalFrame, void setRootPaneCheckingEnabled(boolean)

Determines whether calls to add and setLayout 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
Class JInternalFrame, void setSelected(boolean)

Selects andor deselects the JInternalFrameinternal frame if it's showing. A JInternalFrame normally draws its title bar differently if it is the selected frame which indicates to the user that this internalFrameinternal frame has the focus. When this method changes the state of the internal frame from deselected to selected it fires an InternalFrameEvent.INTERNAL_FRAME_ACTIVATED event. If the change is from selected to deselected an InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED event is fired. @param selected a boolean where true means thethis internal frame isshould become selected (currently active) and false means it isshould become notdeselected @exception PropertyVetoException when the attempt to set the property is vetoed by the receiver.JInternalFrame @see #isShowing @see InternalFrameEvent#INTERNAL_FRAME_ACTIVATED @see InternalFrameEvent#INTERNAL_FRAME_DEACTIVATED @beaninfo constrained: true bound: true description: Indicates whether this internal frame is currently the active frame.
Class JInternalFrame, void setUI(InternalFrameUI)

Sets the UI delegate for this JInternalFrame. @param ui the UI delegate @beaninfo expertbound: true hidden: true attribute: visualUpdate true description: The InternalFrameUI implementationUI object that definesimplements the labels look andComponent's feelLookAndFeel.
Class JInternalFrame, void show()

Shows thisIf the internal frame andis not visible brings itthe internal frame to the front makes it visible and attempts to select it. If this window is notThe first time the internal frame yetis made visible this method also fires an showINTERNAL_FRAME_OPENED makesevent. itThis visible.method Ifdoes thisnothing if the internal windowframe is already visible. thenInvoking this method bringshas it to thethe same result frontas invoking setVisible(true). @see java.awt.Window#showmoveToFront @see java.awt.Window#toFrontsetSelected @see java.awt.ComponentInternalFrameEvent#INTERNAL_FRAME_OPENED @see #setVisible
Class JInternalFrame, void toBack()

Sends this internal frame to the back. Places this internal frame at the bottom of the stacking order and makes the corresponding adjustment to other visible windowsinternal frames. @see java.awt.Window#toBack @see #moveToBack
Class JInternalFrame, void toFront()

Brings this internal frame to the front. Places this internal frame at the top of the stacking order and makes the corresponding adjustment to other visible windowsinternal frames. @see java.awt.Window#toFront @see #moveToFront
Class JInternalFrame, void updateUI()

Notification from the UIManager that the L&Flook and feel has changed. Replaces the current UI object with the latest version from the UIManager. @see JComponent#updateUI
Class JInternalFrame, String IS_CLOSED_PROPERTY

Constrained property name indicating that the internal frame is closed.
Class JInternalFrame, String IS_ICON_PROPERTY

Constrained property name indicating that the internal frame is iconified.
Class JInternalFrame, String IS_MAXIMUM_PROPERTY

Constrained property name indicating that the internal frame is maximized.
Class JInternalFrame, JDesktopIcon desktopIcon

The icon that is displayed when thethis internal frame is iconizediconified. @see #iconable
Class JInternalFrame, Icon frameIcon

The icon shown in the top-left corner of thethis internal frame.
Class JInternalFrame, boolean iconable

The frame can "iconizediconified" (shrunk down and displayed as an icon-image). @see JInternalFrame.JDesktopIcon @see #setIconifiable
Class JInternalFrame, boolean isIcon

The frame has been iconizediconified. @see #iconableisIcon()
Class JInternalFrame, JRootPane rootPane

The JRootPane instance that manages the contentPanecontent pane and optional menuBarmenu bar for this internal frame as well as the glassPaneglass pane. @see JRootPane @see RootPaneContainer
Class JInternalFrame, boolean rootPaneCheckingEnabled

If true then calls to add and setLayout cause an exception to be thrown.
Class JInternalFrame, String title

The title displayed in thethis internal frame's title bar.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A component that displays a short string and an icon. @version 1.100 02110 12/0203/0001 @author Hans Muller


Class JLabel.AccessibleJLabel

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JLabel, boolean imageUpdate(Image, int, int, int, int, int)

This is overridenoverridden to return false if the current Icon's Image is not equal to the passed in Image img. @see java.awt.image.ImageObserver @see java.awt.Component#imageUpdate(java.awt.Image int int int int int)
Class JLabel, void setUI(LabelUI)

Sets the L&F object that renders this component. @param ui the LabelUI L&F object @see UIDefaults#getUI @beaninfo expertbound: true hidden: true attribute: visualUpdate true description: The L&FUI object that renders thisimplements the componentComponent's LookAndFeel.
Class JLabel, void updateUI()

NotificationResets from the UIFactoryUI property to thata value from the L&Fcurrent look has changedand feel. @see JComponent#updateUI

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'sits 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.38 0436 02/0602/00 @author David Kloba


Class JLayeredPane.AccessibleJLayeredPane

This class implements accessibility support for the JLayeredPane class. It provides an implementation of the Java Accessibility API appropriate to layered 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JLayeredPane, int insertIndexForLayer(int, int)

PrimativePrimitive method that determines the proper location to insert a new child based on layer and position requests. @param layer an int specifying the layer @param position an int specifying the position within the layer @return an int giving the (absolute) insertion-index @see #getIndexOf
Class JLayeredPane, void moveToBack(Component)

Moves the component to the bottom of the components in it'sits current layer (position -1). @param c the Component to move @see #setPosition(Component int)
Class JLayeredPane, void moveToFront(Component)

Moves the component to the top of the components in it'sits current layer (position 0). @param c the Component to move @see #setPosition(Component int)
Class JLayeredPane, void setPosition(Component, int)

Moves the component to position within it'sits current layer where 0 is the topmost position within the layer and -1 is the bottommost position.

Note: Position numbering is defined by java.awt.Container and is the opposite of layer numbering. Lower position numbers are closer to the top (0 is topmost) and higher position numbers are closer to the bottom. @param c the Component to move @param position an int in the range -1..N-1 where N is the number of components in the component's current layer


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 a ListModel instance for you:
 // Create a JList that displays the strings in data[] String[] data = {"one" "two" "three" "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. For example:

 JScrollPane scrollPane = new JScrollPane(dataList); // Or in two steps: JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().setView(dataList); 

By default the JList selection model allows any combination of items to be selected at a time using the constant MULTIPLE_INTERVAL_SELECTION. The selection state is actually managed by a separate delegate object an instance of ListSelectionModel. However JList provides convenient properties for managing the selection.

 String[] data = {"one" "two" "three" "four"}; JList dataList = new JList(data); dataList.setSelectedIndex(1); // select "two" dataList.getSelectedValue(); // returns "two" 

The contents of a JList can be dynamic 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 list 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 JList(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 string // 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 JLabel 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()); setOpaque(true); return this; } } String[] data = {"one" "two" "three" "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 dataList is final because it's referred to by the anonymous MouseListener class.

For the keyboard keys used by this component in the standard look and feel (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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder

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.74 04101 12/0603/0001 @author Hans Muller


Class JList.AccessibleJList

This class implements accessibility support for the JList class. It provides an implementation of the Java Accessibility API appropriate to list 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder

Class JList.AccessibleJList, Accessible getAccessibleAt(Point)

Returns the Accessible child contained at the local coordinate Point if one exists. Otherwise returns null. @return the Accessible at the specified location if it exists
Class JList.AccessibleJList, 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 JList, constructor JList(ListModel)

Constructs 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, void addSelectionInterval(int, int)

Sets the selection to be the union of the specified interval with current selection. Both the anchor and lead indices are included. It's not neccessarynecessary for anchor to be less than lead. This is a convenience method that just delegates to the selectionModel. The DefaultListSelectionModel implementation will do nothing if either anchor or lead are -1. If anchor or lead are less than -1 IndexOutOfBoundsException is thrown. @param anchor the first index to add to the selection @param lead the last index to add to the selection @see ListSelectionModel#addSelectionInterval @see #setSelectionInterval @see #removeSelectionInterval @see #addListSelectionListener @exception IndexOutOfBoundsException if either anchor or lead are less than -1
Class JList, int getFirstVisibleIndex()

Returns the index of the first visible cell. The cell considered to be "first" depends on the list's componentOrientation property. If the orientation is horizontal left-to-right then the first visible cell is in the upperlist's upper-left corner. ofIf the JListorientation oris horizontal right-1to-left then the first visible cell ifis in the list's upper-right corner. If nothing is visible or the list is empty a -1 is returned. Note that thisthe returned cell may only be partially visible. @return the index of the first visible cell @see #getLastVisibleIndex @see JComponent#getVisibleRect
Class JList, int getLastVisibleIndex()

Returns the index of the last visible cell. The cell considered to be "last" depends on the list's componentOrientation property. If the orientation is horizontal left-to-right then the last visible cell is in the lowerJList's lower-right corner. ofIf the JListorientation oris horizontal right-1to-left then the last visible cell ifis in the JList's lower-left corner. If nothing is visible or the list is empty a -1 is returned. Note that thisthe returned cell may only be partially visible. @return the index of the last visible cell @see #getLastVisibleIndexgetFirstVisibleIndex @see JComponent#getVisibleRect
Class JList, Dimension getPreferredScrollableViewportSize()

Computes 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 layout orientation is not VERTICAL than this will return the value from getPreferredSize. The current ListUI is expected to override getPreferredSize to return an appropriate value. @return a dimension containing the size of the viewport needed to display visibleRowCount rows @see #getPreferredScrollableViewportSize @see #setPrototypeCellValue
Class JList, int getScrollableBlockIncrement(Rectangle, int, int)

Returns the distance to scroll to expose the next or previous block. incrementFor amountvertical scrolling we are using the follows rules:

For horizontal scrolling if the list is layed out horizontally (the orientation is VERTICAL_WRAP or HORIZONTAL_WRAP):

or visibleRect.width if the list is layed out vertically or list is empty.

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 the visibleRect.heightblock or visibleRectincrement amount.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()

Returns true if this JList is displayed in a JViewport and the viewport is taller than JList's preferred height or if the layout orientation is VERTICAL_WRAP and the number of visible rows is < 0; otherwise returns false. If false then don't track the viewport's height. This allows vertical scrolling if the JViewport is itself embedded in a JScrollPane. @return true if viewport is taller than Jlist's preferred height otherwise false @see Scrollable#getScrollableTracksViewportHeight
Class JList, boolean getScrollableTracksViewportWidth()

Returns true if this JList is displayed in a JViewport and the viewport is wider than JList's preferred width; or if the layout orientation is HORIZONTAL_WRAP and the visible row count is < 0; otherwise returns false. If false then don't track the viewport's width. This allows horizontal scrolling if the JViewport is itself embedded in a JScrollPane. @return true if viewport is wider than the JList's preferred width otherwise false @see Scrollable#getScrollableTracksViewportWidth
Class JList, Object[] getSelectedValues()

Returns an array of the values for the selected cells. The returned values are sorted in increasing index order. @return the selected values or an empty list if nothing is selected @see #isSelectedIndex @see #getModel @see #addListSelectionListener
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, int locationToIndex(Point)

ConvertsConvert a point in JList coordinates to the closest index of the cell at that location. ReturnsTo -1determine if there's nothe cell atactually contains the specified location use a combination of this method and getCellBounds. Returns -1 if the model is empty. @param location the coordinates of the cell relative to JList @return an integer -- the index of the cell at the given location or -1.
Class JList, void removeSelectionInterval(int, int)

Sets the selection to be the set difference of the specified interval and the current selection. Both the anchorindex0 and leadindex1 indices are removed. It's not neccessarynecessary for anchorindex0 to be less than leadindex1. This is a convenience method that just delegates to the selectionModel. The DefaultListSelectionModel implementation will do nothing if either index0 or index1 are -1. If index0 or index1 are less than -1 IndexOutOfBoundsException is thrown. @param anchorindex0 the first index to remove from the selection @param leadindex1 the last index to remove from the selection @exception IndexOutOfBoundsException if either index0 or index1 are less than -1 @see ListSelectionModel#removeSelectionInterval @see #setSelectionInterval @see #addSelectionInterval @see #addListSelectionListener
Class JList, void setSelectionInterval(int, int)

Selects the specified interval. Both the anchor and lead indices are included. It's not neccessarynecessary for anchor to be less than lead. This is a convenience method that just delegates to the selectionModel. The DefaultListSelectionModel implementation will do nothing if either anchor or lead are -1. If anchor or lead are less than -1 IndexOutOfBoundsException is thrown. @param anchor the first index to select @param lead the last index to select @exception IndexOutOfBoundsException if either anchor or lead are less than -1 @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: @param selectionMode an integer 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 setUI(ListUI)

Sets the look and feel (L&F) object that renders this component. @param ui the ListUI L&F object @see UIDefaults#getUI @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the Component's LookAndFeel.
Class JList, void setVisibleRowCount(int)

Sets the preferred number of rows in the list that can be displayed without a scollbarscrollbar as determined by the nearest JViewport ancestor if any. The value of this property only affects the value of the JList's preferredScrollableViewportSize.

The default value of this property is 8.

This is a JavaBeans bound property. @param visibleRowCount an integer 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 scroll bar.

Class JList, void updateUI()

SetsResets the UI property with the "ListUI"value from the current default UIFactory. This method is called by the JList constructor and to update the list'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 JMenuItems 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer true description: A popup window containing menu items displayed in a menu bar. @version 1.145 02164 12/0903/01 @author Georges Saab @author David Karlton @author Arnaud Weber @see JMenuItem @see JSeparator @see JMenuBar @see JPopupMenu


Class JMenu.AccessibleJMenu

This class implements accessibility support for the JMenu class. It provides an implementation of the Java Accessibility API appropriate to menu 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JMenu.WinListener

A listener class that watches for a popup window closing. When the popup is closing the listener deselects the menu.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JMenu, JMenuItem add(Action)

Creates a new menu item attached to the specified Action object and appends it to the end of this menu. 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 for the menu item to be added @see Action
Class JMenu, void configurePropertiesFromAction(Action)

Factory method which sets the ActionEvent source's properties according to values from the Action instance. The properties which are set may differ for subclasses. By default the properties which get set are Text Icon Enabled ToolTipText ActionCommand and Mnemonic. @param a the Action from which to get the properties or null @since 1.34 @see Action @see #setAction
Class JMenu, PropertyChangeListener createActionChangeListener(JMenuItem)

Returns a properly configured PropertyChangeListener which updates the control as changes to the Action occur. 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.
Class JMenu, JMenuItem createActionComponent(Action)

Factory method which creates the JMenuItem for Actions added to the JMenu. As of JDK 1.3 this is no longer the preferred method. Instead it is recommended to configure a control with an action using setAction and then adding that control directly to the Container. @param a the Action for the menu item to be added @return the new menu item @see Action @since 1.3
Class JMenu, void doClick(int)

ProgramaticallyProgrammatically performs a "click". This overrides the method AbstractButton.doClick in order to make the menu pop up. @param pressTime indicates the number of milliseconds the button was pressed for
Class JMenu, void fireMenuCanceled()

Notifies 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 methodlazily. @exception Error if there is a null listener @see EventListenerList
Class JMenu, void fireMenuDeselected()

Notifies 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 methodlazily. @exception Error if there is a null listener @see EventListenerList
Class JMenu, void fireMenuSelected()

Notifies 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 methodlazily. @exception Error if there is a null listener @see EventListenerList
Class JMenu, Point getPopupMenuOrigin()

Computes the origin for the JMenu's popup menu. This method uses Look and Feel properties named Menu.menuPopupOffsetX Menu.menuPopupOffsetY Menu.submenuPopupOffsetX and Menu.submenuPopupOffsetY to adjust the exact location of popup. @return a Point in the coordinate space of the menu which should be used as the origin of the JMenu's popup menu @since 1.3
Class JMenu, void processFocusEvent(FocusEvent)

Processes focus events occurring on this component by dispatching them to any registered FocusListener objects.

This method is not called unless focus events such asare enabled FocusEventfor this component.FOCUS_GAINED Focus events are enabled when one of the following occurs:

Note that if the event parameter is null the behavior is unspecified and may result in an exception. @param e the FocusEventfocus event @see java.awt.event.FocusEvent @see java.awt.event.FocusListener @see #addFocusListener @see #enableEvents @since JDK1.1

Class JMenu, void processKeyEvent(KeyEvent)

Processes key stroke events for this menu such as mnemonics and accelerators. @param eevt the key event to be processed
Class JMenu, 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 thelook and UIFactoryfeel. @see JComponent#updateUI

Class JMenuBar

An implementation of a menu 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer true description: A container for holding and displaying menus. @version 1.85 0492 12/0603/0001 @author Georges Saab @author David Karlton @author Arnaud Weber @see JMenu @see JPopupMenu @see JMenuItem


Class JMenuBar.AccessibleJMenuBar

This class implements accessibility support for the JMenuBar class. It provides an implementation of the Java Accessibility API appropriate to menu bar 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JMenuBar, boolean isManagingFocus()

ReturnsChanges truethis JComponent's focus traversal keys to indicateCTRL+TAB and CTRL+SHIFT+TAB. Also prevents thatSortingFocusTraversalPolicy from considering descendants of this component managesJComponent when computing a focus eventstraversal cycle. @see internallyjava.awt.Component#setFocusTraversalKeys @see SortingFocusTraversalPolicy @returndeprecated As of 1.4 replaced by Component.setFocusTraversalKeys(int Set) and trueContainer.setFocusCycleRoot(boolean).
Class JMenuBar, void setUI(MenuBarUI)

Sets the L&F object that renders this component. @param ui the new MenuBarUI L&F object @see UIDefaults#getUI @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the Component's LookAndFeel.
Class JMenuBar, 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 thelook and UIFactoryfeel. @see JComponent#updateUI

Class JMenuItem

An implementation of an item in a menu. 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: An item which can be selected in a menu. @version 1.92 04106 12/0603/0001 @author Georges Saab @author David Karlton @see JPopupMenu @see JMenu @see JCheckBoxMenuItem @see JRadioButtonMenuItem


Class JMenuItem.AccessibleJMenuItem

This class implements accessibility support for the JMenuItem class. It provides an implementation of the Java Accessibility API appropriate to 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder

Class JMenuItem.AccessibleJMenuItem, void stateChanged(ChangeEvent)

Supports the change listener interface and fires property changechanges.

Class JMenuItem, constructor JMenuItem()

Creates a menuItemJMenuItem with no set text or icon.
Class JMenuItem, constructor JMenuItem(Action)

Creates a menu item whose properties are taken from the Actionspecified suppliedAction. @param a the action of the JMenuItem @since 1.3
Class JMenuItem, constructor JMenuItem(Icon)

Creates a menuItemJMenuItem with anthe specified icon. @param icon the icon of the MenuItem.JMenuItem
Class JMenuItem, constructor JMenuItem(String)

Creates a menuItemJMenuItem with the specified text. @param text the text of the MenuItem.JMenuItem
Class JMenuItem, constructor JMenuItem(String, Icon)

Creates a menuJMenuItem item with the suppliedspecified text and icon. @param text the text of the MenuItem.JMenuItem @param icon the icon of the MenuItem.JMenuItem
Class JMenuItem, constructor JMenuItem(String, int)

Creates a menuItemJMenuItem with the specified text and keyboard mnemonic. @param text the text of the MenuItem.JMenuItem @param mnemonic the keyboard mnemonic for the MenuItemJMenuItem
Class JMenuItem, void addMenuDragMouseListener(MenuDragMouseListener)

Adds a MenuDragMouseListener to the menu item. @param l the MenuDragMouseListener to be added
Class JMenuItem, void addMenuKeyListener(MenuKeyListener)

Adds a MenuKeyListener to the menu item. @param l the MenuKeyListener to be added
Class JMenuItem, void configurePropertiesFromAction(Action)

Factory method which sets the ActionEvent source's properties according to values from the Action instance. The properties which are set may differ for subclasses. By default the properties which get set are Textthis method sets the same properties as IconAbstractButton.configurePropertiesFromAction() plus Accelerator. @param a the Action from which to get the properties or null @since 1.3 @see Action @see #setAction
Class JMenuItem, PropertyChangeListener createActionPropertyChangeListener(Action)

Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance. Subclasses may override this in order to provide their own PropertyChangeListener if the set of properties which should be kept up to date differs from. the

Note that PropertyChangeListeners should avoid holding strong references to the ActionEvent source as this may hinder garbage collection of the ActionEvent source and all components in its containment hierarchy. @param a the Action from which to get the properties or null @since 1.3 @see Action @see #setAction

Class JMenuItem, KeyStroke getAccelerator()

Returns the KeyStroke which serves as an accelerator for the menu item. @return a KeyStroke object identifying the accelerator key
Class JMenuItem, AccessibleContext getAccessibleContext()

GetsReturns the AccessibleContext associated with this JMenuItem. For JMenuItemsJMenuItems 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 JMenuItem
Class JMenuItem, Component getComponent()

ThisReturns method returns the java.awt.Component used to paint this object. The returned component will be used to convert events and detect if an event is inside a menu component. @return the Component that paints this menu item
Class JMenuItem, MenuElement[] getSubElements()

This method returns an array containing the sub-menu components for this menu component. @return an array of MenuElementsMenuElements
Class JMenuItem, String getUIClassID()

Returns the suffix used to construct the name of the L&F class thatused to rendersrender this component. @return the string "MenuItemUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JMenuItem, void init(String, Icon)

InitializeInitializes the menu item with the specified text and icon. @param text the text of the MenuItem.JMenuItem @param icon the icon of the MenuItem.JMenuItem
Class JMenuItem, void menuSelectionChanged(boolean)

Called by the MenuSelectionManager when the MenuElement is selected or unselected. @param isIncluded true if this menu item is on the part of the menu path that changed false if this menu is part of the a menu path that changed but this particular part of that path is still the same @see MenuSelectionManager#setSelectedPath(MenuElement[])
Class JMenuItem, String paramString()

Returns a string representation of this JMenuItem. 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 JMenuItem.
Class JMenuItem, void processKeyEvent(KeyEvent, MenuElement[], MenuSelectionManager)

ProcessProcesses a key event forwarded from the MenuSelectionManager. @param event A KeyEvent with source being the receiving component. @param componentPath The MenuElement path array to the receiving component. @param manager The MenuSelectionManager for the menu hierarchy. This method should process the KeyEvent and changechanges the menu selection if necessary by using MenuSelectionManager's API.

Note: you do not have to forward the event to sub-components. This is done automatically by the MenuSelectionManager. @param e a KeyEvent @param path the MenuElement path array @param manager the MenuSelectionManager

Class JMenuItem, void processMenuDragMouseEvent(MenuDragMouseEvent)

HandleHandles mouse drag in a menu. @param e a MenuDragMouseEvent object
Class JMenuItem, void processMenuKeyEvent(MenuKeyEvent)

HandleHandles a keystroke in a menu. @param e a MenuKeyEvent object
Class JMenuItem, void processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)

ProcessProcesses a mouse event forwarded from the MenuSelectionManager. @param event A MouseEvent with source being the receiving component. @param componentPath The MenuElement path array to the receiving component. @param manager The MenuSelectionManager for the menu hierarchy. This method should process the MouseEvent and changechanges the menu selection if necessary by using the MenuSelectionManager's API.

Note: you do not have to forward the event to sub-components. This is done automatically by the MenuSelectionManager. @param e a MouseEvent @param path the MenuElement path array @param manager the MenuSelectionManager

Class JMenuItem, void removeMenuDragMouseListener(MenuDragMouseListener)

Removes a MenuDragMouseListener from the menu item. @param l the MenuDragMouseListener to be removed
Class JMenuItem, void removeMenuKeyListener(MenuKeyListener)

Removes a MenuKeyListener from the menu item. @param l the MenuKeyListener to be removed
Class JMenuItem, void setAccelerator(KeyStroke)

SetSets the key combination which invokes the Menumenu Itemitem's action listeners without navigating the menu hierarchy. It is the UIsUI's responsibility to do install the correct action. Note that when the keyboard accelerator is typed it will work whether or not the menu is currently displayed. @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 setEnabled(boolean)

EnableEnables or disabledisables the menu item. @param b true to enable the item @beaninfo description: Does the component react to user interaction bound: true preferred: true
Class JMenuItem, void setUI(MenuItemUI)

Sets the L&Flook and feel object that renders this component. @param ui the MenuItemUIJMenuItemUI L&F object @see UIDefaults#getUI @beaninfo descriptionbound: The menu item's UI delegatetrue boundhidden: true expertattribute: visualUpdate true hiddendescription: trueThe UI object that implements the Component's LookAndFeel.

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 ultimatlyultimately responsible for the final result. In particular the look-and-feels will adjust the layout to accommodate the option pane's ComponentOrientation property.

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. Its 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 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 Strings. But the parameter type is an array of Objects. A button is created for each object depending on its 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:

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"
      "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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see JInternalFrame @beaninfo attribute: isContainer true description: A component which implements standard dialog box controls. @version 1.61 0278 12/0903/01 @author James Gosling @author Scott Violet


Class JOptionPane.AccessibleJOptionPane

This 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


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 Components (which are added directly) or Strings (which are wrapped in a JButton). If you provide Components 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 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 initially-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 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; if null then nothing will be initially selected; only meaningful if options is used
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 not be resizable by the user however programs can invoke setResizable on the JDialog instance to change this property. The returned JDialog will be set up such that once it is closed or the user clicks on theone of OK buttonthe buttons the dialogoptionpane's value property will be disposedset accordingly and the dialog will be closed. Each time the dialog is made visible it will reset the option pane's value property to JOptionPane.UNINITIALIZED_VALUE to ensure the user's subsequent action closes the dialog properly. @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 @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
Class JOptionPane, AccessibleContext getAccessibleContext()

GetsReturns the AccessibleContext associated with this JOptionPane. 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 AccessibleJOptionPane @beaninfo expert: true description: The AccessibleContext associated with this option pane
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 @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
Class JOptionPane, Object getInitialSelectionValue()

Returns the initial-selectioninput value that is displayed as initially selected to the user. @return the initially selected value @see #setInitialSelectionValue @see #setSelectionValues
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 @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
Class JOptionPane, Object[] getSelectionValues()

Returns the input selection values. @param return the array of Objects the user can select @see #setSelectionValues
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 choosing 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 bethe provided forvalue of the user towantsInput inputproperty. @return true if aan parentComponentinput component will be provided @see #setWantsInput
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 setInitialSelectionValue(Object)

Sets the initial selectioninput value that is initially displayed as selected to the user. Only used if wantsInput is true. @param newValue the initially selected value @see #setSelectionValues @see #getInitialSelectionValue @beaninfo bound: true description: The option pane's initial selection value object.
Class JOptionPane, void setInputValue(Object)

Sets the input value that was selected or input by the user's. Only used if wantsInput is true. Note that this method is invoked internally by the option pane (in response to user action) and should generally not be called by client programs. To set the input- value initially displayed as selected to the user use setInitialSelectionValue. @param newValue the Object used to initializedset the value that the user specified (usually in a text field) @see #setSelectionValues @see #setInitialSelectionValue @see #setWantsInput @see #getInputValue @beaninfo preferred: true bound: true description: The option pane's input value object.
Class JOptionPane, void setMessageType(int)

Sets the option pane's message type. The message type is used by the Look and Feel to determine the icon to display (if not supplied) as well as potentially how to lay out the parentComponent. @param newType an integer specifying the kind of message to display: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE @exception RuntimeException if newType is 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 Look and Feel to determine what buttons to show (unless options are supplied). @param newType an integer specifying the options the L&F is to display: DEFAULT_OPTION YES_NO_OPTION YES_NO_CANCEL_OPTION or OK_CANCEL_OPTION @exception RuntimeException if newType is 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 setSelectionValues(Object[])

Sets the input 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.) A null value implies the user can input whatever they wish usually by means of a JTextField.

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 setWantsInput(boolean)

Sets the wantsInput property. If newValue is true an input component (such as a text field or combo box) whose parent is parentComponent is provided to allow the user to input a value. If getSelectionValues returns a non-null array 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 determines the Frame in which the dialog is displayed; if null or if the parentComponent has no Frame a default Frame is used @param message the Object to display @return an integer indicating the option selected by the user @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
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 determines the Frame in which the dialog is displayed; 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 @return an int indicating the option selected by the user @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
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 Look and Feel. @param parentComponent determines the Frame in which the dialog is displayed; 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 integer designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an integer designating the kind of message this is; primarily used to determine the icon from the pluggable Look and Feel: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE @return an integer indicating the option selected by the user @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
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 determines the Frame in which the dialog is displayed; 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 @param messageType an int designating the kind of message this is primarily used to determine the icon from the pluggable Look and Feel: 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 @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
Class JOptionPane, String showInputDialog(Component, Object)

Shows a question-message dialog requesting input from the user parented to parentComponent. The dialog is displayed inon top of 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 @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
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 @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
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 Objects that gives the possible selections @param initialSelectionValue the value used to initialize the input field @return usersuser's input or null meaning the user cancelledcanceled the input @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
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 @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
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 determines the Frame in which the dialog is displayed; if null or if the parentComponent has no Frame a default Frame is used @param message the Object to display @return an integer 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 determines the Frame in which the dialog is displayed; if null or if the parentComponent has no Frame a default Frame is used @param message the object to display in the dialog; a Component object is rendered as a Component; a 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 integer designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @return an integer 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 Look and Feel. @param parentComponent determines the Frame in which the dialog is displayed; if null or if the parentComponent has no Frame a default Frame is used @param message the object to display in the dialog; a Component object is rendered as a Component; a 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 integer designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an integer designating the kind of message this is primarily used to determine the icon from the pluggable Look and Feel: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE @return an integer 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 determines the Frame in which the dialog is displayed; if null or if the parentComponent has no Frame a default Frame is used @param message the object to display in the dialog; a Component object is rendered as a Component; a 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 integer designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an integer designating the kind of message this is primarily used to determine the icon from the pluggable Look and Feel: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE @param icon the icon to display in the dialog @return an integer indicating the option selected by the user
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 usersuser's input or null meaning the user cancelledcanceled 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 determines the Frame in which the dialog is displayed; if null or if the parentComponent has no Frame a default Frame is used @param message the 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 determines the Frame in which the dialog is displayed; 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 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 determines the Frame in which the dialog is displayed; 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 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 dermineddetermined 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 Look and Feel.

The messageType parameter is primarily used to supply a default icon from the Looklook and Feelfeel. @param parentComponent determines the Frame in which the dialog is displayed; if null or if the parentComponent has no Frame a default Frame is used @param message the object to display in the dialog; a Component object is rendered as a Component; a 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 integer designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an integer designating the kind of message this is; primarily used to determine the icon from the pluggable Look and Feel: 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 the objects are components they are rendered properly; non-String objects are rendered using their toString methods; if this parameter is null the options are determined by the Look and Feel @param initialValue the object that represents the default selection for the dialog; only meaningful if options is used; can be null @return an integer 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 modalan information-message dialog titled "Message". @param parentComponent determines the Frame in which the dialog is displayed; if null or if the parentComponent has no Frame a default Frame is used @param message the Object to display @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
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 determines the Frame in which the dialog is displayed; 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 messageType the type of message to be displayed: ERROR_MESSAGE INFORMATION_MESSAGE WARNING_MESSAGE QUESTION_MESSAGE or PLAIN_MESSAGE @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
Class JOptionPane, void showMessageDialog(Component, Object, String, int, Icon)

Brings up a dialog displaying a message specifying all parameters. @param parentComponent determines the Frame in which the dialog is displayed; 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 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 @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless
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 dermineddetermined 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 determines the Frame in which the dialog is displayed; 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 integer designating the options available on the dialog: YES_NO_OPTION or YES_NO_CANCEL_OPTION @param messageType an integer designating the kind of message this is primarily used to determine the icon from the pluggable Look and Feel: 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 the objects are components they are rendered properly; non-String objects are rendered using their toString methods; if this parameter is null the options are determined by the Look and Feel. @param initialValue the object that represents the default selection for the dialog; only meaningful if options is used; can be null @return an integer indicating the option chosen by the user or CLOSED_OPTION if the user closed the Dialogdialog @exception HeadlessException if GraphicsEnvironment.isHeadless returns true @see java.awt.GraphicsEnvironment#isHeadless

Class JOptionPane, int CLOSED_OPTION

Return value from class method if user closes window without selecting anything more than likely this should be treated as either a CANCEL_OPTION or NO_OPTION.
Class JOptionPane, int DEFAULT_OPTION

Type meaning Lookused for and Feel should not supply any options -- only use the options from the JOptionPaneshowConfirmDialog.
Class JOptionPane, String ICON_PROPERTY

Bound property name for icon.
Class JOptionPane, String INITIAL_SELECTION_VALUE_PROPERTY

Bound property name for initialSelectionValue.
Class JOptionPane, String INITIAL_VALUE_PROPERTY

BoundsBound property name for initialValue.
Class JOptionPane, String INPUT_VALUE_PROPERTY

Bound property name for inputValue.
Class JOptionPane, String MESSAGE_PROPERTY

Bound property name for message.
Class JOptionPane, String MESSAGE_TYPE_PROPERTY

BoundsBound property name for type.
Class JOptionPane, int OK_CANCEL_OPTION

Type used for showConfirmDialog.
Class JOptionPane, String OPTIONS_PROPERTY

BoundsBound property namername for option.
Class JOptionPane, String OPTION_TYPE_PROPERTY

Bound property name for optionType.
Class JOptionPane, String SELECTION_VALUES_PROPERTY

Bound property name for selectionValues.
Class JOptionPane, String VALUE_PROPERTY

BoundsBound property name for value.
Class JOptionPane, String WANTS_INPUT_PROPERTY

Bound property name for wantsInput.
Class JOptionPane, int YES_NO_CANCEL_OPTION

Type used for showConfirmDialog.
Class JOptionPane, int YES_NO_OPTION

Type used for showConfirmDialog.
Class JOptionPane, Object initialSelectionValue

Initial value to select in selectionValues.
Class JOptionPane, Object initialValue

Value that should be initialyinitially selected in options.
Class JOptionPane, int optionType

Option type one of DEFAULT_OPTION YES_NO_OPTION YES_NO_CANCEL_OPTION or OK_CANCEL_OPTION.
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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo description: A generic lightweight container. @version 1.37 0442 12/0603/0001 @author Arnaud Weber @author Steve Wilson


Class JPanel.AccessibleJPanel

This class implements accessibility support for the JPanel class. It provides an implementation of the Java Accessibility API appropriate to panel 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JPanel, constructor JPanel()

CreateCreates a new JPanel with a double buffer and a flow layout.
Class JPanel, constructor JPanel(boolean)

CreateCreates a new JPanel with FlowLayout and the specified buffering strategy. If isDoubleBuffered is true the JPanel will use a double buffer. @param layout the LayoutManager to use @param isDoubleBuffered a boolean true for double-buffering which uses additional memory space to achieve fast flicker-free updates
Class JPanel, void updateUI()

NotificationResets from the UIFactoryUI property with thata value from the L&Fcurrent look has changedand feel. @see JComponent#updateUI

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. You 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 seperatelyseparately to make it easier to safely change the uiUI 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: Allows the editing of a line of text but doesn't show the characters. @author Timothy Prinzing @version 1.42 0449 12/0603/0001


Class JPasswordField.AccessibleJPasswordField

This class implements accessibility support for the JPasswordField class. It provides an implementation of the Java Accessibility API appropriate to password field 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JPasswordField, constructor JPasswordField()

Constructs a new JPasswordField with a default document null starting text string and 0 column width.
Class JPasswordField, constructor JPasswordField(Document, String, int)

Constructs a new JPasswordField that uses the given text storage model and the given number of columns. This is the constructor through which the other constructors feed. The echo character is set to '*'. If the document model is null a default one will be created. @param doc the text storage to use @param txt the text to be displayed null if none @param columns the number of columns to use to calculate the preferred width >= 0. If; if columns is set to zero the preferred width will be whatever naturally results from the component implementation.
Class JPasswordField, constructor JPasswordField(String)

Constructs a new JPasswordField initialized with the specified text. The document model is set to the default and the number of columns to 0. @param text the text to be displayed null if none
Class JPasswordField, constructor JPasswordField(String, int)

Constructs a new JPasswordField initialized with the specified text and columns. The document model is set to the default. @param text the text to be displayed null if none @param columns the number of columns >= 0
Class JPasswordField, constructor JPasswordField(int)

Constructs a new empty JPasswordField with the specified number of columns. A default model is created and the initial string is set to null. @param columns the number of columns >= 0
Class JPasswordField, void copy()

NormallyInvokes transfersprovideErrorFeedback on the current look and feel which typically initiates an error beep. The normal behavior of transferring the currently selected range in the associated text model to the system clipboard and leaving the contents infrom the text model. This is not a good thingacceptable for a password field and is reimplemented to simply beep.
Class JPasswordField, void cut()

NormallyInvokes transfersprovideErrorFeedback on the current look and feel which typically initiates an error beep. The normal behavior of transferring the currently selected range in the associated text model to the system clipboard and removing the contents from the model. This is not a goodacceptable thing for a password field and is reimplemented to simply beep.
Class JPasswordField, boolean echoCharIsSet()

Returns true if this JPasswordField has a character set for echoing. A character is considered to be set if the echo character is not 0. @return true if a character is set for echoing @see #setEchoChar @see #getEchoChar
Class JPasswordField, AccessibleContext getAccessibleContext()

GetsReturns the AccessibleContext associated with this JPasswordField. For password fields the AccessibleContext takes the form of an AccessibleJPasswordField. A new AccessibleJPasswordField instance is created if necessary. @return an AccessibleJPasswordField that serves as the AccessibleContext of this JPasswordField
Class JPasswordField, char[] getPassword()

Returns the text contained in this TextComponent. If the underlying document is null will give a NullPointerException. For stronger security it is recommended that the returned character array be cleared after use by setting each character to zero. @return the text
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 Java 2 platform v1.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 Java 2 platform v1.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 JPasswordField, String getUIClassID()

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

Returns a string representation of this JPasswordField. 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 JPasswordField.
Class JPasswordField, void setEchoChar(char)

Sets the echo character for this JPasswordField. Note that this is largely a suggestion to the viewsince as the view that gets installed can use whatever graphic techniques it desires to represent the field. Setting a value of 0 unsetsindicates that you wish to see the echotext characteras it is typed similar to the behavior of a standard JTextField. @param c the echo character to display @see #echoCharIsSet @see #getEchoChar @beaninfo description: character to display in place of the real characters attribute: visualUpdate true

Class JPopupMenu

An implementation of a popup menu -- a small window that 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. For 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A small window that pops up and displays a series of choices. @version 1.149 11169 12/2705/0001 @author Georges Saab @author David Karlton @author Arnaud Weber

Class JPopupMenu, JMenuItem createActionComponent(Action)

Factory method which creates the JMenuItem for Actions added to the JPopupMenu. As of JDK 1.3 this is no longer the preferred method instead it is recommended to configure a control with an action using setAction and then adding that control directly to the Container. @param a the Action for the menu item to be added @return the new menu item @see Action @since 1.3
Class JPopupMenu, boolean getDefaultLightWeightPopupEnabled()

ReturnsGets true if this isthe adefaultLightWeightPopupEnabled light weight popup component falseproperty which by default is otherwisetrue. @return the value of the lightWeightPopupEnableddefaultLightWeightPopupEnabled property @see #setDefaultLightWeightPopupEnabled
Class JPopupMenu, void insert(Action, int)

Inserts a menu item for the specified Action object at a given position. @param a the Action object to insert @param index specifies the position at which to insert the Action where 0 is the first @exception IllegalArgumentException if index <0 @see Action
Class JPopupMenu, boolean isLightWeightPopupEnabled()

Returns trueGets the iflightWeightPopupEnabled light weight (all-Java) popups are in use or false if heavy weight (native peer) popups are being usedproperty. @return true ifthe light weight popupsvalue of the arelightWeightPopupEnabled inproperty use false@see otherwise#setLightWeightPopupEnabled
Class JPopupMenu, void paintBorder(Graphics)

Paints the popup menu's border if the BorderPaintedborderPainted property is true. @param g the Graphics object @see JComponent#paint @see JComponent#setBorder
Class JPopupMenu, void setDefaultLightWeightPopupEnabled(boolean)

Sets the default value forof 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 popuppopups iscan to be light weightlightweight otherwise false @see #getDefaultLightWeightPopupEnabled @see #setLightWeightPopupEnabled
Class JPopupMenu, void setLightWeightPopupEnabled(boolean)

WhenSets displayingthe value of the popuplightWeightPopupEnabled property which by default is JPopupMenutrue. By default when a look and feel displays a choosespopup it can choose to use a lightlightweight weight(all-Java) popup. if itLightweight popup fits.windows This method allows you toare more efficient than heavyweight disable(native thispeer) feature.windows but You have tolightweight and heavyweight components do disablenot itmix well in ifa GUI. If your application mixes light weightlightweight and heavy weightsheavyweight components you should disable lightweight popups. @paramSome aFlag true if the popup islook and feels might always use toheavyweight popups no matter what the value beof lightthis property. weight@param otherwiseaFlag false to disable lightweight popups @beaninfo description: Determines whether lightweight popups are used when possible expert: true @see isLightWeightPopupEnabled

Class JProgressBar

A component that by default displays an integer value within a bounded interval. A progress bar typically communicates the progress of an eventsome work by displaying its percentage of completion and possibly a textual display of this percentage.

ForTo furtherindicate documentationthat a task of unknown length is executing you can put a progress bar into indeterminate mode. While the bar is in indeterminate mode it animates constantly to show that work is occurring. As soon as you can determine the task's length and amount of progress you should update the progress bar's value and switch it back to determinate mode.

Here is an example of creating a progress bar where task is an object that returns information about the progress of some work:

 progressBar = new JProgressBar(0 task.getLengthOfTask()); progressBar.setValue(0); progressBar.setStringPainted(true); 
Here is an example of updating the value of the progress bar:
 progressBar.setValue(task.getCurrent()); 
Here is an example of putting a progress bar into indeterminate mode and then switching back to determinate mode once the length of the task is known:
 progressBar = new JProgressBar(); ...//when the task of (initially) unknown length begins: progressBar.setIndeterminate(true); ...//do some work; get length of task... progressBar.setMaximum(newLength); progressBar.setValue(newValue); progressBar.setIndeterminate(false); 

For complete examples and further documentation 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see javax.swing.plaf.basic.BasicProgressBarUI @beaninfo attribute: isContainer false description: A component that displays an integer value. @version 1.79 0289 12/0903/01 @author Michael C. Albers @author Kathy Walrath


Class JProgressBar.AccessibleJProgressBar

This class implements accessibility support for the JProgressBar class. It provides an implementation of the Java Accessibility API appropriate to progress bar 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder

Class JProgressBar.AccessibleJProgressBar, AccessibleRole getAccessibleRole()

GetGets the role of this object. @return an instance of AccessibleRole describing the role of the object
Class JProgressBar.AccessibleJProgressBar, AccessibleStateSet getAccessibleStateSet()

GetGets the state set of this object. @return an instance of AccessibleState containing the current state of the object @see AccessibleState
Class JProgressBar.AccessibleJProgressBar, AccessibleValue getAccessibleValue()

GetGets the AccessibleValue associated with this object. In the implementation of the Java Accessibility API for this class returnreturns this object which is responsible for implementing the AccessibleValue interface on behalf of itself. @return this object
Class JProgressBar.AccessibleJProgressBar, Number getCurrentAccessibleValue()

GetGets the accessible value of this object. @return Thethe current value of this object.
Class JProgressBar.AccessibleJProgressBar, Number getMaximumAccessibleValue()

GetGets the maximum accessible value of this object. @return Thethe maximum value of this object.
Class JProgressBar.AccessibleJProgressBar, Number getMinimumAccessibleValue()

GetGets the minimum accessible value of this object. @return Thethe minimum value of this object.
Class JProgressBar.AccessibleJProgressBar, boolean setCurrentAccessibleValue(Number)

SetSets the value of this object as a Number. @return Truetrue if the value was set.

Class JProgressBar, constructor JProgressBar()

Creates a horizontal progress bar. The default orientation for progress bars isthat displays a border but no progress JProgressBar.HORIZONTALstring. By defaultThe the String is set toinitial and minimum values are null0 and the StringPainted is not painted. The bordermaximum is painted by default. Uses the defaultMinimum (0) and defaultMaximum (100). Uses@see the defaultMinimum#setOrientation for@see the#setBorderPainted initial@see value#setStringPainted of@see the#setString progress@see bar.#setIndeterminate
Class JProgressBar, constructor JProgressBar(BoundedRangeModel)

Creates a horizontal progress bar the default orientation. Bythat defaultuses the String isspecified setmodel to nullhold and the StringPainted isprogress notbar's painteddata. TheBy default a border is painted bybut default.a Uses the specifiedprogress string is BoundedRangeModelnot. which@param holdsnewModel the minimumdata value andmodel for maximum.the @seeprogress BoundedRangeModelbar @see #setOrientation @see #setBorderPainted @see #setStringPainted @see #setString @see #setIndeterminate
Class JProgressBar, constructor JProgressBar(int)

Creates a progress bar with the specified orientation which can be either JProgressBar.VERTICAL or JProgressBar.HORIZONTAL. By default the Stringa border is set topainted nullbut and the StringPainteda progress string is not painted. The border is painted byinitial default.and Uses the defaultMinimumminimum values are (0) and defaultMaximumthe (100).maximum Usesis the100. defaultMinimum@param fororient the initialdesired valueorientation of the progress bar. @see #setOrientation @see #setBorderPainted @see #setStringPainted @see #setString @see #setIndeterminate
Class JProgressBar, constructor JProgressBar(int, int)

Creates a horizontal progress bar whichwith isthe specified minimum and maximum. Sets the defaultinitial value of the progress bar to the specified minimum. By default the Stringa border is setpainted tobut a progress string is not. The nullBoundedRangeModel andthat holds the StringPaintedprogress isbar's notdata painted.handles The border is painted byany issues that may arise default.from Uses the specifiedimproperly setting the minimum initial and maximum. values Useson the specifiedprogress bar. @param min the minimum forvalue of the initialprogress bar @param max the maximum value of the progress bar. @see BoundedRangeModel @see #setOrientation @see #setBorderPainted @see #setStringPainted @see #setString @see #setIndeterminate
Class JProgressBar, constructor JProgressBar(int, int, int)

Creates a progress bar using the specified orientation minimum and maximum. By default the Stringa border is set topainted nullbut and the StringPainteda progress string is not painted. The border is painted by default. Sets the initalinitial value of the progress bar to the specified minimum. The BoundedRangeModel that sitsholds underneath the progress bar's data handles any issues that may arrisearise from improperly setting the minimum valueinitial and maximum values on the progress bar. @param orient the desired orientation of the progress bar @param min the minimum value of the progress bar @param max the maximum value of the progress bar @see BoundedRangeModel @see #setOrientation @see #setBorderPainted @see #setStringPainted @see #setString @see #setIndeterminate
Class JProgressBar, void addChangeListener(ChangeListener)

Adds athe specified ChangeListener to the buttonprogress bar. @param l the ChangeListener to add
Class JProgressBar, void fireStateChanged()

NotifyNotifies all listeners that have registered interest forin notification on this event typeChangeEvents. The event instance is lazily created using the parameters passed into the fireif methodnecessary. @see EventListenerList
Class JProgressBar, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JProgressBar. 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 JProgressBar @beaninfo expert: true description: The AccessibleContext associated with this ProgressBar.
Class JProgressBar, int getMaximum()

Returns the modelprogress bar's maximum value which is stored in the progress bar's BoundedRangeModel. By default thisthe maximum value is 100. @return an int -- the modelprogress bar's maximum value @see #setMaximum @see BoundedRangeModel#getMaximum
Class JProgressBar, int getMinimum()

Returns the modelprogress bar's minimum value which is stored in the progress bar's BoundedRangeModel. By default thisthe minimum value is 0. @return an int -- the modelprogress bar's minimum value @see #setMinimum @see BoundedRangeModel#getMinimum
Class JProgressBar, BoundedRangeModel getModel()

Returns the data model used by thethis progress JProgressBarbar. @return the BoundedRangeModel currently in use @see BoundedRangeModel
Class JProgressBar, int getOrientation()

Returns JProgressBar.VERTICAL or JProgressBar.HORIZONTAL depending on the orientation of the progress bar. The default orientation is HORIZONTAL. @return HORIZONTAL or VERTICAL @see #setOrientation
Class JProgressBar, double getPercentComplete()

Returns the percentage/percent complete for the progress bar. Note that as a double this number is between 0.000 and 1.000. @return the percent complete for this progress bar.
Class JProgressBar, String getString()

Returns the current value of the Progress Stringprogress string. If you are providing a custom Progressprogress string String viaby overriding this method you will wantmake to ensure thatsure your implementation you callcalls setString() before you callcalling super.getString();. @return the value of the percent string @see #setString
Class JProgressBar, ProgressBarUI getUI()

Returns the L&Flook-and-feel object that renders this component. @return the ProgressBarUI object that renders this component
Class JProgressBar, String getUIClassID()

Returns the name of the L&Flook-and-feel class that renders this component. @return the string "ProgressBarUI" @see JComponent#getUIClassID @see UIDefaults#getUI @beaninfo expert: true description: A string that specifies the name of the L&Flook-and-feel class.
Class JProgressBar, int getValue()

Returns the modelprogress bar's current value which is stored in the progress bar's BoundedRangeModel. The value is always between the model's minimum and maximum values inclusive. By default the value equalsis initialized to be equal to the minimum value. @return the current value of the progress bar @see #setValue @see BoundedRangeModel#getValue
Class JProgressBar, boolean isBorderPainted()

Returns true if the progress bar has a border or false if it does not. By default this is true - the progress bar paints it'sborderPainted borderproperty. @return whether the progress bar paintsvalue of the itsborderPainted borderproperty @see #setBorderPainted @beaninfo description: Does the progress bar paint its border
Class JProgressBar, boolean isStringPainted()

Returns true if the progress bar will render a string onto the representationvalue of the progress bar. Returns false if it will not do this rendering. The default is false - the progress bar does not draw the string bystringPainted defaultproperty. @return whether the progress bar rendersvalue of the astringPainted stringproperty @see #setStringPainted @see #setString
Class JProgressBar, void paintBorder(Graphics)

PaintPaints the progress bar's border if BorderPaintedthe borderPainted property is true. @param g the Graphics context within which to paint the border @see #paint @see #setBorder @see #isBorderPainted @see #setBorderPainted
Class JProgressBar, String paramString()

Returns a string representation of this JProgressBar. This method is intended to be used only for debugging purposes and. theThe 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 JProgressBar.
Class JProgressBar, void removeChangeListener(ChangeListener)

Removes a ChangeListener from the buttonprogress bar. @param l the ChangeListener to remove
Class JProgressBar, void setBorderPainted(boolean)

Sets whetherthe borderPainted property which is true if the progress bar should paint its border. ByThe default value for this property is true. - paint theSome look and borderfeels might not implement painted borders; they will ignore this property. @param b true if the progress bar paintsshould paint its border; otherwise false @see #isBorderPainted @beaninfo bound: true attribute: visualUpdate true description: Whether the progress bar should paint its border.
Class JProgressBar, void setMaximum(int)

Sets the modelprogress bar's maximum value (stored in the progress bar's data model) to xn. The underlying BoundedRangeModel will handlehandles any mathematical issues arrisingarising from assigning faulty values.

Notifies anyIf the listenersmaximum value is ifdifferent from the dataprevious maximum all change listeners changesare notified. @param xn the new maximum @see #getMaximum @see #addChangeListener @see BoundedRangeModel#setMaximum @beaninfo preferred: true description: The modelprogress bar's maximum value.

Class JProgressBar, void setMinimum(int)

Sets the modelprogress bar's minimum value (stored in the progress bar's data model) to xn. The underlyingdata model (a BoundedRangeModel willinstance) handlehandles any mathematical issues arrisingarising from assigning faulty values.

Notifies anyIf the listenersminimum value is different iffrom the dataprevious changesminimum all change listeners are notified. @param xn the new minimum @see #getMinimum @see #addChangeListener @see BoundedRangeModel#setMinimum @beaninfo preferred: true description: The modelprogress bar's minimum value.

Class JProgressBar, void setModel(BoundedRangeModel)

Sets the data model used by the JProgressBar. @param newModel the BoundedRangeModel to use @see BoundedRangeModel @beaninfo expert: true description: The data model used by the JProgressBar.
Class JProgressBar, void setOrientation(int)

Sets the progress bar's orientation to newOrientation which must be JProgressBar.VERTICAL or JProgressBar.HORIZONTAL. The default orientation is HORIZONTAL. @param newOrientation HORIZONTAL or VERTICAL @exception IllegalArgumentException if newOrientation is an illegal value @see #getOrientation @beaninfo preferred: true bound: true attribute: visualUpdate true description: Set the progress bar's orientation.
Class JProgressBar, void setString(String)

Sets the value of the Progress Stringprogress string. By default this Stringstring is set to null. If you are providinghave provided a custom Progress String viaprogress this method you will wantstring and want to revert to ensurethe thatbuilt-in you callbehavior set setString()the before you callstring back to getString()null. If you have providedare providing a custom Stringprogress and want to revert to thestring by overriding this method make built-insure behaviorthat setyou call setString before calling getString. The progress string is painted only if the StringisStringPainted back tomethod returns nulltrue. @param s the value of the percent string @see #getString @see #setStringPainted @see #isStringPainted @beaninfo bound: true attribute: visualUpdate true description: WhetherSpecifies the progress bar will render astring percent stringto paint
Class JProgressBar, void setStringPainted(boolean)

Sets the value of the stringPainted property which determines whether the progress bar willshould render a progress string. The default is false: no string is painted. Some look and feels might not support progress strings or might support them only when the progress bar is in determinate mode. @param b true if the progress bar willshould render a string. @see #isStringPainted @see #setString @beaninfo bound: true attribute: visualUpdate true description: Whether the progress bar willshould render a string.
Class JProgressBar, void setUI(ProgressBarUI)

Sets the L&Flook-and-feel object that renders this component. @param ui thea ProgressBarUI L&F object @see UIDefaults#getUI @beaninfo expertbound: true hidden: true attribute: visualUpdate true description: The ProgressBarUI implementationUI object that definesimplements the progress barComponent's look and feelLookAndFeel.
Class JProgressBar, void setValue(int)

Sets the modelprogress bar's current value (stored in the progress bar's data model) to xn. The underlyingdata model (a BoundedRangeModel willinstance) handlehandles any mathematical issues arrisingarising from assigning faulty values.

If the new value is different from the previous value all change listeners are notified. @param xn the new value @see #getValue @see BoundedRangeModel#setValue @beaninfo preferred: true description: The modelprogress bar's current value.

Class JProgressBar, 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, ChangeEvent changeEvent

Only one ChangeEvent is needed per instance since the event's only interesting property is the immutable source which is the progress bar.
Class JProgressBar, BoundedRangeModel model

The data structureobject that holds the various valuesdata for the progress bar. @see #setModel
Class JProgressBar, int orientation

The orientation toWhether display the progress bar is horizontal or vertical. The default is HORIZONTAL. @see #setOrientation
Class JProgressBar, boolean paintBorder

Whether to display thea border around the progress bar. The default is true. @see #setBorderPainted
Class JProgressBar, boolean paintString

Whether to textually display a Stringstring on the progress bar. The default is false. Setting this to true willcauses cause a textual display of the progress to debe rendered on the progress bar. If the progressString is null the percentage done to beof completion is displayed on the progress bar. IfOtherwise the progressString is non-null it is rendered on the progress bar. @see #setStringPainted
Class JProgressBar, String progressString

AAn optional Stringstring that can be displayed on the progress bar. The default is null. Setting this to a non-null value does not imply that the Stringstring will be displayed. @see #setString

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A component which can display it's state as selected or deselected. @see ButtonGroup @see JCheckBox @version 1.64 0471 12/0603/0001 @author Jeff Dinkins


Class JRadioButton.AccessibleJRadioButton

This class implements accessibility support for the JRadioButton class. It provides an implementation of the Java Accessibility API appropriate to radio button 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JRadioButton, void configurePropertiesFromAction(Action)

Factory method which sets the ActionEvent source's properties according to values from the Action instance. The properties which are set may differ for subclasses. By default the properties which get set are Text IconMnemonic Enabled ActionCommand and ToolTipText. @param a the Action from which to get the properties or null @since 1.3 @see Action @see #setAction
Class JRadioButton, void updateUI()

NotificationResets from the UIFactoryUI property to thata value from the L&Fcurrent look has changedand feel. @see JComponent#updateUI

Class JRadioButtonMenuItem

An implementation of a radio button menu item. A JRadioButtonMenuItem 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. To control the selected state of a group of radio button menu items use a ButtonGroup object.

For further documentation and examples 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 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A component within a group of menu items which can be selected. @version 1.42 0446 12/0603/0001 @author Georges Saab @author David Karlton @see ButtonGroup


Class JRadioButtonMenuItem.AccessibleJRadioButtonMenuItem

This class implements accessibility support for the JRadioButtonMenuItem class. It provides an implementation of the Java Accessibility API appropriate to JRadioButtonMenuItem 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JRootPane

A lightweight container used behind the scenes by JFrame JDialog JWindow JApplet and JInternalFrame. For task-oriented information on functionality provided by root panes see How to Use Root Panes a section in The Java Tutorial.

The following image shows the relationships between the classes that use root 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 JInternalPaneJRootPane is also shown. All 5five 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 ofTo any children ofadd components to the JRootPane. Rather(other than adding directly to a JRootPane likethe this:optional menu rootPane.add(childbar); You instead addyou add the object to the contentPane of the JRootPane like this:

 rootPane.getContentPane().add(child); 
The same prinicipleprinciple 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 -- both as the direct parent of the menu and the grandparent of all components added to the contentPane. 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 MenuBarmenuBar 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @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.66 0477 12/0603/0001 @author David Kloba


Class JRootPane.AccessibleJRootPane

This class implements accessibility support for the JRootPane class. It provides an implementation of the Java Accessibility API appropriate to root 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JRootPane.RootLayout

A custom layout manager that is responsible for the layout of layeredPane glassPane and menuBar.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JRootPane, constructor JRootPane()

CreateCreates a JRootPane setting up its glassPane LayeredPanelayeredPane and contentPane.
Class JRootPane, void addImpl(Component, Object, int)

Overridden to enforce the position of the glass component as the zero child. @param comp the component to be enhanced @param constraints the constraints to be respected @param index the index
Class JRootPane, void addNotify()

Register ourselves with the SystemEventQueueUtils as a new root pane.
Class JRootPane, Container createContentPane()

Called by the constructor methods to create the default contentPane. By default this method creates a new JComponent add sets a BorderLayout as its LayoutManager. @return the default contentPane
Class JRootPane, Component createGlassPane()

Called by the constructor methods to create the default glassPane. By default this method creates a new JComponent with visibility set to false. @return the default glassPane
Class JRootPane, JLayeredPane createLayeredPane()

Called by the constructor methods to create the default layeredPane. Bt default it creates a new JLayeredPane. @return the default layeredPane
Class JRootPane, LayoutManager createRootLayout()

Called by the constructor methods to create the default layoutManager. @return the default layoutManager.
Class JRootPane, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JRootPane. 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 JRootPane
Class JRootPane, Container getContentPane()

Returns the content pane -- the container that holds the components parented by the root pane. @return the Container that holds the component-contents
Class JRootPane, JButton getDefaultButton()

Returns the currentvalue default buttonof forthe thisdefaultButton JRootPaneproperty. @return the JButton which is currently the default button @see #setDefaultButton
Class JRootPane, Component getGlassPane()

Returns the current glass pane for this JRootPane. @return the current glass pane. @see #setGlassPane
Class JRootPane, JMenuBar getJMenuBar()

Returns the menu bar from the layered pane. @return the JMenuBar used in the pane
Class JRootPane, JLayeredPane getLayeredPane()

GetGets the layered pane used by the root pane. The layered pane typically holds a content pane and an optional JMenuBar. @return the JLayeredPane currently in use
Class JRootPane, JMenuBar getMenuBar()

Returns the menu bar value. @deprecated As of Swing version 1.0.3 replaced by getJMenubar(). @return the JMenuBar used in the pane
Class JRootPane, RootPaneUI getUI()

Returns the L&F object that renders this component. @return LabelUI object @since 1.3
Class JRootPane, String getUIClassID()

Returns a string that specifies the name of the lL&fF class that renders this component. @return Stringthe string "RootPaneUI" @see JComponent#getUIClassID @see UIDefaults#getUI
Class JRootPane, boolean isOptimizedDrawingEnabled()

The GlassPaneglassPane and ContentPanecontentPane have the same bounds which means JRootPane does not tiles its children and this should return false. On the other hand the GlassPaneglassPane is normally not visible and so this can return true if the GlassPaneglassPane isn't visible. Therefore the return value here depends upon the visiblity of the GlassPaneglassPane. @return true if this component's children don't overlap
Class JRootPane, boolean isValidateRoot()

If a descendant of this JRootPane calls revalidate validate from here on down.

Deferred requests to relayoutlayout a component and it'sits descendants idescendents again.e. For example calls to revalidate() are pushed upwards to either a JRootPane or a JScrollPane because both classes override isValidateRoot() to return true. @see JComponent#isValidateRoot @return true

Class JRootPane, String paramString()

Returns a string representation of this JRootPane. 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 JRootPane.
Class JRootPane, void removeNotify()

Unregister ourselves from SystemEventQueueUtils. @see #addNotify
Class JRootPane, void setContentPane(Container)

Sets the content pane -- the container that holds the components parented by the root pane. @param content the Container to use for component-contents @exception java.awt.IllegalComponentStateException (a runtime exception) if the content pane parameter is null
Class JRootPane, void setDefaultButton(JButton)

Sets the defaultButton property which determines 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 RootPaneroot pane regardless of whether or not the button has keyboard focus (unless there is another component within the RootPaneroot pane which consumes the activation event such as a JTextPane). For default activation to work the button must be an enabled descendent of the RootPaneroot pane when activation occurs. To remove a default button from this RootPaneroot pane set this property to null. @see JButton#isDefaultButton @param default the JButton which is to be the default button @beaninfo description: The button activated by default in this root pane
Class JRootPane, void setGlassPane(Component)

Sets a specified Component to be the glass pane for this root pane. The glass pane should normally be a lightweight transparent component because it will be made visible when ever the root pane needs to grab input events. For example only one JInternalFrame is ever active when using a DefaultDesktop and any inactive JInternalFramesJInternalFrames' glass panes are made visible so that clicking anywhere within an inactive JInternalFrame can activate it. @param glass the Component to use as the glass pane for this JRootPane. @exception NullPointerException if the glass parameter is null
Class JRootPane, void setJMenuBar(JMenuBar)

Adds or changes the menu bar used in the layered pane. @param menu the JMenuBar to add
Class JRootPane, void setLayeredPane(JLayeredPane)

SetSets the layered pane for the root pane. The layered pane typically holds a content pane and an optional JMenuBar. @param layered the JLayeredPane to use. @exception java.awt.IllegalComponentStateException (a runtime exception) if the layered pane parameter is null
Class JRootPane, void setMenuBar(JMenuBar)

Specifies the menu bar value. @deprecated As of Swing version 1.0.3 replaced by setJMenuBar(JMenuBar menu). @param menu the JMenuBar to add.
Class JRootPane, void setUI(RootPaneUI)

Sets the L&F object that renders this component. @since 1.3 @param ui the LabelUI L&F object @see UIDefaults#getUI @beaninfo bound: true hidden: true expert: true attribute: visualUpdate true description: The L&FUI object that renders thisimplements the componentComponent's LookAndFeel. @since 1.3
Class JRootPane, void updateUI()

NotificationResets from the UIFactoryUI property to thata value from the L&Fcurrent look has changedand feel. @see JComponent#updateUI
Class JRootPane, JButton defaultButton

The button that gets activated when the pane has the focus and a UI-specific action like pressing the Enter key occurs.
Class JRootPane, DefaultAction defaultPressAction

As of Java 2 platform v1.3 this unusable field is no 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

As of Java 2 platform v1.3 this unusable field is no 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 postionposition 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see JScrollPane @beaninfo attribute: isContainer false description: A component that helps determine the visible content range of an area. @version 1.65 0472 12/0603/0001 @author David Kloba


Class JScrollBar.AccessibleJScrollBar

This class implements accessibility support for the JScrollBar class. It provides an implementation of the Java Accessibility API appropriate to scroll bar 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JScrollBar, constructor JScrollBar(int, int, int, int, int)

Creates a scrollbar with the specified orientation value extent mimimumminimum and maximum. The "extent" is the size of the viewable area. It is also known as the "visible amount".

Note: Use setBlockIncrement to set the block increment to a size slightly smaller than the view's extent. That way when the user jumps the knob to an adjacent position one or two lines of the original contents remain in view. @exception IllegalArgumentException if orientation is not one of VERTICAL HORIZONTAL @see #setOrientation @see #setValue @see #setVisibleAmount @see #setMinimum @see #setMaximum

Class JScrollBar, void addAdjustmentListener(AdjustmentListener)

Adds an AdjustmentListener. Adjustment listeners are notified each time the scrollbar's model changes. Adjustment events are provided for backwards compatabilitycompatibility with java.awt.Scrollbar.

Note that the AdjustmentEvents type property will always have a placeholder value of AdjustmentEvent.TRACK because all changes to a BoundedRangeModels value are considered equivalent. To change the value of a BoundedRangeModel one just sets its value property i.e. model.setValue(123). No information about the origin of the change e.g. it's a block decrement is provided. We don't try fabricate the origin of the change here. @param l the AdjustmentLister to add @see #removeAdjustmentListener @see BoundedRangeModel#addChangeListener

Class JScrollBar, boolean isFocusTraversable()

IdentifiesReturns whether or not this componentComponent can receivebecome the focus owner. This@return returnstrue false asif this JScrollBar'sComponent dois notfocusable; wantfalse tootherwise participate@see in#setFocusable focus@since traversalJDK1.1 @return true ifdeprecated this componentAs of can1.4 receive thereplaced by focusisFocusable().

Class JScrollPane

Provides a scrollable view of a lightweight component. A JScrollPane manages a viewport optional vertical and horizontal scroll 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. Note that JScrollPane does not support heavyweight components.

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

By default JScrollPane uses ScrollPaneLayout to handle the layout of its child Components. ScrollPaneLayout determines the size to make the viewport view in one of two ways:

  1. If the view implements Scrollable a combination of getPreferredScrollableViewportSize getScrollableTracksViewportWidth and getScrollableTracksViewportHeightis used otherwise
  2. getPreferredSize is used.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see JScrollBar @see JViewport @see ScrollPaneLayout @see Scrollable @see Component#getPreferredSize @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.75 0479 09/0601/00 @author Hans Muller


Class JScrollPane.AccessibleJScrollPane

This class implements accessibility support for the JScrollPane class. It provides an implementation of the Java Accessibility API appropriate to scroll 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


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 viewport'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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see Scrollable @see JScrollPane#createVerticalScrollBar @see JScrollPane#createHorizontalScrollBar


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 @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the Component's LookAndFeel.
Class JScrollPane, void setLayout(LayoutManager)

Sets the layout manager for this JScrollPane. This method overrides setLayout in java.awt.Container to ensure that only LayoutManagers which are subclasses of ScrollPaneLayout can be used in a JScrollPane. If layout is non-null this will invoke syncWithScrollPane on it. @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 JSeparator

An implementationJSeparator ofprovides a menugeneral separatorpurpose -component for implementing divider lines - most commonly used as 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. JSeparators may also be used elsewhere in a GUI wherever a visual divider is useful.

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 futureAs release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A divider between menu items. @version 1.42 0448 12/0603/0001 @author Georges Saab @author Jeff Shapiro


Class JSeparator.AccessibleJSeparator

This class implements accessibility support for the JSeparator class. It provides an implementation of the Java Accessibility API appropriate to separator 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JSeparator, boolean isFocusTraversable()

IdentifiesReturns whether or not this componentComponent can receivebecome the focus owner. @return true if this JSeparatorComponents cannotis recievefocusable; focusfalse otherwise @see #setFocusable @since JDK1.1 @returndeprecated falseAs of 1.4 replaced by isFocusable().
Class JSeparator, void setUI(SeparatorUI)

Sets the L&F object that renders this component. @param ui the SeparatorUI L&F object @see UIDefaults#getUI @beaninfo descriptionbound: The menu item's UI delegatetrue boundhidden: true expertattribute: visualUpdate true hiddendescription: trueThe UI object that implements the Component's LookAndFeel.
Class JSeparator, void updateUI()

NotificationResets from the UIFactory that the L&F has changed.UI Calledproperty to replace thea UI withvalue from the latest versioncurrent from thelook and UIFactorysfeel. @see JComponent#updateUI

Class JSlider

A component that lets the user graphically select a value by sldingsliding 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A component that supports selecting a integer value from a range. @version 1.90 0497 12/0603/0001 @author David Kloba


Class JSlider.AccessibleJSlider

This class implements accessibility support for the JSlider class. It provides an implementation of the Java Accessibility API appropriate to slider 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JSlider, constructor JSlider()

Creates a horizontal slider with the range 0 to 100 and an intitialinitial value of 50.
Class JSlider, constructor JSlider(int)

Creates a slider using the specified orientation with the range 0 to 100 and an intitialinitial value of 50.
Class JSlider, constructor JSlider(int, int)

Creates a horizontal slider using the specified min and max with an intitialinitial value equal to the average of 50the min plus max.
Class JSlider, constructor JSlider(int, int, int, int)

Creates a slider with the specified orientation and the specified mimimumminimum maximum and initial values. @exception IllegalArgumentException if orientation is not one of VERTICAL HORIZONTAL @see #setOrientation @see #setMinimum @see #setMaximum @see #setValue
Class JSlider, Dictionary getLabelTable()

Returns the dictionary of what labels to draw at which values. @return the Dictionary containing labels and where to draw them
Class JSlider, void updateLabelUIs()

CalledResets internally to replace the label UIsUI with the latest versionsproperty to a value from the UIFactory when the UIFactory notifies us via updateUI that thecurrent L&Flook has changedand feel. @see JComponent#updateUI
Class JSlider, void updateUI()

NotificationResets from the UIFactory that the L&F has changed.UI Calledproperty to replace thea UI withvalue from the latestcurrent version from thelook default UIFactoryand feel. @see JComponent#updateUI

Class JSplitPane

JSplitPane is used to divide two (and only two) Components. The two Components are graphically divided based on the look and feel implementation and the two Components 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 Components 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 Components is to invoke setDividerLocation where location is either the new x or y position depending on the orientation of the JSplitPane.

To resize the Components to their preferred sizes invoke resetToPreferredSizes.

When the user is resizing the Components the minimum size of the Components is used to determine the maximum/minimum position the Components can be set to. If the minimum size of the two components is greater than the size of the split 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see #setDividerLocation @see #resetToPreferredSizes @version 1.64 0269 12/0903/01 @author Scott Violet


Class JSplitPane.AccessibleJSplitPane

This class implements accessibility support for the JSplitPane class. It provides an implementation of the Java Accessibility API appropriate to split 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


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 identifersidentifiers the layout manager may throw an IllegalArgumentException.

The possible constraints objects (Strings) are:

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 integer specifying the index in the container's list. @exception IllegalArgumentException if the constraints object does not match an existing component @see java.awt.Container#addImpl(Component Object int)
Class JSplitPane, boolean isContinuousLayout()

ReturnsGets true if the child comopnents are continuously redisplayed and layed outcontinuousLayout during user interventionproperty. @return true if the components arevalue continuouslyof redrawn as the dividercontinuousLayout changesproperty @see position#setContinuousLayout
Class JSplitPane, boolean isOneTouchExpandable()

ReturnsGets true if the pane provides a UI widget to collapse/expandoneTouchExpandable the dividerproperty. @return true if the split panevalue of providesthe oneTouchExpandable aproperty collapse/expand@see widget#setOneTouchExpandable
Class JSplitPane, void setContinuousLayout(boolean)

Sets whether orthe value notof the continuousLayout property which must be true for the child components areto be continuously redisplayed and layedlaid out during user intervention. The default value of this property is false. Some look and feels might not support continuous layout; they will ignore this property. @param newContinuousLayout a boolean true if the components areshould continuously be redrawn as the divider changes position @beaninfo bound: true description: Whether or not the child components are continuously redisplayed and layedlaid out during user intervention. @see #isContinuousLayout
Class JSplitPane, void setOneTouchExpandable(boolean)

DeterminesSets whetherthe value of the oneTouchExpandable property which must be true for the JSplitPane providesto provide a UI widget on the divider to quickly expand/collapse the divider. The default value of this property is false. Some look and feels might not support one-touch expanding; they will ignore this property. @param newValue atrue boolean where true meansto specify that the tosplit pane should provide a collapse/expand widget @beaninfo bound: true description: UI widget on the divider to quickly expand/collapse the divider. @see #isOneTouchExpandable
Class JSplitPane, void setUI(SplitPaneUI)

Sets the L&F object that renders this component. @param ui the SplitPaneUI L&F object @see UIDefaults#getUI @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the Component's LookAndFeel.

Class JTabbedPane

A component that 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 indices 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.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @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%1.124 12/03/01 @author Dave Moore @author Philip Milne @author Amy Fowler @see SingleSelectionModel


Class JTabbedPane.AccessibleJTabbedPane

This class implements accessibility support for the JTabbedPane class. It provides an implementation of the Java Accessibility API appropriate to tabbed 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder

Class JTabbedPane.AccessibleJTabbedPane, AccessibleSelection getAccessibleSelection()

GetGets the AccessibleSelection associated with this object. In the implementation of the Java Accessibility API for this class returnreturns this object which is responsible for implementing the AccessibleSelection interface on behalf of itself. @return this object

Class JTabbedPane, constructor JTabbedPane()

Creates an empty TabbedPane. with Thea default tab placement isof JTabbedPane.TOP and default tab layout policy of JTabbedPane.WRAP_TAB_LAYOUT. @see #addTab
Class JTabbedPane, constructor JTabbedPane(int)

Creates an empty TabbedPane with the specified tab placement of either: JTabbedPane.TOP JTabbedPane.BOTTOM JTabbedPane.LEFT or JTabbedPane.RIGHT and a default tab layout policy of JTabbedPane.WRAP_TAB_LAYOUT. @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 which is the result of calling component.getName. Cover method for insertTab. @param component the component to be displayed when this tab is clicked @return the component @see #insertTab @see #removeTabAt
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 Thethe 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. If icon is non-null and it implements ImageIcon a corresponding disabled icon will automatically be created and set on the tabbedpane. 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 @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. If icon is non-null and it implements ImageIcon a corresponding disabled icon will automatically be created and set on the tabbedpane. 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. @param tip the tooltip to be displayed for this tab @see #insertTab @see #removeTabAt
Class JTabbedPane, void fireStateChanged()

SendSends 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, 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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index <0 || index >= tab count) @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 @exception IndexOutOfBoundsException if index is out of range (index < 0 || index >= tab count)
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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index <0 || index >= tab count) @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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index <0 || index >= tab count) @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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index <0 || index >= tab count) @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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index <0 || index >= tab count) @see #setIconAt * If icon is non-null and it implements ImageIcon a corresponding disabled icon will automatically be created and set on the tabbedpane.
Class JTabbedPane, int getTabRunCount()

Returns the number of tab runs currently used to display the tabs. @return an integer 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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index <0 || index >= tab count) @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 containing the tooltip text @exception IllegalArgumentException if index is out of bounds
Class JTabbedPane, String getToolTipTextAt(int)

Returns the tab tooltip text at index. @param index the index of the item being queried @return a string containing the tool tip text at index @exception IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index <0 || index >= tab count) @see #setToolTipTextAt
Class JTabbedPane, TabbedPaneUI getUI()

Returns the UI object which implements the L&F for this component. @return a TabbedPaneUI object @see #setUI
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. If icon is non-null and it implements ImageIcon a corresponding disabled icon will automatically be created and set on the tabbedpane. 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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index <0 || index >= tab count) @see #setEnabledAt
Class JTabbedPane, void remove(Component)

Removes the tab whichspecified correspondsComponent tofrom the specified componentJTabbedPane. @param component the component to remove from the tabbedpane @exception NullPointerException if component is null. @see #addTab @see #removeTabAt
Class JTabbedPane, void remove(int)

Removes the tab and component which corresponds to the specified index. @param index the index of the component to remove from the tabbedpane @exception IndexOutOfBoundsException if index is out of range (index <0 || index >= tab count) @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 @exception IndexOutOfBoundsException if index is out of range (index <0 || index >= tab count) @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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index < 0 || index >= tab count) @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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index < 0 || index >= tab count) @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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index < 0 || index >= tab count) @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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index < 0 || index >= tab count) @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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index < 0 || index >= tab count) @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. Does not set disabled icon at icon To set disabled icon use setDisableIconAt(). 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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index <0 || index >= tab count) @see #setDisabledIconAt @see #getIconAt @beaninfo preferred: true attribute: visualUpdate true description: The icon at the specified tab index.
Class JTabbedPane, void setSelectedIndex(int)

Sets the selected index for this tabbedpane. The index must be a valid tab index or -1 which indicates that no tab should be selected (can also be used when there are no tabs in the tabbedpane). If a -1 value is specified when the tabbedpane contains one or more tabs then the results will be implementation defined. @param index the index to be selected @exception IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index <-1 || index >= tab count) @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: 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 IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index < 0 || index >= tab count) @see #getTitleAt @beaninfo preferred: true attribute: visualUpdate true description: The title at the specified tab index.
Class JTabbedPane, void setToolTipTextAt(int, String)

Sets the tooltip text at index to toolTipText which can be null. An internal exception is raised if there is no tab at that index. @param index the tab index where the tooltip text should be set @param toolTipText the tooltip text to be displayed for the tab @exception IllegalArgumentExceptionIndexOutOfBoundsException if index is out of boundsrange (index < 0 || index >= tab count) @see #getToolTipTextAt @beaninfo preferred: true description: The tooltip text at the specified tab index.
Class JTabbedPane, void updateUI()

NotificationResets from the UIManager that the L&F has changed.UI Calledproperty to replace thea UI withvalue from the latestcurrent version from thelook defaultand UIFactoryfeel. @see JComponent#updateUI
Class JTabbedPane, ChangeListener changeListener

The changeListener is the listener we add to the model.

Class JTable

The JTable is a user-interface componentused that presents data in ato display and edit regular two-dimensional tabletables formatof cells. 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); 

BecauseNote that if you wish to use a JTable in a standalone view (outside of a JScrollPane) and want the header displayed you can get it using #getTableHeader and display it separately.

When designing applications that use the JTable it is now much easierworth paying close attention to set upthe data withstructures that custom modelswill represent the table's data. The DefaultTableModel is less useful than it was ina model implementation that uses a previousVector releases.of InsteadVectors of Objects to store the cell values. As well as copying the data infrom an application into the DefaultTableModel weit recommend wrappingis also itpossible to wrap the data in the methods of the TableModel interface and passingso that the real data can be passed to the JTable directly as in the example above. This technique is nearly as concise as using aoften results in more efficient applications because the DefaultTableModelmodel and starting this way has a number of advantages overis free to choose the internal representation that best suits the longer termdata. InA particular:good it is a scalable technique can more easily handlerule of thumb for deciding whether to use the dynamicAbstractTableModel or editable tables and oftenthe resultsDefaultTableModel in much more efficientis to use the applicationsAbstractTableModel becauseas the modelbase is free to choose the internalclass for creating subclasses and the representationDefaultTableModel that best suits the datawhen subclassing is not required.

The "TableTableExample" directory in the examples/demo area of the source distribution 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. Ifduring getTableHeader()painting.setReorderingAllowed(boolean) is used to enable column reordering

By default 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 model will be queried in its own coordinate 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 coordinate 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 column model and both the row and column selection models is: methods using integer indices for rows and columns always use the coordinate system of the view. There are three exceptions to this rule: All references to rows and columns in the TableModel interface are in the coordinate 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 coordinate system of the model. The TableColumn provides a slot for holding an identifier or "tag" for each column and the JTable and TableColumnModel 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 coordinate systems but they are rarely needed during normal use. As for all JComponent classes you can use InputMap and ActionMap to associate an Action object with a KeyStroke and execute the action under specified conditions.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A component which displays data in a two dimensional grid. @version 1.168 02197 12/0903/01 @author Philip Milne


Class JTable.AccessibleJTable

This class implements accessibility support for the JTable class. It provides an implementation of the Java Accessibility API appropriate to table 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JTable.AccessibleJTable.AccessibleJTableCell, constructor JTable.AccessibleJTable.AccessibleJTableCell(JTable, int, int, int)

Constructs an AccessibleJTableHeaderEntry.
Class JTable.AccessibleJTable.AccessibleJTableCell, void addPropertyChangeListener(PropertyChangeListener)

AddAdds a PropertyChangeListener to the listener list. The listener is registered for all properties. @param listener Thethe PropertyChangeListener to be added
Class JTable.AccessibleJTable.AccessibleJTableCell, boolean contains(Point)

Checks whether the specified point is within this object's bounds where the point's x and y coordinates are defined to be relative to the coordinate system of the object. @param p the Point relative to the coordinate system of the object @return true if object contains Point; otherwise false
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleAction getAccessibleAction()

Gets the AccessibleAction associated with this object if one exists. Otherwise returns null. @return the AccessibleAction or null
Class JTable.AccessibleJTable.AccessibleJTableCell, Accessible getAccessibleChild(int)

ReturnReturns the specified Accessible child of the object. @param i zero-based index of child @return the Accessible child of the object
Class JTable.AccessibleJTable.AccessibleJTableCell, int getAccessibleChildrenCount()

Returns the number of accessible children in the object. @return the number of accessible children in the object.
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleComponent getAccessibleComponent()

Gets the AccessibleComponent associated with this object if one exists. Otherwise returns null. @return the AccessibleComponent or null
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this component. In the implementation of the Java Accessibility API for this class return this object which is its own AccessibleContext. @return this object
Class JTable.AccessibleJTable.AccessibleJTableCell, String getAccessibleDescription()

Gets 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()

Gets 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()

Gets 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()

Gets 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()

Gets the role of this object. @return an instance of AccessibleRole describing the role of the object @see AccessibleRole
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleSelection getAccessibleSelection()

Gets the AccessibleSelection associated with this object if one exists. Otherwise returns null. @return the AccessibleSelection or null
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleStateSet getAccessibleStateSet()

Gets 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()

Gets the AccessibleText associated with this object if one exists. Otherwise returns null. @return the AccessibleText or null
Class JTable.AccessibleJTable.AccessibleJTableCell, AccessibleValue getAccessibleValue()

Gets the AccessibleValue associated with this object if one exists. Otherwise returns null. @return the AccessibleValue or null
Class JTable.AccessibleJTable.AccessibleJTableCell, Color getBackground()

Gets the background color of this object. @return the background color if supported of the object; otherwise null.
Class JTable.AccessibleJTable.AccessibleJTableCell, Cursor getCursor()

Gets the Cursor of this object. @return the Cursor if supported of the object; otherwise null
Class JTable.AccessibleJTable.AccessibleJTableCell, Font getFont()

Gets the Font of this object. @return the Font if supported for the object; otherwise null
Class JTable.AccessibleJTable.AccessibleJTableCell, FontMetrics getFontMetrics(Font)

Gets the FontMetrics of this object. @param f the Font @return the FontMetrics object if supported the object; otherwise null @see #getFont
Class JTable.AccessibleJTable.AccessibleJTableCell, Color getForeground()

Gets 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 this component's locale; if this component does not have a locale the locale of its parent is returned @exception IllegalComponentStateException if 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 an instance of Point representing the top-left corner of the object'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, 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 JTable.AccessibleJTable.AccessibleJTableCell, boolean isVisible()

Determines if this 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 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 JTable.AccessibleJTable.AccessibleJTableCell, void setAccessibleName(String)

Sets the localized accessible name of this object. @param s the new localized name of the object.
Class JTable.AccessibleJTable.AccessibleJTableCell, void setBackground(Color)

Sets the background color of this object. @param c the new Color for the background
Class JTable.AccessibleJTable.AccessibleJTableCell, void setCursor(Cursor)

Sets the Cursor of this object. @param c the new Cursor for the object
Class JTable.AccessibleJTable.AccessibleJTableCell, void setFont(Font)

Sets the Font of this object. @param f the new Font for the object
Class JTable.AccessibleJTable.AccessibleJTableCell, void setForeground(Color)

Sets the foreground color of this object. @param c the new Color for the foreground

Class JTable.AccessibleJTable, void addAccessibleSelection(int)

Adds the specified Accessible child of the object to the object's selection. If the object supports multiple selections the specified child is added to any existing selection otherwise it replaces any existing selection in the object. If the specified child is already selected this method has no effect.

This method only works on JTablesJTables which have individual cell selection enabled. @param i the zero-based index of the child @see AccessibleContext#getAccessibleChild

Class JTable.AccessibleJTable, Accessible getAccessibleAt(Point)

Returns the Accessible child if one exists contained at the local coordinate Point. @param p the point defining the top-left corner of the Accessible given in the coordinate space of the object's parent. @return the Accessible if it exists at the specified location; else null
Class JTable.AccessibleJTable, 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 JTable.AccessibleJTable, int getAccessibleChildrenCount()

Returns the number of accessible children in the object. If all of the children of this object implement Accessible thanthen this method should return the number of children of this object. @return the number of accessible children in the object.
Class JTable.AccessibleJTable, Accessible getAccessibleColumnDescription(int)

ReturnReturns the description of the specified column in the table. @param c zero-based column of the table @return the description of the column
Class JTable.AccessibleJTable, int getAccessibleColumnExtentAt(int, int)

Returns the number of columns occupied by the Accessible at a given (row column). @return the number of columns occupied by the Accessible at a specified row and column in the table.
Class JTable.AccessibleJTable, AccessibleTable getAccessibleColumnHeader()

ReturnReturns the column headers as an AccessibleTable. @return an AccessibleTable representing the column headers
Class JTable.AccessibleJTable, int getAccessibleIndexAt(int, int)

Returns the index at a given (row column) in the table. @param r zero-based row of the table @param c zero-based column of the table @return the index into the table
Class JTable.AccessibleJTable, Accessible getAccessibleRowDescription(int)

ReturnReturns the description of the specified row in the table. @param r zero-based row of the table @return the description of the row
Class JTable.AccessibleJTable, int getAccessibleRowExtentAt(int, int)

Returns the number of rows occupied by the Accessible at a specified row and column in the table. @return the number of rows occupied by the Accessible at a specified row and column in the table.
Class JTable.AccessibleJTable, AccessibleTable getAccessibleRowHeader()

ReturnReturns the row headers as an AccessibleTable. @return an AccessibleTable representing the row headers
Class JTable.AccessibleJTable, Accessible getAccessibleSelection(int)

Returns an Accessible representing the specified selected child in the object. If there isn't a selection or there are fewer children selected than the integer passed in the return value will be null.

Note that the index represents the i-th selected child which is different from the i-th child. @param i the zero-based index of selected children @return the i-th selected child @see #getAccessibleSelectionCount

Class JTable.AccessibleJTable, int getAccessibleSelectionCount()

Returns the number of Accessible children currently selected. If no children are selected the return value will be 0. @return the number of items currently selected.
Class JTable.AccessibleJTable, AccessibleTable getAccessibleTable()

GetGets the AccessibleTable associated with this object. In the implementation of the Java Accessibility API for this class return this object which is responsible for implementing the AccessibleTableAccessibleTables interface on behalf of itself. @return this object
Class JTable.AccessibleJTable, boolean isAccessibleChildSelected(int)

Determines if the current child of this object is selected. @return true if the current child of this object is selected @param i the zero-based index of the child in this Accessible object. @return true if the current child of this object is selected @see AccessibleContext#getAccessibleChild
Class JTable.AccessibleJTable, boolean isAccessibleColumnSelected(int)

Returns a boolean value indicating whether the specified column is selected. @param r zero-based column of the table @return the boolean value true if the specified column is selected. Otherwise; otherwise false.
Class JTable.AccessibleJTable, boolean isAccessibleRowSelected(int)

Returns a boolean value indicating whether the specified row is selected. @param r zero-based row of the table @return the boolean value true if the specified row is selected. Otherwise; otherwise false.
Class JTable.AccessibleJTable, boolean isAccessibleSelected(int, int)

Returns a boolean value indicating whether the accessible at a given (row column) is selected. @param r zero-based row of the table @param c zero-based column of the table @return the boolean value true if the accessible at (row column) is selected. Otherwise; otherwise the boolean value false
Class JTable.AccessibleJTable, void removeAccessibleSelection(int)

Removes the specified child of the object from the object's selection. If the specified item isn't currently selected this method has no effect.

This method only works on JTables which have individual cell selection enabled. @param i the zero-based index of the child @see AccessibleContext#getAccessibleChild

Class JTable.AccessibleJTable, void selectAllAccessibleSelection()

Causes every child of the object to be selected but only if the JTable supports multiple selections and if individual cell selection is enabled.
Class JTable.AccessibleJTable, void setAccessibleColumnHeader(AccessibleTable)

ReturnReturns the column headers as an AccessibleTable. @return an AccessibleTable representing the column headers
Class JTable.AccessibleJTable, void setAccessibleRowHeader(AccessibleTable)

ReturnReturns the row headers as an AccessibleTable. @return an AccessibleTable representing the row headers

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);

Each row must contain a value for each column or an exception will be raised. @param rowData the data for the new table @param columnNames names of each column

Class JTable, void doLayout()

Causes this table to lay out its rows and columns. Overridden so that columns can be resized to accomodate a change in the size of a containing parent. Resizes one or more of the columns in the table so that the total width of all of this JTable's columns is equal to the width of the table.

Before the layout begins the method gets the resizingColumn of the tableHeader. When the method is called as a result of the resizing of an enclosing window the resizingColumn is null. 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 this JTable's automatic resize mode.

If the resizingColumn is not null 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 deficit) space is distributed amongst the available columns.

The modes are:

Note: When a 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 scroll 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 minimum or maximum 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 available 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 in the following section. Resizable3 is a private interface that allows any data structure containing a collection of elements with a size preferred size maximum size and minimum size to have its elements manipulated by the algorithm.

Distributing the delta

Overview

Call "DELTA" the difference between the target 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 guarantees 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 multiplying factor above is constantly recalculated and this takes account of the rounding errors in the previous iterations. The result is an algorithm that 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 their appropriate limiting value (maximum or minimum).

Class JTable, boolean editCellAt(int, int)

Programmatically starts editing the cell at row and column if the cell is editable. Note that this is a convenience method for editCellAt(int int null). @param row the row to be edited @param column the column to be edited @exception IllegalArgumentException Ifif row or column is 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; note that as of Java 2 platform v1.2 the call to shouldSelectCell is no longer made @exception IllegalArgumentException Ifif row or column is not in the valid range @return false if for any reason the cell cannot be edited
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)doLayout
Class JTable, Rectangle getCellRect(int, int, boolean)

Returns a rectangle for the cell that lies at the intersection of row and column. If includeSpacing is true then the value returned has the full height and width of the row and column specified. If it is false the returned rectangle is inset by the intercell spacing to return the true bounds of the rendering or editing component as it will be set during rendering.

If the column index is valid but the row index is less than zero the method returns a rectangle with the the y and height values set appropriately and the x and width values both set to zero. In general when either the row or column indices indicate a cell outside the appropriate range the method returns a rectangle depicting the closest edge of the closest cell that is within the table's range. When both row and column indices are out of range the returned rectangle covers the closest point of the closest cell.

In all cases calulationscalculations that use this method to calculate results along one axixaxis will not fail because of anomalies in calculations along the other axis. When the cell is not valid the 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, Color getGridColor()

Returns the color used to draw grid lines. The default color is Color.graylook and feel dependent. @return the color used to draw grid lines @see #setGridColor
Class JTable, boolean getScrollableTracksViewportWidth()

Returns false if autoResizeMode is set to indicateAUTO_RESIZE_OFF which indicates that the width of the viewport does not determine the width of the table. Otherwise returns true. @return false if autoResizeMode is set to AUTO_RESIZE_OFF otherwise returns true @see Scrollable#getScrollableTracksViewportWidth
Class JTable, boolean isFocusTraversable()

We overrideReturns whether this method whose implementation in JComponentComponent returnscan false to return truebecome the focus owner. This@return indicatestrue that theif this JTableComponent is afocusable; false componentotherwise that@see should#setFocusable be@since partJDK1.1 of@deprecated aAs (tabbing)of focus1.4 cyclereplaced by defaultisFocusable(). @return true
Class JTable, boolean isManagingFocus()

WeChanges override this method whose implementation in JComponent's focus returns falsetraversal keys to returnCTRL+TAB and trueCTRL+SHIFT+TAB. ThisAlso prevents allowsSortingFocusTraversalPolicy usfrom toconsidering descendants of this JComponent givewhen computing a special meaningfocus traversal tocycle. TAB@see andjava.awt.Component#setFocusTraversalKeys SHIFT-TAB@see SortingFocusTraversalPolicy @deprecated As inof the1.4 replaced by JTableComponent.setFocusTraversalKeys(int @returnSet) trueand Container.setFocusCycleRoot(boolean).
Class JTable, Component prepareRenderer(TableCellRenderer, int, int)

Prepares the renderer by querying the data model for the value and selection state of the cell at row column. Returns the component (may be a Component or a JComponent) under the event location.

Note: Throughout the table package the internal implementations 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 @return the Component under the event location

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)doLayout @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 setCellSelectionEnabled(boolean)

Sets whether this table allows both a column selection and a row selection to exist simultaneously. When set the table treats the intersection of the row and column selection models as the selected cells. Override isCellSelected to change this default behavior. This method is equivalent to setting both the rowSelectionAllowed property and columnSelectionAllowed property of the columnModel to the supplied value. @param cellSelectionEnabled true if simultaneous row and column selection is allowed @see #getCellSelectionEnabled @see #isCellSelected @beaninfo bound: true attribute: visualUpdate true description: Select a rectangular region of cells rather than rows or columns.
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 attribute: visualUpdate true description: If true an entire column is selected for each selected cell.
Class JTable, void setGridColor(Color)

Sets the color used to draw grid lines to gridColor and redisplays. The default color is Color.graylook and feel dependent. @param gridColor the new color of the grid lines @exception IllegalArgumentException if gridColor is null @see #getGridColor @beaninfo bound: true description: The grid color.
Class JTable, void setRowHeight(int)

Sets the height in pixels of all cells to rowHeight revalidates and repaints. The height of the cells in this row will be equal to the row height minus the row margin. @param rowHeight new row height @exception IllegalArgumentException if rowHeight is less than 1 @see #getRowHeight @beaninfo bound: true description: The height of the specified row.
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 attribute: visualUpdate true description: If true an entire row is selected for each selected cell.
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 @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the Component's LookAndFeel.
Class JTable, void sizeColumnsToFit(boolean)

Sizes the table columns to fit the available space. @deprecated As of Swing version 1.0.3 replaced by sizeColumnsToFitdoLayout(int). @see #sizeColumnsToFit(int)doLayout
Class JTable, void sizeColumnsToFit(int)

ResizesObsolete one or more of the columns in the table so that the total width of all of this JTable's columns is equal to the width of the table. When doLayout is called on this JTable often as a result of the resizing of an enclosingJava window2 this method is called with resizingColumn set toplatform -1v1. 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 this JTable's automatic resize mode4. IfPlease use 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 doLayout(or deficit) space is distributed amongst the available 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 "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: Automatically 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 a 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 scroll 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 minimum or maximum 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 available 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 in the following section. Resizable3 is a private interface that allows any data structure containing a collection of elements with a size preferred size maximum size and minimum size to have its elements manipulated by the algorithm. Distributing the delta Overview Call "DELTA" the difference between the target 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 guarantees 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 multiplying factor above is constantly recalculated and this takes account of the rounding errors in the previous iterations. The result is an algorithm that 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 their appropriate limiting value (maximum or minimum). @param resizingColumn the column whose resizing made this adjustment necessary or -1 if there is no such column @see TableColumn#setWidthdoLayout
Class JTable, void tableChanged(TableModelEvent)

Invoked when this table's TableModel generates a TableModelEvent. The TableModelEvent should be constructed in the coordinate system of the model; the appropriate mapping to the view coordinate system is performed by this JTable when it receives the event.

Application code will not use these methods explicitly they are used internally by JTable.

Note that as of 1.3 this method clears the selection if any.


Class JTextArea

A TextAreaJTextArea 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 capabilititescapabilities 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.

Newlines
For a discussion on how newlines are handled see DefaultEditorKit.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A multi-line area that displays plain text. @author Timothy Prinzing @version 1.69 0483 12/0603/0001 @see JTextPane @see JEditorPane


Class JTextArea.AccessibleJTextArea

This class implements accessibility support for the JTextArea class. It provides an implementation of the Java Accessibility API appropriate to text area 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JTextArea, int getLineCount()

Determines the number of lines contained in the area. @return the number of lines >= 0
Class JTextArea, boolean getLineWrap()

Gets 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. @returnsreturn if lines will be wrapped.
Class JTextArea, int getScrollableUnitIncrement(Rectangle, int, int)

Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column depending on the value of orientation. This is implemented to use the vaulesvalues returned by the getRowHeight and getColumnWidth methods.

Scrolling containers like JScrollPane will use this method each time the user requests a unit scroll. @param visibleRect the view area visible within the viewport @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL. @param direction Less than zero to scroll up/left greater than zero for down/right. @return The "unit" increment for scrolling in the specified direction @exception IllegalArgumentException for an invalid orientation @see JScrollBar#setUnitIncrement @see #getRowHeight @see #getColumnWidth

Class JTextArea, boolean getWrapStyleWord()

GetGets the style of wrapping used if the text area is wrapping lines. If set to true the lines will be wrapped at word boundaries (ie whitespace) if they are too long to fit within the allocated width. If set to false the lines will be wrapped at character boundaries. @returnsreturn if the wrap style should be word boundaries instead of character boundaries. @see #setWrapStyleWord
Class JTextArea, boolean isManagingFocus()

Turns offChanges this tabJComponent's focus traversal oncekeys to CTRL+TAB and CTRL+SHIFT+TAB. Also prevents SortingFocusTraversalPolicy from considering descendants of this JComponent when computing a focus gainedtraversal cycle. @returnsee java.awt.Component#setFocusTraversalKeys true@see toSortingFocusTraversalPolicy indicate@deprecated that theAs of focus1.4 replaced isby beingComponent.setFocusTraversalKeys(int Set) and managedContainer.setFocusCycleRoot(boolean).
Class JTextArea, void processKeyEvent(KeyEvent)

MakeOverrides sureprocessKeyEvent that TABto process 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)

SetSets the style of wrapping used if the text area is wrapping lines. If set to true the lines will be wrapped at word boundaries (whitespace) if they are too long to fit within the allocated width. If set to false the lines will be wrapped at character boundaries. By default this property is false. @param word indicates if word boundaries should be used for line wrapping. @see #getWrapStyleWord @beaninfo preferred: false bound: true description: should wrapping occur at word boundaries

Class JTextField

JTextField is a lightweight component that allows the editing of a single line of text. For 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 inadvertently exposing password characters. To provide password-like services a separate class JPasswordField extends JTextField to provide this service with an independently 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 trailing 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 leading justified.

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

How the text field consumes VK_ENTER events depends on whether the text field has any action listeners. If so then VK_ENTER results in the listeners getting an ActionEvent and the VK_ENTER event is consumed. This is compatible with how AWT text fields handle VK_ENTER events. If the text field has no action listeners then as of v 1.3 the VK_ENTER event is not consumed. Instead the bindings of ancestor components are processed which enables the default button feature of JFC/Swing to work.

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 

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A component which allows for the editing of a single line of text. @author Timothy Prinzing @version 1.72 0485 12/0603/0001 @see #setActionCommand @see JPasswordField @see #addActionListener


Class JTextField.AccessibleJTextField

This class implements accessibility support for the JTextField class. It provides an implementation of the Java Accessibility API appropriate to text field 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JTextField, constructor JTextField()

Constructs a new TextField. A default model is created the initial string is null and the number of columns is set to 0.
Class JTextField, constructor JTextField(Document, String, int)

Constructs a new JTextField that uses the given text storage model and the given number of columns. This is the constructor through which the other constructors feed. If the document is null a default model is created. @param doc the text storage to use. If; if this is null a default will be provided by calling the createDefaultModel method. @param text the initial string to display or null @param columns the number of columns to use to calculate the preferred width >= 0. If; if columns is set to zero the preferred width will be whatever naturally results from the component implementation. @exception IllegalArgumentException if columns <0
Class JTextField, constructor JTextField(String)

Constructs a new TextField initialized with the specified text. A default model is created and the number of columns is 0. @param text the text to be displayed or null
Class JTextField, constructor JTextField(String, int)

Constructs a new TextField initialized with the specified text and columns. A default model is created. @param text the text to be displayed or null @param columns the number of columns to use to calculate the preferred width. If; if columns is set to zero the preferred width will be whatever naturally results from the component implementation.
Class JTextField, constructor JTextField(int)

Constructs a new empty TextField with the specified number of columns. A default model is created and the initial string is set to null. @param columns the number of columns to use to calculate the preferred width. If; if columns is set to zero the preferred width will be whatever naturally results from the component implementation.
Class JTextField, void addActionListener(ActionListener)

Adds the specified action listener to receive action events from this textfield. @param l the action listener to be added
Class JTextField, void configurePropertiesFromAction(Action)

Factory method which sets the ActionEvent source's properties according to values from the Action instance. The properties which are set may differ for subclasses. By default the properties which get set are Enabled and ToolTipText. @param a the Action from which to get the properties or null @since 1.3 @see Action @see #setAction
Class JTextField, PropertyChangeListener createActionPropertyChangeListener(Action)

Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance. Subclasses may override this in order to provide their own PropertyChangeListener if the set of properties which should be kept up to date differs from the default properties (Text Enabled ToolTipText).

Note that PropertyChangeListeners should avoid holding strong references to the ActionEvent source as this may hinder garbage collection of the ActionEvent source and all components in its containment hierarchy. @param a the Action from which to get the properties or null @since 1.3 @see Action @see #setAction

Class JTextField, Document createDefaultModel()

Creates the default implementation of the model to be used at construction if one isn't explicitly given. An instance of PlainDocument is returned. @return the default model implementation
Class JTextField, void fireActionPerformed()

Notifies 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. The listener list is processed in last to first order. @see EventListenerList
Class JTextField, AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JTextField. For JTextFields the AccessibleContext takes the form of an AccessibleJTextField. A new AccessibleJTextField instance is created if necessary. @return an AccessibleJTextField that serves as the AccessibleContext of this JTextField
Class JTextField, Action getAction()

Returns the currently set Action for this ActionEvent source or null if no Action is set. @return the Action for this ActionEvent source or null. @since 1.3 @see Action @see #setAction
Class JTextField, int getColumnWidth()

GetsReturns the column width. The meaning of what a column is can be considered a fairly weak notion for some fonts. This method is used to define the width of a column. By default this is defined to be the width of the character m for the font used. This method can be redefined to be some alternative amount @return the column width >= 1
Class JTextField, int getColumns()

Returns the number of columns in this TextField. @return the number of columns >= 0
Class JTextField, int getHorizontalAlignment()

Returns the horizontal alignment of the text. Valid keys are: @return the horizontal alignment
Class JTextField, BoundedRangeModel getHorizontalVisibility()

Gets the visibility of the text field. This can be adjusted to change the location of the visible area if the size of the field is greater than the area that was allocated to the field.

The fields look-and-feel implementation manages the values of the minimum maximum and extent properties on the BoundedRangeModel. @return the visibility @see BoundedRangeModel

Class JTextField, Dimension getPreferredSize()

Returns the preferred size Dimensions needed for this TextField. If a non-zero number of columns has been set the width is set to the columns multiplied by the column width. @return the dimensionsdimension of this textfield
Class JTextField, int getScrollOffset()

Gets the scroll offset in pixels. @return the offset >= 0
Class JTextField, String getUIClassID()

Gets the class ID for a UI. @return the IDstring ("TextFieldUI") @see JComponent#getUIClassID @see UIDefaults#getUI
Class JTextField, boolean isValidateRoot()

Calls to revalidate that come from within the textfield itself will be handled by validating the textfield unless the receivertextfield is contained within a JViewport in which case this returns false. @return if the parent of this textfield is a JViewPort return false otherwise return true @see JComponent#revalidate @see JComponent#isValidateRoot
Class JTextField, String paramString()

Returns a string representation of this JTextField. 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 JTextField.
Class JTextField, void postActionEvent()

Processes action events occurring on this textfield by dispatching them to any registered ActionListener objects. This is normally called by the controller registered with textfield.
Class JTextField, void removeActionListener(ActionListener)

Removes the specified action listener so that it no longer receives action events from this textfield. @param l the action listener to be removed
Class JTextField, void setAction(Action)

Sets the Action for the ActionEvent source. The new Action replaces any previously set Action but does not affect ActionListeners independantlyindependently added with addActionListener(). If the Action is already a registered ActionListener for the ActionEvent source it is not re-registered. A side-effect of setting the Action is that the ActionEvent source's properties are immediately set from the values in the Action (performed by the method configurePropertiesFromAction()) and subsequently updated as the Action's properties change (via a PropertyChangeListener created by the method createActionPropertyChangeListener(). @param a the Action for the JTextField or null. @since 1.3 @see Action @see #getAction @see #configurePropertiesFromAction @see #createActionPropertyChangeListener @beaninfo bound: true attribute: visualUpdate true description: the Action instance connected with this ActionEvent source
Class JTextField, void setColumns(int)

Sets the number of columns in this TextField and then invalidate the layout. @param columns the number of columns >= 0 @exception IllegalArgumentException if columns is less than 0 @beaninfo description: the number of columns preferred for display
Class JTextField, void setFont(Font)

Sets the current font. This removes cached row height and column width so the new font will be reflected. revalidate() is called after setting the font. @param f the new font
Class JTextField, void setHorizontalAlignment(int)

Sets the horizontal alignment of the text. Valid keys are: 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) or TRAILING enum: LEFT JTextField.LEFT CENTER JTextField.CENTER RIGHT JTextField.RIGHT LEADING JTextField.LEADING TRAILING JTextField.TRAILING
Class JTextField, void setScrollOffset(int)

Sets the scroll offset in pixels. @param scrollOffset the offset >= 0

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 overridennot overridden 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.

Newlines
For a discussion on how newlines are handled see DefaultEditorKit.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer true description: A text component that can be marked up with attributes that are graphically represented. @author Timothy Prinzing @version 1.72 0285 12/0203/0001 @see javax.swing.text.StyledEditorKit

Class JTextPane, constructor JTextPane()

ConstructsCreates a new JTextPane. A new instance of StyledEditorKit is created and set and the document model set to null.
Class JTextPane, constructor JTextPane(StyledDocument)

ConstructsCreates 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, Style addStyle(String, Style)

Adds a new style into the logical style hierarchy. Style attributes resolve from bottom up so an attribute specified in a child will override an attribute specified in the parent. @param nm the name of the style (must be unique within the collection of named styles). The name may be null if the style is unnamed but the caller is responsible for managing the reference returned as an unnamed style can't be fetched by name. An unnamed style may be useful for things like character attribute overrides such as found in a style run. @param parent the parent style. This may be null if unspecified attributes need not be resolved in some other style. @return the new Style
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, AttributeSet getCharacterAttributes()

Fetches the character attributes in effect at the current location of the caret or null. @return the attributes or null
Class JTextPane, Style getLogicalStyle()

Fetches the logical style assigned to the paragraph represented by the current position of the caret or null. @return the styleStyle
Class JTextPane, AttributeSet getParagraphAttributes()

Fetches the current paragraph attributes in effect at the location of the caret or null if none. @return the attributes
Class JTextPane, Style getStyle(String)

Fetches a named non-null style previously added. @param nm the name of the style @return the styleStyle
Class JTextPane, StyledEditorKit getStyledEditorKit()

Gets the editor kit. @return the editor kit.
Class JTextPane, String getUIClassID()

Returns the class ID for the UI. @return the IDstring ("TextPaneUI") @see JComponent#getUIClassID @see UIDefaults#getUI
Class JTextPane, void insertComponent(Component)

Inserts a component into the document as a replacement for the currently selected content. If there is no selection the component is effectively inserted at the current position of the caret. This is represented in the associated document as an attribute of one character of content.

The component given is the actual component used by the JTextPane. Since components cannot be a child of more than one container this method should not be used in situations where the model is shared by text components.

The component is placed relative to the text baseline according to the value returned by Component.getAlignmentY. For Swing components this value can be conveniently set using the method JComponent.setAlignmentY. For example setting a value of 0.75 will cause 75 percent of the component to be above the baseline and 25 percent of the component to be below the baseline.

This method is thread safe although most Swing methods are not. Please see Threads and Swing for more information. @param c the component to insert

Class JTextPane, String paramString()

Returns a string representation of this JTextPane. 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 JTextPane.
Class JTextPane, void removeStyle(String)

Removes a named non-null style previously added to the document. @param nm the name of the style to remove
Class JTextPane, 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 this amounts to a removal of the current selection. The replacement text will have the attributes currently defined for input. If the document is not editable beep and return. Then ifat the document is nullpoint do nothingof insertion. If the content to insertdocument is null or empty ignore itnot editable beep and return.

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

Class JTextPane, void setDocument(Document)

Associates the editor with a text document. This must be a StyledDocument. @param doc the document to display/edit @exception IllegalArgumentException if doc can't be narrowed to a StyledDocument which is the required type of model for this text component
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 StyledEditorKit
Class JTextPane, void setLogicalStyle(Style)

Sets the logical style to use for the paragraph at the current caret position. If attributes aren't explicitly set for character and paragraph attributes they will resolve through the logical style assigned to the paragraph which in term may resolve through some hierarchy completely independantindependent of the element hierarchy in the document.

This method is thread safe although most Swing methods are not. Please see Threads and Swing for more information. @param s the logical style to assign to the paragraph or null for no style

Class JTextPane, void setParagraphAttributes(AttributeSet, boolean)

Applies the given attributes to paragraphs. If there is a selection the attributes are applied to the paragraphs that intersect the selection. ifIf there is no selection the attributes are applied to the paragraph at the current caret position.

This method is thread safe although most Swing methods are not. Please see Threads and Swing for more information. @param attr the non-null attributes @param replace if true replace the existing attributes first


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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: An implementation of a two-state button. @see JRadioButton @see JCheckBox @version 1.50 0456 12/0603/0001 @author Jeff Dinkins


Class JToggleButton.AccessibleJToggleButton

This class implements accessibility support for the JToggleButton class. It provides an implementation of the Java Accessibility API appropriate to toggle button 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JToggleButton.ToggleButtonModel

The ToggleButton 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JToggleButton, void updateUI()

NotificationResets from the UIFactoryUI property to thata value from the L&Fcurrent look has changedand feel. @see JComponent#updateUI

Class JToolBar

JToolBar provides a component that is useful for displaying commonly used Actions or controls. For examples and information on using tool bars see How to Use Tool Bars a section in The Java Tutorial.

A tool bar canWith most look and befeels the user can draggeddrag out a tool bar into a separate window by the user (unless the floatable property is set to false). In order forFor 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer true description: A component which displays commonly used controls or Actions. @version 1.88 04102 12/0603/0001 @author Georges Saab @author Jeff Shapiro @see Action


Class JToolBar.AccessibleJToolBar

This class implements accessibility support for the JToolBar class. It provides an implementation of the Java Accessibility API appropriate to tooltoolbar bar user-interface elements.

Class JToolBar.Separator

A toolbar-specific separator. An object with dimension but no contents used to divide buttons on a toolbartool bar into groups.

Class JToolBar, constructor JToolBar()

Creates a new toolbartool bar; orientation defaults to HORIZONTAL.
Class JToolBar, constructor JToolBar(String)

Creates a new toolbartool bar with the specified name. The name is used as the title of the undocked toolbartool bar. The default orientation is HORIZONTAL. @param name the name of the toolbartool bar @since 1.3
Class JToolBar, constructor JToolBar(String, int)

Creates a new toolbartool bar with a specified name and orientation. All other constructors call this constructor. If orientation is an invalid value an exception will be thrown. @param name the name of the toolbartool bar @param orientation the initial orientation -- it must be either HORIZONTAL or VERTICAL @exception IllegalArgumentException if orientation is neither HORIZONTAL nor VERTICAL @since 1.3
Class JToolBar, constructor JToolBar(int)

Creates a new toolbartool bar with the specified orientation. The orientation must be either HORIZONTAL or VERTICAL. @param orientation the orientation desired
Class JToolBar, void addSeparator()

Appends a toolbar separator of default size to the end of the toolbartool bar. 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 toolbartool bar. @param size the Dimension of the separator
Class JToolBar, Insets getMargin()

Returns the margin between the toolbartool bar'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 toolbartool bar. The value is either HORIZONTAL or VERTICAL. @return an integer representing the current orientation -- either HORIZONTAL or VERTICAL @see #setOrientation
Class JToolBar, ToolBarUI getUI()

Returns the toolbartool bar's current UI. @see #setUI
Class JToolBar, boolean isBorderPainted()

ChecksGets whether the border shouldborderPainted be paintedproperty. @return true if the border shouldvalue be paintedof the elseborderPainted falseproperty @see #setBorderPainted
Class JToolBar, boolean isFloatable()

ReturnsGets true if the JToolbarfloatable can be dragged out by the userproperty. @return truethe value ifof the JToolbarfloatable can be dragged out byproperty the user false@see otherwise#setFloatable
Class JToolBar, void paintBorder(Graphics)

PaintPaints the toolbartool bar's border if the BorderPaintedborderPainted property is true. @param g the Graphics context in which the painting is done @see JComponent#paint @see JComponent#setBorder
Class JToolBar, void setBorderPainted(boolean)

Sets whetherthe borderPainted property which is true if the border should be painted. The default value for this property is true. Some look and feels might not implement painted borders; they will ignore this property. @param b if true the border is painted @see #isBorderPainted @beaninfo description: Does the toolbartool bar paint its borders bound: true expert: true
Class JToolBar, void setFloatable(boolean)

Sets whetherthe floatable property which must be true for the toolbaruser to move the tool bar. Typically a floatable tool bar can be made todragged into floata different position within the same container or out into its own window. The default value of this property is true. Some look and feels might not implement floatable tool bars; they will ignore this property. @param b if true the toolbartool bar can be dragged outmoved; false otherwise @see #isFloatable @beaninfo description: Can the toolbartool bar be made to float by the user bound: true preferred: true
Class JToolBar, void setMargin(Insets)

Sets the margin between the toolbartool bar's border and its buttons. Setting to null causes the toolbartool bar to use the default margins. The toolbartool bar's default Border object uses this value to create the proper margin. However if a non-default border is set on the toolbartool bar 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 toolbartool bar's border and contents bound: true expert: true
Class JToolBar, void setOrientation(int)

Sets the orientation of the toolbartool bar. The orientation must have either the value HORIZONTAL or VERTICAL. If orientation is an invalid value an exception will be thrown. @param o the new orientation -- either HORIZONTAL or VERTICAL @exception IllegalArgumentException if orientation is neither HORIZONTAL nor VERTICAL @see #getOrientation @beaninfo description: The current orientation of the toolbartool bar 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 descriptionbound: The menu item's UI delegatetrue boundhidden: true expertattribute: visualUpdate true hiddendescription: trueThe UI object that implements the Component's LookAndFeel.

Class JToolTip

Used to display a "Tip" for a Component. Typically components provide api to automate the process of using ToolTips. 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see JComponent#setToolTipText @see JComponent#createToolTip @version %I% %G%1.44 12/03/01 @author Dave Moore @author Rich Shiavi


Class JToolTip.AccessibleJToolTip

This class implements accessibility support for the JToolTip class. It provides an implementation of the Java Accessibility API appropriate to tool tip 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JToolTip, void setComponent(JComponent)

Specifies the component that the tooltip describes. The component c may be null and will have no effect.

This is a bound property. @param c the JComponent being described @see JComponent#createToolTip @beaninfo bound: true description: Sets the component that the tooltip describes.

Class JToolTip, void updateUI()

NotificationResets from the UIFactory that the L&F has changed.UI Calledproperty to replace thea UI withvalue from the latest versioncurrent from thelook and UIFactoryfeel. @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 ancestor. All of a viewable nodes parents 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.

The following JTree methods use "visible" to mean "displayed":

The next group of JTree methods use "visible" to mean "viewable" (under an expanded parent):

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 detecting either double-click events or when a user clicks on a node regardless of whether or not it was selected we recommend you do the following:

 final JTree tree = ...; MouseListener ml = new MouseAdapter() { public void mousePressed(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 #setCellRenderer to tell the tree to use it. To edit such nodes subclass TreeCellEditor and use #setCellEditor

Like all JComponent classes you can use InputMap and ActionMap to associate an Action object with a KeyStroke and execute the action under specified conditions.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @beaninfo attribute: isContainer false description: A component that displays a set of hierarchical data as an outline. @version $I%1.158 0412/0603/0001 @author Rob Davis @author Ray Ryan @author Scott Violet


Class JTree.AccessibleJTree

This class implements accessibility support for the JTree class. It provides an implementation of the Java Accessibility API appropriate to tree 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder

Class JTree.AccessibleJTree, Accessible getAccessibleAt(Point)

Returns the Accessible child if one exists contained at the local coordinate Point. Otherwise returns null. @param p point in local coordinates of this Accessible @return the Accessible if it exists at the specified location; else null

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 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


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(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, 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 getExpandsSelectedPaths is true it is made viewable.

Note that JTree does not allow duplicate nodes to exist as children under the same parent -- each sibling must be a unique object. @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.

Note that JTree does not allow duplicate nodes to exist as children under the same parent -- each sibling must be a unique object. @param paths an array of TreePath objects that specifies the nodes to add

Class JTree, void fireTreeCollapsed(TreePath)

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 firepath methodparameter. @param path the TreePath indicating the node that was collapsed @see EventListenerList
Class JTree, void fireTreeExpanded(TreePath)

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 firepath methodparameter. @param path the TreePath indicating the node that was expanded @see EventListenerList
Class JTree, void fireTreeWillCollapse(TreePath)

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 firepath methodparameter. @param path the TreePath indicating the node that was expanded @see EventListenerList
Class JTree, void fireTreeWillExpand(TreePath)

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 firepath methodparameter. @param path the TreePath indicating the node that was expanded @see EventListenerList
Class JTree, void fireValueChanged(TreeSelectionEvent)

Notifies 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 to be fired; generated by the TreeSelectionModel when a node is selected or deselected @see EventListenerList
Class JTree, boolean getScrollsOnExpand()

Returns true if the tree scrollsvalue to showof previouslythe hiddenscrollsOnExpand childrenproperty. @return true if when a node is expanded asthe manyvalue of the descendants as possible are scrolled to bescrollsOnExpand visibleproperty
Class JTree, boolean getShowsRootHandles()

Returns true ifthe handles forvalue of the root nodes areshowsRootHandles displayedproperty. @return truethe if root handlesvalue of the areshowsRootHandles displayedproperty @see #showsRootHandles
Class JTree, TreeUI getUI()

Returns the L&F object that renders this component. @return the TreeUI object that renders this component
Class JTree, boolean isPathEditable(TreePath)

Returns isEditable. This is invoked from the UI before editing begins to insure that the given path can be edited. This is provided as an entry point for subclassers to add filtered editing without having to resort to creating a new editor. @return true if every parent node and the node itself is editablededitable @see #isEditable
Class JTree, boolean isRowSelected(int)

Returns true if the node identitifedidentified by row is selected. @param row an integer specifying a display row where 0 is the first row in the display @return true if the node is selected
Class JTree, void removeSelectionRow(int)

Removes the pathrow at the index row from the current selection. @param path the TreePath identifying the node to remove
Class JTree, void removeSelectionRows(int[])

Removes the pathsrows that are selected at each of the specified rows. @param row an array of ints specifying display rows where 0 is the first row in the display
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 interrupedinterrupted and data is saved; 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 setScrollsOnExpand(boolean)

DeterminesSets the scrollsOnExpand property which determines whether orthe nottree might scroll to show previously hidden children. If this property is true (the default) when a node isexpands expandedthe tree can use scrolling to make the maximum as manypossible number of the node's descendants arevisible. scrolledIn some look and feels trees might not need to bescroll when insideexpanded; the viewport asthose look and possiblefeels will ignore this property. The@param defaultnewValue isfalse to disable scrolling on expansion; true. to enable it @see #getScrollsOnExpand @beaninfo bound: true description: Indicates if a node descendentdescendant should be scrolled when expanded.
Class JTree, void setShowsRootHandles(boolean)

DeterminesSets the value of the showsRootHandles property which specifies whether the node handles are toshould be displayed. The default value of this property depends on the constructor used to create the JTree. Some look and feels might not support handles; they will ignore this property. @param newValue true if root handles are toshould be displayed; otherwise false @see #showsRootHandles @see #getShowsRootHandles @beaninfo bound: true description: Whether the node handles are to be displayed.
Class JTree, void setUI(TreeUI)

Sets the L&F object that renders this component. @param ui the TreeUI L&F object @see UIDefaults#getUI @beaninfo bound: true hidden: true attribute: visualUpdate true description: The UI object that implements the Component's LookAndFeel.
Class JTree, void setVisibleRowCount(int)

Sets the number of rows that are to be displayed. This will only work if the recievertree 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 JViewport

The "viewport" or "porthole" through which you see the underlying information. When you scroll what moves is the viewport. It 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 WindowsWindow's 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 copyAreas. 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.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.87 02102 12/0903/01 @author Hans Muller @author Philip Milne @see JScrollPane


Class JViewport.AccessibleJViewport

This class implements accessibility support for the JViewport class. It provides an implementation of the Java Accessibility API appropriate to viewport 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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JViewport.ViewListener

A listener for the view.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder


Class JViewport, void addImpl(Component, Object, int)

Sets the JViewport's 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 lightweight child of the viewport @param constraints the constraints to be respected @param index the index @see #setView
Class JViewport, ViewportUI getUI()

Returns the L&F object that renders this component. @return a ViewportUI object
Class JViewport, Component getView()

Returns the JViewport's one child or null. @return the viewports child or null if none exists @see #setView
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 reshape(int, int, int, int)

Sets the bounds of this viewport. If the viewportsviewport's 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)

OverriddenScrolls to scroll the view so that Rectangle within the view becomes visible.

This attempts to validate the view before scrolling if the view is currently not valid - isValid returns false. To avoid excessive validation when the containment hierarchy is being created this will not validate if one of the ancestors does not have a peer or there is no validate root ancestor or one of the ancestors is not a Window or Applet.

Note that this method will not scroll outside of the valid viewport; for example if contentRect is larger than the viewport scrolling will be confined to the viewport's bounds. @param contentRect the Rectangle to display @see JComponent#isValidateRoot @see java.awt.Component#isValid @see java.awt.Component#getPeer

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'sits 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 setUI(ViewportUI)

Sets the L&F object that renders this component. @param ui the ViewportUI L&F object @see UIDefaults#getUI @beaninfo expertbound: true hidden: true attribute: visualUpdate true description: The L&FUI object that renders thisimplements the componentComponent's LookAndFeel.
Class JViewport, void setView(Component)

Sets the JViewport's one lightweight child (view) which can be null. @param view the viewportsviewport's new lightweight child @see #getView
Class JViewport, void setViewSize(Dimension)

Sets the view coordinates that appear in the upper left hand cornersize of the viewportview. and the size of theA state changed event will viewbe fired. @param newSize a Dimension object specifying the size andnew locationsize of the new view coordinates or null if there is no view
Class JViewport, void updateUI()

NotificationResets from the UIFactoryUI property to thata value from the L&Fcurrent look has changedand feel. @see JComponent#updateUI
Class JViewport, int BLIT_SCROLL_MODE

Use graphics.copyArea() to implement scrolling. This is the fastest for most applications. @see #setScrollMode @since 1.3
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 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 optimized 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 JViewport 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'sits 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 LayoutManagers 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see JRootPane @beaninfo attribute: isContainer true attribute: containerDelegate getContentPane description: A toplevel window which has no system border or controls. @version 1.37 0252 12/0903/01 @author David Kloba

Class JWindow, constructor JWindow()

Creates a window with no specified owner. This window will not be focusable.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see #isFocusableWindow @see JComponent#getDefaultLocale

Class JWindow, constructor JWindow(Frame)

Creates a window with the specified owner frame. If owner is null the shared owner will be used and this window will not be focusable. Also this window will not be focusable unless its owner is showing on the screen.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param owner the frame from which the window is displayed @throws HeadlessException if GraphicsEnvironment.isHeadless() returns true. @see java.awt.GraphicsEnvironment#isHeadless @see #isFocusableWindow @see JComponent#getDefaultLocale

Class JWindow, constructor JWindow(GraphicsConfiguration)

Creates a window with the specified GraphicsConfiguration of a screen device. This window will not be focusable.

This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale. @param gc the GraphicsConfiguration that is used to construct the new window with; if gc is null the system default GraphicsConfiguration is assumed @exceptionthrows HeadlessException If GraphicsEnvironment.isHeadless() returns true. @throws IllegalArgumentException if gc is not from a screen device. @see java.awt.GraphicsEnvironment#isHeadless @see #isFocusableWindow @see JComponent#getDefaultLocale @since 1.3

Class JWindow, constructor JWindow(Window)

Creates a window with the specified owner andwindow. the specifiedThis window GraphicsConfigurationwill of a screennot be focusable device.unless @paramits owner the windowis showing toon the actscreen. asIf owner @paramis gcnull the GraphicsConfigurationshared that isowner will be used to construct the newand this window will Window;not ifbe gcfocusable. is

nullThis constructor sets the systemcomponent's defaultlocale GraphicsConfigurationproperty is assumedto the @exceptionvalue IllegalArgumentException ifreturned by gcJComponent.getDefaultLocale. is@param notowner the window from a screenwhich the device.window @exceptionis IllegalArgumentExceptiondisplayed if@throws owner isHeadlessException if nullGraphicsEnvironment.isHeadless() returns true. @sincesee 1java.awt.3GraphicsEnvironment#isHeadless @see #isFocusableWindow @see JComponent#getDefaultLocale

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 BorderLayoutGridLayout(1 2)) 
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 update(Graphics)

UpdatesCalls the container. This forwards the update to any lightweight components that are children of this container. If this method is reimplemented super.updatepaint(g) should be called so that lightweight components are properly rendered. If a child component is entirely clipped by the current clippingThis setting in gmethod was overridden update()to will not be forwardedprevent an unnecessary call to thatclear the childbackground. @param g the specified Graphics windowcontext @seein java.awt.Component#update(java.awt.Graphics)which to paint

Class KeyStroke

A KeyStroke instance represents a key being typedaction on the keyboard --or equivalent input device. KeyStrokes can it contains bothcorrespond to only a charpress code foror release theof a particular key just as KEY_PRESSED and KEY_RELEASED KeyEvents do; alternately they can correspond to typing a modifierspecific Java character just as KEY_TYPED KeyEvents do. In all cases KeyStrokes can specify modifiers (alt shift ctrlcontrol meta or a combination thereof) which must be present during the action for an exact match.

KeyStroke objectsKeyStrokes 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 componentsComponents with which they are registered with.

KeyStroke objects handle both character-code generating keystrokes you would trapKeyStrokes with a KeyTyped eventare handlerimmutable and key-code generatingare keystrokesintended (liketo Enterbe orunique. F1)Client that you would trapcode cannot create a withKeyStroke; a KeyPressed eventvariant of handler.getKeyStroke KeyStroke objectsmust be used areinstead. immutable andThese factory unique.methods Allallow the KeyStroke objects areimplementation cached.to To get one usecache and share instances getKeyStrokeefficiently.

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 futureAs release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see javax.swing.text.Keymap @see #getKeyStroke @version 1.38 0742 12/2603/0001 @author Arnaud Weber @author David Mendenhall

Class KeyStroke, char getKeyChar()

Returns the character definedfor by this KeyStroke objectAWTKeyStroke. @return a char value @see #getKeyStrokegetAWTKeyStroke(char)
Class KeyStroke, int getKeyCode()

Returns the numeric keycode defined bykey code for this KeyStroke objectAWTKeyStroke. @return an int containing the keycodekey code value @see #getKeyStrokegetAWTKeyStroke(int int)
Class KeyStroke, KeyStroke getKeyStroke(Character, int)

ReturnReturns a shared instance of a key strokeKeyStroke given a characterCharacter object and a set of modifiers. Note that the first parameter is of type Character rather than char. This is to avoid inadvertent clashes with codecalls that existed prior to the introduction of this method which may have been calling getKeyStroke(int keyCode int modifiers) with quoted characters and relying on their automatic conversion to type int. The modifiers consist of any combination of: Since these numbers are all different powers of two any combination of them is an integer in which each bit represents a different modifier key. Use 0 to specify no modifiers. @param keyChar the characterCharacter object for a keyboard character. @param modifiers an int specifyinga anybitwise-ored combination of the keyany modifiers. @return aan KeyStroke object for that key @throw IllegalArgumentException if keyChar is null @see java.awt.event.InputEvent @since 1.3
Class KeyStroke, KeyStroke getKeyStroke(String)

ParseParses a string and returnreturns a KeyStroke. The string hasmust have the following syntax:
 <modifiers>* (<typedID> | <pressedReleasedID>) modifiers := shift | control | ctrl | meta | alt | button1 | button2 | button3 typedID := typed <typedKey> typedKey := string of length 1 giving unicodeUnicode character. pressedReleasedID := (pressed | released) key key := KeyEvent keycodekey code name i.e. the name following "VK_". 
If typed pressed or released is not specified pressed is assumed. Here are some examples:
 "INSERT" => new KeyStrokegetKeyStroke(0 KeyEvent.VK_INSERT 0); "control DELETE" => new KeyStrokegetKeyStroke(InputEvent.CTRL_MASK KeyEvent.VK_DELETE InputEvent.CTRL_MASK); "alt shift X" => new KeyStrokegetKeyStroke(KeyEvent.VK_X InputEvent.ALT_MASK | InputEvent.SHIFT_MASK KeyEvent.VK_X); "alt shift released X" => new KeyStrokegetKeyStroke(KeyEvent.VK_X InputEvent.ALT_MASK | InputEvent.SHIFT_MASK KeyEvent.VK_X true); "typed a" => new KeyStrokegetKeyStroke('a'); 
ForIn order to maintain backward-compatibility specifying a null String or a String which is formatted incorrectly returns null. @param s a String compatability thisformatted as willdescribed above @return a KeyStroke object for that String or null if sthe specified String is not in the abovenull or is formatted format.incorrectly
Class KeyStroke, KeyStroke getKeyStroke(char)

ReturnReturns a shared instance of a key stroke that is activated when the key is pressedKeyStroke (that isrepresents a KeyStrokeKEY_TYPED event for the KEY_TYPEDspecified event)character. @param keyChar the character value for a keyboard key @return a KeyStroke object for that key
Class KeyStroke, KeyStroke getKeyStroke(char, boolean)

ReturnReturns a sharedan instance of a key strokeKeyStroke specifying whether the key is considered to be activated when it is pressed or whenreleased. it isUnlike all releasedother factory methods in this class the instances returned by this method are not necessarily cached or shared. @param keyChar the character value for a keyboard key @param onKeyRelease a boolean value. When true specifies that the key is active whenif this KeyStroke corresponds to a key itrelease; isfalse releasedotherwise. @return a KeyStroke object for that key @deprecated use getKeyStroke(char)
Class KeyStroke, KeyStroke getKeyStroke(int, int)

ReturnReturns a shared instance of a key strokeKeyStroke given a charnumeric key code and a set of modifiers. --The the key is activated when it is pressedreturned KeyStroke will correspond to a key press.

The "virtual key" constants defined in java.awt.event.KeyEvent can be used to specify the key code. For example:

The modifiers consist of any combination of: Since these numbers are all different powers of two any combination of them is an integer in which each bit represents a different modifier key. Use 0 to specify no modifiers. @param keyCode an int specifying the numeric code for a keyboard key @param modifiers an int specifyinga anybitwise-ored combination of the keyany modifiers. @return a KeyStroke object for that key @see java.awt.event.KeyEvent @see java.awt.event.InputEvent
Class KeyStroke, KeyStroke getKeyStroke(int, int, boolean)

ReturnReturns a shared instance of a key strokeKeyStroke given a numeric keycodekey code and a set of modifiers specifying whether the key is activated when it is pressed or released.

The "virtual key" constants defined in java.awt.event.KeyEvent can be used to specify the key code. For example:

The modifiers consist of any combination of: Since these numbers are all different powers of two any combination of them is an integer in which each bit represents a different modifier key. Use 0 to specify no modifiers. @param keyCode an int specifying the numeric code for a keyboard key @param modifiers an int specifyinga anybitwise-ored combination of the keyany modifiers. @param onKeyRelease a boolean value. When true specifiesif that the key is active when itKeyStroke should represent a key isrelease; releasedfalse otherwise. @return a KeyStroke object for that key @see java.awt.event.KeyEvent @see java.awt.Eventevent.InputEvent
Class KeyStroke, KeyStroke getKeyStrokeForEvent(KeyEvent)

ReturnReturns a keystrokeKeyStroke from anwhich represents eventthe stroke which generated a given KeyEvent.

This method obtains the keyChar from a KeyTyped event and the keyCodekey code from a KeyPressed or KeyReleased event. so you the type ofThe KeyEvent modifiers are obtained eventfor all three types doesn'tof matterKeyEvent. @param anEvent the KeyEvent from which to obtain the KeyStroke from @return the KeyStroke that precipitated the event

Class KeyStroke, int getModifiers()

Returns the modifier keys definedfor by this KeyStroke objectAWTKeyStroke. @return an int containing the modifiers @see #getKeyStrokegetAWTKeyStroke(int int)
Class KeyStroke, int hashCode()

Returns a numeric value for this object that is likely to be reasonably unique somaking it cana be usedgood choice as the index value in a Hashtablehash table. @return an int that "represents" this object @see java.util.Hashtable
Class KeyStroke, boolean isOnKeyRelease()

Returns true ifwhether this keystroke isAWTKeyStroke active onrepresents a key release. @return true if activethis AWTKeyStroke represents ona key release; false if active on key pressotherwise @see #getKeyStrokegetAWTKeyStroke(int int boolean)

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.14 0215 12/0203/0001 @author Hans Muller

Class ListModel, void addListDataListener(ListDataListener)

AddAdds a listener to the list that's notified each time a change to the data model occurs. @param l the ListDataListener to be added
Class ListModel, Object getElementAt(int)

Returns the value at the specified index. @param index the requested index @return the value at index
Class ListModel, int getSize()

Returns the length of the list. @return the length of the list
Class ListModel, void removeListDataListener(ListDataListener)

RemoveRemoves a listener from the list that's notified each time a change to the data model occurs. @param l the ListDataListener to be removed

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.17 0218 12/0203/0001 @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.24 0229 12/0203/0001 @author Tom Ball @author Hans Muller

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.8 029 12/0203/0001 @author Arnaud Weber

Class MenuSelectionManager

A MenuSelectionManager owns the selection in menu hierarchy. @version 1.23 0232 12/0203/0001 @author Arnaud Weber

Class MutableComboBoxModel

A mutable version of ComboBoxModel. @version 1.8 0210 12/0203/0001 @author Tom Santos
Class MutableComboBoxModel, void addElement(Object)

Adds an item toat the end of the model. The implementation of this method should notify all registered ListDataListeners that the item has been added. @param obj the Object to be added
Class MutableComboBoxModel, void insertElementAt(Object, int)

Adds an item at a specific index. The implementation of this method should notify all registered ListDataListeners that the item has been added. @param obj the Object to be added @param index location to add the object
Class MutableComboBoxModel, void removeElement(Object)

Removes an item from the model. The implementation of this method should should notify all registered ListDataListeners that the item has been removed. @param obj the Object to be removed
Class MutableComboBoxModel, void removeElementAt(int)

Removes an item at a specific index. The implementation of this method should notify all registered ListDataListeners that the item has been removed. @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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.19 0224 12/0203/0001 @author Timothy Prinzing

Class OverlayLayout, constructor OverlayLayout(Container)

Constructs a layout manager that performs overlay arrangmentarrangement of the children. The layout manager created is dedicated to the given container. @param target Thethe container to do layout against.
Class OverlayLayout, void addLayoutComponent(Component, Object)

Adds the specified component to the layout using the specified constraint object. Used by this class to know when to invalidate layout. @param comp the component to be added @param constraints where/how the component is added to the layout.
Class OverlayLayout, void addLayoutComponent(String, Component)

Adds the specified component to the layout. NotUsed used by this class to know when to invalidate layout. @param name the name of the component @param comp the the component to be added
Class OverlayLayout, float getLayoutAlignmentX(Container)

Returns the alignment along the x axis for the container. If the major axis of the box is the x axis the default alignment will be returned otherwise the alignment needed to place the children along the x axis will be returned. @param target the container @return the alignment >= 0.0f && < 1.0f
Class OverlayLayout, float getLayoutAlignmentY(Container)

Returns the alignment along the y axis for the container. If the major axis of the box is the y axis the default alignment will be returned otherwise the alignment needed to place the children along the y axis will be returned. @param target the container @return the alignment >= 0.0f && < 1.0f
Class OverlayLayout, void layoutContainer(Container)

Called by the AWT when the specified container needs to be laid out. @param target the container to lay out @exception AWTError if the target isn't the container specified to the BoxLayout constructor
Class OverlayLayout, void removeLayoutComponent(Component)

Removes the specified component from the layout. NotUsed used by this class to know when to invalidate layout. @param comp the component to remove

Class ProgressMonitor

A class to monitor the progress of some operation. If it looks like the 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.24 0225 12/0903/01


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.16 0217 12/0203/0001


Class Renderer

Defines the requirements for an object responsible for "rendering" (displaying) a value. @version 1.9 0210 12/0203/0001 @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.39 0249 12/0203/0001 @author Arnaud Weber
Class RepaintManager, Image getOffscreenBuffer(Component, int, int)

Return the offscreen buffer that should be used as a double buffer with the component c. By default there is a double buffer per RepaintManager. The buffer might be smaller than (proposedWidth proposedHeight) This happens when the maximum double buffer size as been set for the receiving repaint manager.
Class RepaintManager, boolean isDoubleBufferingEnabled()

Returns true if this objectRepaintManager is double buffered. The default value for this property may vary from platform to platform. On platforms where native double buffering is supported in the AWT the default value will be false to avoid unnecessary buffering in Swing. On platforms where native double buffering is not supported the default value will be true. @return true if this object is double buffered
Class RepaintManager, void setDoubleBufferingEnabled(boolean)

Enables or disables double buffering in this RepaintManager. CAUTION: The default value for this property is set for optimal paint performance on the given platform and it is not recommended that programs modify this property directly. @param aFlag true to activate double buffering @see #isDoubleBufferingEnabled

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.11 0212 12/0203/0001 @author Hans Muller

Class ScrollPaneConstants

Constants used with the JScrollPane component. @version 1.14 0215 12/0203/0001 @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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see JScrollPane @see JViewport @version 1.47 0254 12/0203/0001 @author Hans Muller


Class ScrollPaneLayout.UIResource

The UI resource version of ScrollPaneLayout.

Class ScrollPaneLayout, void addLayoutComponent(String, Component)

Adds the specified component to the layout. The layout is identified using one of: @param s the component identifier @param comp the the component to be added @exception IllegalArgumentException if s is an invalid key
Class ScrollPaneLayout, Component addSingletonComponent(Component, Component)

TheRemoves method used to remove an existing component. SinceWhen there cana be one and only onenew component such as the left corner or vertical scrollbar and so on. So only one of each subcomponent is allowedadded the old one is removed (if it exists) whenmust a new one isbe addedremoved.

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, JViewport getColumnHeader()

Returns the JViewport object that is the column header. @return the JViewport object that is the column header @see JScrollPane#getColumnHeader
Class ScrollPaneLayout, Component getCorner(String)

Returns the Component at the specified corner. @param key the String specifying the corner @return the Component at the specified corner as defined in ScrollPaneConstantsi key is not one of the four corners null is returned @see JScrollPane#getCorner
Class ScrollPaneLayout, JScrollBar getHorizontalScrollBar()

Returns the JScrollBar object that handles horizontal scrolling. @return the JScrollBar object that handles horizontal scrolling @see JScrollPane#getHorizontalScrollBar
Class ScrollPaneLayout, int getHorizontalScrollBarPolicy()

Returns the horizontal scrollbar-display policy. @return an intinteger giving the display policy @see #setHorizontalScrollBarPolicy
Class ScrollPaneLayout, JViewport getRowHeader()

Returns the JViewport object that is the row header. @return the JViewport object that is the row header @see JScrollPane#getRowHeader
Class ScrollPaneLayout, JScrollBar getVerticalScrollBar()

Returns the JScrollBar object that handles vertical scrolling. @return the JScrollBar object that handles vertical scrolling @see JScrollPane#getVerticalScrollBar
Class ScrollPaneLayout, int getVerticalScrollBarPolicy()

Returns the vertical scrollbar-display policy. @return an intinteger giving the display policy @see #setVerticalScrollBarPolicy
Class ScrollPaneLayout, JViewport getViewport()

Returns the JViewport object that displays the scrollable contents. @return the JViewport object that displays the scrollable contents @see JScrollPane#getViewport
Class ScrollPaneLayout, void layoutContainer(Container)

LayLays out the scrollpane. The positioning of components depends on the following constraints: @param parent the Container to lay out
Class ScrollPaneLayout, Dimension minimumLayoutSize(Container)

The minimum size of a ScrollPane is the size of the insets plus minimum size of the viewport plus the scrollpane's viewportBorder insets plus the minimum size of the visible headers plus the minimum size of the scrollbars whose displayPolicy isn't NEVER. @param parent the Container that will be laid out @return a Dimension object specifying the minimum size
Class ScrollPaneLayout, Dimension preferredLayoutSize(Container)

The preferred size of a ScrollPane is the size of the insets plus the preferred size of the viewport plus the preferred size of the visible headers plus the preferred size of the scrollbars that will appear given the current view and the current scrollbar displayPolicies.

Note that the rowHeader is calculated as part of the preferred width and the colHeader is calculated as part of the preferred size. @param parent the Container that will be laid out @return a Dimension object specifying the preferred size of the viewport and any scrollbars. @see ViewportLayout @see LayoutManager

Class ScrollPaneLayout, void setHorizontalScrollBarPolicy(int)

Sets the horizontal scrollbar-display policy. The options are: Note: Applications should use the JScrollPane version of this method. It only exists for backwards compatibility with the Swing 1.0.2 (and earlier) versions of this class. @param x an int giving the display policy @exception IllegalArgumentException if x is not a valid horizontal scrollbar policy as listed above
Class ScrollPaneLayout, void setVerticalScrollBarPolicy(int)

Sets the vertical scrollbar-display policy. The options are: Note: Applications should use the JScrollPane version of this method. It only exists for backwards compatibility with the Swing 1.0.2 (and earlier) versions of this class. @param x an intinteger giving the display policy @exception IllegalArgumentException if x is an invalid vertical scroll bar policy as listed above
Class ScrollPaneLayout, void syncWithScrollPane(JScrollPane)

This method must beis invoked called after settingthe aScrollPaneLayout is set as the LayoutManager JScrollPanes layoutof a managerJScrollPane. It initializes all of the internal fields that are ordinarily set by addLayoutComponent(). For example:
 ScrollPaneLayout mySPLayout = new ScrollPanelLayout() { public void layoutContainer(Container p) { super.layoutContainer(p); // do some extra work here ... } }; scrollpane.setLayout(mySPLayout): mySPLayout.syncWithScrollPane(scrollpane); 
Class ScrollPaneLayout, JViewport colHead

The column header child. Default is null. @see JScrollPane#setColumnHeader
Class ScrollPaneLayout, JScrollBar hsb

The scrollpanesscrollpane's horizontal scrollbar child. Default is a JScrollBar. @see JScrollPane#setHorizontalScrollBar
Class ScrollPaneLayout, int hsbPolicy

The display policy for the horizontal scrollbar. The default is JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED.

This field is obsolete please use the JScrollPane field instead. @see JScrollPane#setHorizontalScrollBarPolicy

Class ScrollPaneLayout, Component lowerLeft

The component to display in the lower left corner. Default is null. @see JScrollPane#setCorner
Class ScrollPaneLayout, Component lowerRight

The component to display in the lower right corner. Default is null. @see JScrollPane#setCorner
Class ScrollPaneLayout, JViewport rowHead

The row header child. Default is null. @see JScrollPane#setRowHeader
Class ScrollPaneLayout, Component upperLeft

The component to display in the upper left corner. Default is null. @see JScrollPane#setCorner
Class ScrollPaneLayout, Component upperRight

The component to display in the upper right corner. Default is null. @see JScrollPane#setCorner
Class ScrollPaneLayout, JViewport viewport

The scrollpanesscrollpane's viewport child. Default is an empty JViewport. @see JScrollPane#setViewport
Class ScrollPaneLayout, JScrollBar vsb

The scrollpanesscrollpane's vertical scrollbar child. Default is a JScrollBar. @see JScrollPane#setVerticalScrollBar
Class ScrollPaneLayout, int vsbPolicy

The display policy for the vertical scrollbar. The default is JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED.

This field is obsolete please use the JScrollPane field instead. @see JScrollPane#setVerticalScrollBarPolicy


Class Scrollable

An interface that provides information to a scrolling container like JScrollPane. A complex component that's likely to be used as a viewinviewing a JScrollPane viewport (or other scrolling container) should implement this interface. @see JViewport @see JScrollPane @see JScrollBar @version 1.69 0212/0203/0001 @author Hans Muller
Class Scrollable, Dimension getPreferredScrollableViewportSize()

Returns the preferred size of the viewport for a view component. For example the preferredSize of a JList component is the size required to acommodateaccommodate all of the cells in its list however the value of preferredScrollableViewportSize is the size required for JList.getVisibleRowCount() rows. A component without any properties that would effect the viewport size should just return getPreferredSize() here. @return The preferredSize of a JViewport whose view is this Scrollable. @see JViewport#getPreferredSize
Class Scrollable, int getScrollableBlockIncrement(Rectangle, int, int)

Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns depending on the value of orientation.

Scrolling containers like JScrollPane will use this method each time the user requests a block scroll. @param visibleRect The view area visible within the viewport @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL. @param direction Less than zero to scroll up/left greater than zero for down/right. @return The "block" increment for scrolling in the specified direction. This value should always be positive. @see JScrollBar#setBlockIncrement

Class Scrollable, boolean getScrollableTracksViewportWidth()

Return true if a viewport should always force the width of this Scrollable to match the width of the viewport. For example a noramlnormal text view that supported line wrapping would return true here since it would be undesirable for wrapped lines to disappear beyond the right edge of the viewport. Note that returning true for a Scrollable whose ancestor is a JScrollPane effectively disables horizontal scrolling.

Scrolling containers like JViewport will use this method each time they are validated. @return True if a viewport should force the Scrollables width to match its own.

Class Scrollable, int getScrollableUnitIncrement(Rectangle, int, int)

Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column depending on the value of orientation. Ideally components should handle a partially exposed row or column by returning the distance required to completely expose the item.

Scrolling containers like JScrollPane will use this method each time the user requests a unit scroll. @param visibleRect The view area visible within the viewport @param orientation Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL. @param direction Less than zero to scroll up/left greater than zero for down/right. @return The "unit" increment for scrolling in the specified direction. This value should always be positive. @see JScrollBar#setUnitIncrement


Class SingleSelectionModel

A model that supports at most one indexed selection. @version %I% %G%1.16 12/03/01 @author Dave Moore

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 either at coordinate 0 (the leftmost or topmost position) or at the coordinate representing the end of the allocated span (the rightmost or bottommost 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see Component#getMinimumSize @see Component#getPreferredSize @see Component#getMaximumSize @see Component#getAlignmentX @see Component#getAlignmentY @version 1.26 0229 12/0203/0001 @author Timothy Prinzing

Class SizeRequirements, void calculateAlignedPositions(int, SizeRequirements, SizeRequirements[], int[], int[])

Creates a bunch of offset/span pairs specifying how to lay out a set of components with the specified alignments. The resulting span allocations will overlap with each one fitting as well as possible into the given total allocation. This method requires that you specify the total amount of space to be allocated the size requirements for each component to be placed (specified as an array of SizeRequirements) and the total size requirements of the set of components (only the alignment field of which is actually used). You can get the total size requirement by invoking getAlignedSizeRequirements. Normal alignment will be done with an alignment value of 0.0f representing the left/top edge of a component. @param allocated the total span to be allocated >= 0. @param total the total of the children requests. @param children the size requirements for each component. @param offsets the offset from 0 for each child where the spans were allocated (determines placement of the span). @param spans the span allocated for each child to make the total target span.
Class SizeRequirements, void calculateTiledPositions(int, SizeRequirements, SizeRequirements[], int[], int[])

Creates a bunchset of offset/span pairs representing how to lay out a set of components end-to-end. This method requires that you specify the total amount of space to be allocated the size requirements for each component to be placed (specified as an array of SizeRequirements) and the total size requirement of the set of components. You can get the total size requirement by invoking the getTiledSizeRequirements method. The components will be tiled in the forward direction with offsets increasing from 0. @param allocated the total span to be allocated >= 0. @param total the total of the children requests. This argument is optional and may be null. @param children the size requirements for each component. @param offsets the offset from 0 for each child where the spans were allocated (determines placement of the span). @param spans the span allocated for each child to make the total target span.

Class SizeSequence

A SizeSequence object efficiently maintains an ordered list of sizes and corresponding positions. One situation for which SizeSequence might be appropriate is in a component that displays multiple rows of unequal size. In this case a single SizeSequence object could be used to track the heights and Y positions of all rows.

Another example would be a multi-column component such as a JTable in which the column sizes are not all equal. The JTable might use a single SizeSequence object to store the widths and X positions of all the columns. The JTable could then use the SizeSequence object to find the column corresponding to a certain position. The JTable could update the SizeSequence object whenever one or more column sizes changed.

The following figure shows the relationship between size and position data for a multi-column component.

The first item begins at position 0 the second at the position equal to the size of the previous item and so on.

In the figure the first index (0) corresponds to the first column the second index (1) to the second column and so on. The first column's position starts at 0 and the column occupies size0 pixels where size0 is the value returned by getSize(0). Thus the first column ends at size0 - 1. The second column then begins at the position size0 and occupies size1 (getSize(1)) pixels.

Note that a SizeSequence object simply represents intervals along an axis. In our examples the intervals represent height or width in pixels. However any other unit of measure (for example time in days) could be just as valid.

Implementation Notes

Normally when storing the size and position of entries one would choose between storing the sizes or storing their positions instead. The two common operations that are needed during rendering are: getIndex(position) and setSize(index size). Whichever choice of internal format is made one of these operations is costly when the number of entries becomes large. If sizes are stored finding the index of the entry that encloses a particular position is linear in the number of entries. If positions are stored instead setting the size of an entry at a particular index requires updating the positions of the affected entries which is also a linear calculation.

Like the above techniques this class holds an array of N integers internally but uses a hybrid encoding which is halfway between the size-based and positional-based approaches. The result is a data structure that takes the same space to store the information but can perform most operations in Log(N) time instead of O(N) where N is the number of entries in the list.

Two operations that remain O(N) in the number of entries are the insertEntries and removeEntries methods both of which are implemented by converting the internal array to a set of integer sizes copying it into the new array and then reforming the hybrid representation in place. @version 1.4 0212 12/0203/0001 @author Philip Milne

Class SizeSequence, constructor SizeSequence(int)

Creates a new SizeSequence object that contains the specified number of entries all initialized to have size 0. @param numEntries the number of sizes to track @exception NegativeArraySizeException if numEntries <0
Class SizeSequence, int getPosition(int)

Returns the start position for the specified entry. For example getPosition(0) returns 0 getPosition(1) is equal to getSize(0) getPosition(2) is equal to getSize(0) + getSize(1) and so on.

Note that if index is greater than length the value returned may be meaningless. @param index the index of the entry whose position is desired @return the starting position of the specified entry

Class SizeSequence, int getSize(int)

Returns the size of the specified entry. If index is out of the range (0 < index the behavior is unspecified. @param index the index corresponding to the entry @return the size of the entry
Class SizeSequence, void insertEntries(int, int, int)

Adds a contiguous group of entries to this SizeSequence. Note that the values of start and length must satisfy the following conditions: (0 < start = 0). If these conditions are not met the behavior is unspecified and an exception may be thrown. @param start the index to be assigned to the first entry in the group @param length the number of entries in the group @param value the size to be assigned to each new entry @exception ArrayIndexOutOfBoundsException if the parameters are outside of the range: (0 < start <(getSizes().length)) AND (length >= 0)
Class SizeSequence, void removeEntries(int, int)

Removes a contiguous group of entries from this SizeSequence. Note that the values of start and length must satisfy the following conditions: (0 < start = 0). If these conditions are not met the behavior is unspecified and an exception may be thrown. @param start the index of the first entry to be removed @param length the number of entries to be removed
Class SizeSequence, void setSize(int, int)

Sets the size of the specified entry. Note that if the value of index does not fall in the range: (0 < index the behavior is unspecified. @param index the index corresponding to the entry @param size the size of the entry

Class SwingConstants

A collection of constants generally used for positioning and orienting components on the screen. @version 1.11 0214 12/0203/0001 @author Jeff Dinkins @author Ralph Kar (orientation support)

Class SwingUtilities

A collection of utility methods for Swing. @version 1.95 07114 12/2603/0001 @author unknown
Class SwingUtilities, Component findFocusOwner(Component)

Return the child componentComponent whichof the specified Component that is hasthe focus owner if any. The@param comp HotJavathe root SecurityManager forbidsof the appletComponent accesshierarchy to getFocusOwner()search sofor ifthe focus owner @return the componentfocus owner isor null an applet we check whether a JComponentif there is no focus owner or hasif the focus. owner is not comp or Non-Swinga components indescendant of ancomp applet@see onjava.awt.KeyboardFocusManager#getFocusOwner HotJava@deprecated areAs out-of-luck 1.4 unfortunatelyreplaced by KeyboardFocusManager.getFocusOwner().
Class SwingUtilities, Accessible getAccessibleAt(Component, Point)

Returns the Accessible child contained at the local coordinate Point if one exists. Otherwise returns null. @return the Accessible at the specified location if it exists; otherwise null
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.isEventDispatchThreadisDispatchThread(). @return true if the current thread is an AWT event dispatching thread

Class SwingUtilities, void paintComponent(Graphics, Component, Container, Rectangle)

PaintPaints a component c on an abitraryarbitrary graphics g in the specified rectangle specifying a Rectangle object. The component is reparented to a private container (whose parent becomes p) which prevents c.validate() and and c.repaint() calls from propogatingpropagating up the tree. The intermediate container has no other effect.

The component should either descend from JComponent or be another kind of lightweight component. A lightweight component is one whose "lightweight" property (returned by the Component isLightweight method) is true.

@param g the Graphics object to draw on @param c the Component to draw @param p the intermedateintermediate Container @param r the Rectangle to draw in @see java.awt.Component#isLightweight

Class SwingUtilities, void paintComponent(Graphics, Component, Container, int, int, int, int)

PaintPaints a component c on an abitraryarbitrary graphics g in the specified rectangle specifying the rectangle's upper left corner and size. The component is reparented to a private container (whose parent becomes p) which prevents c.validate() and and c.repaint() calls from propogatingpropagating up the tree. The intermediate container has no other effect.

The component should either descend from JComponent or be another kind of lightweight component. A lightweight component is one whose "lightweight" property (returned by the Component isLightweight method) is true.

@param g the Graphics object to draw on @param c the Component to draw @param p the intermedateintermediate Container @param x an int specifying the left side of the area draw in in pixels measured from the left edge of the graphics context @param y an int specifying the top of the area to draw in in pixels measured down from the top edge of the graphics context @param w an int specifying the width of the area draw in in pixels @param h an int specifying the height of the area draw in in pixels @see java.awt.Component#isLightweight

Class SwingUtilities, void updateComponentTreeUI(Component)

A simple minded look and feel change: ask each node in the tree to updateUI() -- that is to initialize its UI property with the current look and feel.

Class Timer

Causes an actionFires one or tomore action occur atevents after a predefinedspecified ratedelay. For example an animation object can use a Timer as the trigger for drawing its nextframes.

Setting up a timer involves creating a Timer object registering one or more action listeners on it and starting the timer using the start framemethod. For documentationexample the following code creates and examples of using timers seestarts a timer that fires Howan action event once per second (as specified by the first argument to Usethe TimersTimer inconstructor). The Javasecond Tutorialargument to the Timer constructor specifies a listener to receive the timer's action events.

 int delay = 1000; //milliseconds ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { //...Perform a task... } }; new Timer(delay taskPerformer).start();

Each Timer has a listone or ofmore action ActionListenerslisteners and a delay (the time between actionPerformed()action callsevents). When delay milliseconds have passed athe Timer sends thefires an actionPerformed()action messageevent to its listeners. ThisBy default this cycle repeats until the stop() method is called. orIf you want the timer to fire only once invoke setRepeats(false) on the timer. To make the delay before the first action event different from the delay between events use the setInitialDelay method.

Although all Timers perform their waiting using a single shared thread (created by the first Timer object that executes) the action event handlers for Timers execute on another thread -- the event-dispatching thread. This means that the action handlers for Timers can safely perform operations on Swing components. However it also means that the handlers must execute quickly to keep the GUI responsive.

In v 1.3 another haltsTimer class was added to the Java platform: java.util.Timer. Both it and immediatelyjavax.swing.Timer ifprovide the same basic functionality but java.util.Timer is more general and has more features. The javax.swing.Timer has two features that can make it a little easier to use with GUIs. First its event handling metaphor is configuredfamiliar to sendGUI programmers and can make dealing with the event-dispatching thread a bit simpler. Second its message justautomatic thread oncesharing means that you don't have to take special steps to avoid spawning too many threads. Instead your timer uses the same thread used to make cursors blink tool tips appear and so on.

UsingYou can find further documentation and several examples of using timers by visiting How to Use Timers a section in The Java Tutorial. For more examples and help in choosing between this Timer involves firstclass and creatingjava.util.Timer itsee thenUsing starting it usingTimers in Swing theApplications start()an methodarticle in The Swing Connection.

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see java.util.Timer java.util.Timer @version 1.32 0242 12/0203/0001 @author Dave Moore

Class Timer, constructor Timer(int, ActionListener)

Creates a Timer that will notify its listeners every delay milliseconds. If delay is less than or equal to zero the timer will fire as soon as it is started. If listener is not null it's registered as an action listener on the timer. @param delay Thethe number of milliseconds between listeneraction notificationevents @param listener Anan initial listener; can be null @see #addActionListener @see #setInitialDelay @see #setRepeats
Class Timer, void addActionListener(ActionListener)

Adds an actionListeneraction listener to the Timer. @param listener the listener to add @see #Timer
Class Timer, void fireActionPerformed(ActionEvent)

NotifyNotifies all listeners that have registered interest for notification on this event type. The event instance is lazily created@param usinge the parameters passedaction into theevent to fire method. @see EventListenerList
Class Timer, int getDelay()

Returns the Timer's delay in milliseconds between firings of action events. @see #setDelay @see #getInitialDelay
Class Timer, int getInitialDelay()

Returns the Timer's initial delay. @see #setInitialDelay @see #setDelay
Class Timer, EventListener[] getListeners(Class)

ReturnReturns an array of all the objects currently registered as FooListeners upon this Timer. FooListeners are registered using the addFooListener method.

You can specify the listenerType argument with a class literal such as FooListener.class. For example you can query a Timer instance t for its action listeners ofwith the givenfollowing typecode: that

ActionListener[] als = (ActionListener[])(t.getListeners(ActionListener.class));
wereIf addedno such tolisteners exist this timermethod returns an empty array. @returnsparam alllistenerType the type of thelisteners requested; this parameter should specify an interface that descends from java.util.EventListener @return an array of all objects recievingregistered as listenerTypeFoo notificationsListeners fromon this timer or an empty array if no such listeners have been added @exception ClassCastException if listenerType doesn't specify a class or interface that implements java.util.EventListener @see #getActionListeners @see #addActionListener @see #removeActionListener @since 1.3
Class Timer, boolean getLogTimers()

Returns true if logging is enabled. @return true if logging is enabled; otherwise false @see #setLogTimers
Class Timer, boolean isCoalesce()

Returns true if the Timer coalesces multiple pending performCommand()action messagesevents. @see #setCoalesce
Class Timer, boolean isRepeats()

Returns true (the default) if the Timer will send aan actionPerformed()action messageevent to its listeners multiple times. @see #setRepeats
Class Timer, boolean isRunning()

Returns true if the Timer is running. @see #start
Class Timer, void removeActionListener(ActionListener)

Removes anthe specified action ActionListenerlistener from the Timer. @param listener the listener to remove
Class Timer, void restart()

Restarts athe Timer canceling any pending firings and causing it to fire with its initial delydelay.
Class Timer, void setCoalesce(boolean)

Sets whether the Timer coalesces multiple pending ActionEvent firings. A busy application may not be able to keep up with a Timer's messageevent generation causing multiple actionPerformed()action messageevents sends to be queued. When processed the application sends these messagesevents one after the other causing the Timer's listeners to receive a sequence of actionPerformed() messagesevents with no delay between them. Coalescing avoids this situation by reducing multiple pending messagesevents to a single message sendevent. TimersTimers coalesce their message sendsevents by default. @param flag specify false to turn off coalescing
Class Timer, void setDelay(int)

Sets the Timer's delay the number of milliseconds between successive actionPerfomed()action messagesevents. to@param delay the delay its listenersin milliseconds @see #setInitialDelay
Class Timer, void setInitialDelay(int)

Sets the Timer's initial delay. This will be usedwhich by default is forthe same as the firstbetween-event "ringing"delay. of the TimerThis is used only for the first action event. Subsequent ringings will beaction events are spaced using the delay property. @param initialDelay the delay in milliseconds between the invocation of the start method and the first action event fired by this timer @see #setDelay
Class Timer, void setLogTimers(boolean)

Enables or disables the timer log. When enabled a message is posted to System.out whenever the timer goes off. @param flag true to enable logging @see #getLogTimers
Class Timer, void setRepeats(boolean)

If flag is false instructs the Timer to send actionPerformed()only one action event to its listeners. only@param flag specify false onceto make and thenthe timer stop. after sending its first action event
Class Timer, void start()

Starts the Timer causing it to sendstart actionPerformed()sending messagesaction events to its listeners. @see #stop
Class Timer, void stop()

Stops athe Timer causing it to stop sending actionPerformed()action messagesevents to its Targetlisteners. @see #start

Class ToolTipManager

Manages all the ToolTips in the system.

ToolTipManager contains numerous properties for configuring how long it will take for the tooltips to become visible and how long till they hide. Consider a component that has a different tooltip based on where the mouse is such as JTree. When the mouse moves into the JTree and over a region that has a valid tooltip the tooltip will become visibile after initialDelay milliseconds. After dismissDelay milliseconds the tooltip will be hidden. If the mouse is over a region that has a valid tooltip and the tooltip is currently visible when the mouse moves to a region that doesn't have a valid tooltip the tooltip will be hidden. If the mouse then moves back into a region that has a valid tooltip within reshowDelay milliseconds the tooltip will immediately be shown otherwise the tooltip will be shown again after initialDelay milliseconds. @see JComponent#createToolTip @version 1.44 06/01/99 @author Dave Moore @author Rich Schiavi

Class ToolTipManager, int getDismissDelay()

Returns the dismisaldismissal delay value. @return an intinteger representing the dismisaldismissal delay value in milliseconds @see #setDismissDelay
Class ToolTipManager, int getInitialDelay()

Returns the initial delay value. @return an intinteger representing the initial delay value in milliseconds @see #setInitialDelay
Class ToolTipManager, int getReshowDelay()

Returns the reshow delay valueproperty. @return anreshown int representing the reshow delay valueproperty @see #setReshowDelay
Class ToolTipManager, boolean isEnabled()

Returns true if this object is enabled. @return true if this object is enabled false otherwise
Class ToolTipManager, boolean isLightWeightPopupEnabled()

Returns true if lightweight (all-Java) Tooltips are in use or false if heavyweight (native peer) Tooltips are being used. @return true if lightweight ToolTips are in use
Class ToolTipManager, void registerComponent(JComponent)

RegisterRegisters 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 to add @see JComponent#isFocusTraversable

Class ToolTipManager, void setDismissDelay(int)

Specifies the dismisaldismissal delay value. @param milliseconds the number of milliseconds to delay (after the cursor has moved on) before taking away the tooltip @see #getDismissDelay
Class ToolTipManager, void setEnabled(boolean)

Enables or disables the tooltip. @param flag true to enable the tip false otherwise
Class ToolTipManager, void setLightWeightPopupEnabled(boolean)

When displaying the JToolTip the ToolTipManager choosechooses to use a light weightlightweight 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. @param aFlag true if a lightweight panel is desired false otherwise
Class ToolTipManager, void setReshowDelay(int)

SpecifiesUsed to specify the amount of time before the user has to delaywait initialDelay milliseconds before reshowinga tooltip will be shown. That is if the tooltip. @paramis millisecondshidden and the time in milliseconds to delayuser moves into a region beforeof the same Component reshowingthat has a valid tooltip within milliseconds milliseconds the tooltip will immediately be shown. Otherwise if the cursoruser moves into a region with a valid tooltip after milliseconds milliseconds the user will have to wait an additional initialDelay milliseconds before the tooltip is stopsshown again. @param milliseconds time in milliseconds @see #getReshowDelay
Class ToolTipManager, ToolTipManager sharedInstance()

Returns a shared ToolTipManager instance. @return a shared ToolTipManager object
Class ToolTipManager, void unregisterComponent(JComponent)

RemoveRemoves a component from tooltip control. @param component a JComponent object to remove

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see UIManager @version 1.39 0251 12/0903/01 @author Hans Muller

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. If the key is not found in the table then it is searched for in the list of resource bundles maintained by this object. The resource bundles are searched most recently added first using the locale returned by getDefaultLocale. LazyValues and ActiveValues are not supported in the resource bundles. @param key the desired key @return the value for key @see LazyValue @see ActiveValue @see java.util.Hashtable#get @see #getDefaultLocale @see #addResourceBundle @since 1.4
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 neccessarynecessary to call it directly. @param uiClassID a string containing the class ID @param uiClassLoader the object which will load the class @return the value of Class.forName(get(uidClassID)) @see #getUI

Class UIDefaults, Object put(Object, Object)

Sets the value of key to value for all locales. 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 retrieve 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[])

Puts all of the key/value pairs in the database and unconditionally generates one PropertyChangeEvent. The events oldValue and newValue will be null and its propertyName will be "UIDefaults". The key/value pairs are added for all locales. @param keyValueList an array of key/value pairs @see #put @see java.util.Hashtable#put

Class UIManager

This class keeps track of the current look and feel and its defaults. The default look and feel class is chosen in the following manner:
  1. If the system property swing.defaultlaf is non-null use it as the default look and feel class name.
  2. If the java.util.Properties file swing.properties exists and contains the key swing.defaultlaf use its value as default look and feel class name. The location of swing.properties may vary depending upon the implementation of the Java platform. In Sun's implementation this will reside in &java.home>/lib/swing.properties. Refer to the release notes of the implementation you are using for further details.
  3. Otherwise use the Java look and feel.

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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @see javax.swing.plaf.metal @version 1.84 03102 12/0603/0001 @author Thomas Ball @author Hans Muller


Class UIManager.LookAndFeelInfo

ProvideProvides a little information about an installed LookAndFeel for the sake of configuring a menu or for initial application set up. @see UIManager#getInstalledLookAndFeels @see LookAndFeel
Class UIManager.LookAndFeelInfo, constructor UIManager.LookAndFeelInfo(String, String)

Constructs ana UIManager$s LookAndFeelInfo object. @param name a String specifying the name of the look and feel @param className a String specifiying the name of the class that implements the look and feel
Class UIManager.LookAndFeelInfo, String getClassName()

Returns the name of the class that implements this look and feel. @return the name of the class that implements this LookAndFeel @see LookAndFeel
Class UIManager.LookAndFeelInfo, String getName()

Returns the name of the look and feel in a form suitable for a menu or other presentation @return a String containing the name @see LookAndFeel#getName
Class UIManager.LookAndFeelInfo, String toString()

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

Class UIManager, void addAuxiliaryLookAndFeel(LookAndFeel)

AddAdds a LookAndFeel to the list of auxiliary look and feels. The auxiliary look and feels tell the multiplexing look and feel what other LookAndFeel classes for a component instance are to be used in addition to the default LookAndFeel class when creating a multiplexing UI. The change will only take effect when a new UI class is created or when the default look and feel is changed on a component instance.

Note these are not the same as the installed look and feels. @param laf the LookAndFeel object @see #removeAuxiliaryLookAndFeel @see #setLookAndFeel @see #getAuxiliaryLookAndFeels @see #getInstalledLookAndFeels

Class UIManager, void addPropertyChangeListener(PropertyChangeListener)

AddAdds a PropertyChangeListener to the listener list. The listener is registered for all properties. @param listener Thethe PropertyChangeListener to be added @see java.beans.PropertyChangeSupport
Class UIManager, Object get(Object)

Returns an object from the defaults table. @param key an Object specifying the desired object @return the Object
Class UIManager, LookAndFeel[] getAuxiliaryLookAndFeels()

ReturnReturns the list of auxiliary look and feels (can be null). The auxiliary look and feels tell the multiplexing look and feel what other LookAndFeel classes for a component instance are to be used in addition to the default LookAndFeel class when creating a multiplexing UI.

Note these are not the same as the installed look and feels. @return list of auxiliary LookAndFeels or null @see #addAuxiliaryLookAndFeel @see #removeAuxiliaryLookAndFeel @see #setLookAndFeel @see #getInstalledLookAndFeels

Class UIManager, Border getBorder(Object)

Returns a border from the defaults table. @param key an Object specifying the border @return the Border object
Class UIManager, Color getColor(Object)

Returns a drawing color from the defaults table. @param key an Object specifying the color @return the Color object
Class UIManager, String getCrossPlatformLookAndFeelClassName()

Returns the name of the LookAndFeel class that implements the default cross platform look and feel -- the Java Look and Feel (JLF). @return a string with the JLF implementation-class @see #setLookAndFeel @see #getSystemLookAndFeelClassName
Class UIManager, UIDefaults getDefaults()

Returns the default values for this look and feel. @return ana UIDefaults object containing the default values
Class UIManager, Dimension getDimension(Object)

Returns a dimension from the defaults table. @param key an Object specifying the dimension object @return the Dimension object
Class UIManager, Font getFont(Object)

Returns a drawing font from the defaults table. @param key an Object specifying the font @return the Font object
Class UIManager, Icon getIcon(Object)

Returns an Icon from the defaults table. @param key an Object specifying the icon @return the Icon object
Class UIManager, Insets getInsets(Object)

Returns an Insets object from the defaults table. @param key an Object specifying the Insets object @return the Insets object
Class UIManager, LookAndFeelInfo[] getInstalledLookAndFeels()

ReturnReturns an array of objects that provide some information about the LookAndFeel implementations that have been installed with this software 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()); 
@return an array of LookAndFeelInfo objects @see #setLookAndFeel
Class UIManager, int getInt(Object)

Returns an intinteger from the defaults table. @param key an Object specifying the int @return the int
Class UIManager, LookAndFeel getLookAndFeel()

Returns Thethe current default look and feel or null. @return Thethe current default look and feel or null. @see #setLookAndFeel
Class UIManager, UIDefaults getLookAndFeelDefaults()

Returns the default values for this look and feel. @return an UIDefaults object containing the default values
Class UIManager, String getString(Object)

Returns a string from the defaults table. @param key an Object specifying the string @return the String
Class UIManager, String getSystemLookAndFeelClassName()

Returns the name of the LookAndFeel class that implements the native systems look and feel if there is one otherwise the name of the default cross platform LookAndFeel class. @return the String of the LookAndFeel class @see #setLookAndFeel @see #getCrossPlatformLookAndFeelClassName
Class UIManager, ComponentUI getUI(JComponent)

Returns the L&F object that renders the target component. @param target the JComponent to render @return the ComponentUI object that renders the target component
Class UIManager, void installLookAndFeel(LookAndFeelInfo)

Adds the specified look and feel to the current array and then calls #setInstalledLookAndFeels @param info a LookAndFeelInfo object that names the look and feel and identifies that class that implements it
Class UIManager, void installLookAndFeel(String, String)

Creates a new look and feel and adds it to the current array. Then calls #setInstalledLookAndFeels @param name a String specifying the name of the look and feel @param className a String specifying the class name that implements the look and feel
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 UIManager, boolean removeAuxiliaryLookAndFeel(LookAndFeel)

RemoveRemoves a LookAndFeel from the list of auxiliary look and feels. The auxiliary look and feels tell the multiplexing look and feel what other LookAndFeel classes for a component instance are to be used in addition to the default LookAndFeel class when creating a multiplexing UI. The change will only take effect when a new UI class is created or when the default look and feel is changed on a component instance.

Note these are not the same as the installed look and feels. @return true if the LookAndFeel was removed from the list @see #removeAuxiliaryLookAndFeel @see #getAuxiliaryLookAndFeels @see #setLookAndFeel @see #getInstalledLookAndFeels

Class UIManager, 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, void setInstalledLookAndFeels(LookAndFeelInfo[])

Replaces the current array of installed LookAndFeelInfos. @param infos new array of LookAndFeelInfo objects @see #getInstalledLookAndFeels
Class UIManager, void setLookAndFeel(LookAndFeel)

SetSets the current default look and feel using a LookAndFeel object.

This is a JavaBeans bound property. @param newLookAndFeel the LookAndFeel object @exception UnsupportedLookAndFeelException Ifif lnf.isSupportedLookAndFeel() is false. @see #getLookAndFeel

Class UIManager, void setLookAndFeel(String)

SetSets the current default look and feel using a class name. @param className a string specifying the name of the class that implements the look and feel @exception ClassNotFoundException Ifif the LookAndFeel class could not be found. @exception InstantiationException Ifif a new instance of the class couldn't be creatd.created @exception IllegalAccessException Ifif the class or initializer isn't accessible. @exception UnsupportedLookAndFeelException Ifif lnf.isSupportedLookAndFeel() is false.

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. AAs future release of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @author unattributed @version 1.12 0214 12/0203/0001


Class ViewportLayout

The default layout manager for JViewport. ViewportLayout 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 releaseAs of Swing will provide1.4 support for long term persistencestorage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder @version 1.29 0234 12/0203/0001 @author Hans Muller


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 examples of setting the default window-closing operation see Responding to Window-Closing Events a section in The Java Tutorial. @version 1.13 0215 12/0203/0001 @author Amy Fowler