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 wi