Liking cljdoc? Tell your friends :D

javax.swing.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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.AbstractButton

Defines common behaviors for buttons and menu items.

Buttons can be configured, and to some degree controlled, by Actions. Using an Action with a button has many benefits beyond directly configuring a button. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Defines common behaviors for buttons and menu items.

Buttons can be configured, and to some degree controlled, by
Actions.  Using an
Action with a button has many benefits beyond directly
configuring a button.  Refer to
Swing Components Supporting Action for more
details, and you can find more information in How
to Use Actions, a section in The Java Tutorial.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.AbstractCellEditor

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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.AbstractListModel

The abstract definition for the data model that 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The abstract definition for the data model that 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.AbstractSpinnerModel

This class provides the ChangeListener part of the SpinnerModel interface that should be suitable for most concrete SpinnerModel implementations. Subclasses must provide an implementation of the setValue, getValue, getNextValue and getPreviousValue methods.

This class provides the ChangeListener part of the
SpinnerModel interface that should be suitable for most concrete SpinnerModel
implementations.  Subclasses must provide an implementation of the
setValue, getValue, getNextValue and
getPreviousValue methods.
raw docstring

javax.swing.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:

One or more text strings that describe the function. These strings can be used, for example, to display the flyover text for a button or to set the text in a menu item. One or more icons that depict the function. These icons can be used for the images in a menu control, or for composite entries in a more sophisticated user interface. The enabled/disabled state of the functionality. Instead of having to separately disable the menu item and the toolbar button, the application can disable the function that implements this interface. All components which are registered as listeners for the state change then know to disable event generation for that item and to modify the display accordingly.

This interface can be added to an existing class or used to create an adapter (typically, by subclassing AbstractAction). 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 this reason, you should take care to only use Actions where their benefits are desired, and use simple ActionListeners elsewhere.

Swing Components Supporting Action

Many of Swing's components have an Action property. When an Action is set on a component, the following things happen:

The Action is added as an ActionListener to the component. The component configures some of its properties to match the Action. The component installs a PropertyChangeListener on the Action so that the component can change its properties to reflect changes in the Action's properties.

The following table describes the properties used by Swing components that support Actions. In the table, button refers to any AbstractButton subclass, which includes not only JButton but also classes such as JMenuItem. Unless otherwise stated, a null property value in an Action (or a Action that is null) results in the button's corresponding property being set to null.

Component Property Components Action Key Notes

 enabled
 All
 The isEnabled method


 toolTipText
 All
 SHORT_DESCRIPTION


 actionCommand
 All
 ACTION_COMMAND_KEY


 mnemonic
 All buttons
 MNEMONIC_KEY
 A null value or Action results in the
     button's mnemonic property being set to
     '\0'.

 text
 All buttons
 NAME
 If you do not want the text of the button to mirror that
     of the Action, set the property
     hideActionText to true.  If
     hideActionText is true, setting the
     Action changes the text of the button to
     null and any changes to NAME
     are ignored.  hideActionText is useful for
     tool bar buttons that typically only show an Icon.
     JToolBar.add(Action) sets the property to
     true if the Action has a
     non-null value for LARGE_ICON_KEY or
     SMALL_ICON.

 displayedMnemonicIndex
 All buttons
 DISPLAYED_MNEMONIC_INDEX_KEY
 If the value of DISPLAYED_MNEMONIC_INDEX_KEY is
     beyond the bounds of the text, it is ignored.  When
     setAction is called, if the value from the
     Action is null, the displayed
     mnemonic index is not updated.  In any subsequent changes to
     DISPLAYED_MNEMONIC_INDEX_KEY, null
     is treated as -1.

 icon
 All buttons except of JCheckBox,
 JToggleButton and JRadioButton.
 either LARGE_ICON_KEY or
     SMALL_ICON
The JMenuItem subclasses only use
    SMALL_ICON.  All other buttons will use
    LARGE_ICON_KEY; if the value is null they
    use SMALL_ICON.

 accelerator
 All JMenuItem subclasses, with the exception of
     JMenu.
 ACCELERATOR_KEY


 selected
 JToggleButton, JCheckBox,
     JRadioButton, JCheckBoxMenuItem and
     JRadioButtonMenuItem
 SELECTED_KEY
 Components that honor this property only use
     the value if it is non-null. For example, if
     you set an Action that has a null
     value for SELECTED_KEY on a JToggleButton, the
     JToggleButton will not update it's selected state in
     any way. Similarly, any time the JToggleButton's
     selected state changes it will only set the value back on
     the Action if the Action has a non-null
     value for SELECTED_KEY.

     Components that honor this property keep their selected state
     in sync with this property. When the same Action is used
     with multiple components, all the components keep their selected
     state in sync with this property. Mutually exclusive
     buttons, such as JToggleButtons in a ButtonGroup,
     force only one of the buttons to be selected. As such, do not
     use the same Action that defines a value for the
     SELECTED_KEY property with multiple mutually
     exclusive buttons.

JPopupMenu, JToolBar and JMenu all provide convenience methods for creating a component and setting the Action on the corresponding component. Refer to each of these classes for more information.

Action uses PropertyChangeListener to inform listeners the Action has changed. The beans specification indicates that a null property name can be used to indicate multiple values have changed. By default Swing components that take an Action do not handle such a change. To indicate that Swing should treat null according to the beans specification set the system property swing.actions.reconfigureOnNull to the String value true.

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:

One or more text strings that describe the function. These strings
    can be used, for example, to display the flyover text for a button
    or to set the text in a menu item.
One or more icons that depict the function. These icons can be used
    for the images in a menu control, or for composite entries in a more
    sophisticated user interface.
The enabled/disabled state of the functionality. Instead of having
    to separately disable the menu item and the toolbar button, the
    application can disable the function that implements this interface.
    All components which are registered as listeners for the state change
    then know to disable event generation for that item and to modify the
    display accordingly.


This interface can be added to an existing class or used to create an
adapter (typically, by subclassing AbstractAction).
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 this reason,
you should take care to only use Actions where their benefits
are desired, and use simple ActionListeners elsewhere.


Swing Components Supporting Action

Many of Swing's components have an Action property.  When
an Action is set on a component, the following things
happen:

The Action is added as an ActionListener to
    the component.
The component configures some of its properties to match the
     Action.
The component installs a PropertyChangeListener on the
    Action so that the component can change its properties
    to reflect changes in the Action's properties.


The following table describes the properties used by
Swing components that support Actions.
In the table, button refers to any
AbstractButton subclass, which includes not only
JButton but also classes such as
JMenuItem. Unless otherwise stated, a
null property value in an Action (or a
Action that is null) results in the
button's corresponding property being set to null.



   Component Property
   Components
   Action Key
   Notes

     enabled
     All
     The isEnabled method


     toolTipText
     All
     SHORT_DESCRIPTION


     actionCommand
     All
     ACTION_COMMAND_KEY


     mnemonic
     All buttons
     MNEMONIC_KEY
     A null value or Action results in the
         button's mnemonic property being set to
         '\0'.

     text
     All buttons
     NAME
     If you do not want the text of the button to mirror that
         of the Action, set the property
         hideActionText to true.  If
         hideActionText is true, setting the
         Action changes the text of the button to
         null and any changes to NAME
         are ignored.  hideActionText is useful for
         tool bar buttons that typically only show an Icon.
         JToolBar.add(Action) sets the property to
         true if the Action has a
         non-null value for LARGE_ICON_KEY or
         SMALL_ICON.

     displayedMnemonicIndex
     All buttons
     DISPLAYED_MNEMONIC_INDEX_KEY
     If the value of DISPLAYED_MNEMONIC_INDEX_KEY is
         beyond the bounds of the text, it is ignored.  When
         setAction is called, if the value from the
         Action is null, the displayed
         mnemonic index is not updated.  In any subsequent changes to
         DISPLAYED_MNEMONIC_INDEX_KEY, null
         is treated as -1.

     icon
     All buttons except of JCheckBox,
     JToggleButton and JRadioButton.
     either LARGE_ICON_KEY or
         SMALL_ICON
    The JMenuItem subclasses only use
        SMALL_ICON.  All other buttons will use
        LARGE_ICON_KEY; if the value is null they
        use SMALL_ICON.

     accelerator
     All JMenuItem subclasses, with the exception of
         JMenu.
     ACCELERATOR_KEY


     selected
     JToggleButton, JCheckBox,
         JRadioButton, JCheckBoxMenuItem and
         JRadioButtonMenuItem
     SELECTED_KEY
     Components that honor this property only use
         the value if it is non-null. For example, if
         you set an Action that has a null
         value for SELECTED_KEY on a JToggleButton, the
         JToggleButton will not update it's selected state in
         any way. Similarly, any time the JToggleButton's
         selected state changes it will only set the value back on
         the Action if the Action has a non-null
         value for SELECTED_KEY.

         Components that honor this property keep their selected state
         in sync with this property. When the same Action is used
         with multiple components, all the components keep their selected
         state in sync with this property. Mutually exclusive
         buttons, such as JToggleButtons in a ButtonGroup,
         force only one of the buttons to be selected. As such, do not
         use the same Action that defines a value for the
         SELECTED_KEY property with multiple mutually
         exclusive buttons.


JPopupMenu, JToolBar and JMenu
all provide convenience methods for creating a component and setting the
Action on the corresponding component.  Refer to each of
these classes for more information.

Action uses PropertyChangeListener to
inform listeners the Action has changed.  The beans
specification indicates that a null property name can
be used to indicate multiple values have changed.  By default Swing
components that take an Action do not handle such a
change.  To indicate that Swing should treat null
according to the beans specification set the system property
swing.actions.reconfigureOnNull to the String
value true.
raw docstring

javax.swing.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.

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.
raw docstring

javax.swing.border.AbstractBorder

A class that implements an empty border with no size. This provides a convenient base class from which other border classes can be easily derived.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class that implements an empty border with no size.
This provides a convenient base class from which other border
classes can be easily derived.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.border.BevelBorder

A class which implements a simple two-line bevel border.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class which implements a simple two-line bevel border.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.border.Border

Interface describing an object capable of rendering a border around the edges of a swing component. For examples of using borders see How to Use Borders, a section in The Java Tutorial.

In the Swing component set, borders supercede Insets as the mechanism for creating a (decorated or plain) area around the edge of a component.

Usage Notes:

Use EmptyBorder to create a plain border (this mechanism replaces its predecessor, setInsets). Use CompoundBorder to nest multiple border objects, creating a single, combined border. Border instances are designed to be shared. Rather than creating a new border object using one of border classes, use the BorderFactory methods, which produces a shared instance of the common border types. Additional border styles include BevelBorder, SoftBevelBorder, EtchedBorder, LineBorder, TitledBorder, and MatteBorder. To create a new border class, subclass AbstractBorder.

Interface describing an object capable of rendering a border
around the edges of a swing component.
For examples of using borders see
How to Use Borders,
a section in The Java Tutorial.

In the Swing component set, borders supercede Insets as the
mechanism for creating a (decorated or plain) area around the
edge of a component.

Usage Notes:

Use EmptyBorder to create a plain border (this mechanism
    replaces its predecessor, setInsets).
Use CompoundBorder to nest multiple border objects, creating
    a single, combined border.
Border instances are designed to be shared. Rather than creating
    a new border object using one of border classes, use the
    BorderFactory methods, which produces a shared instance of the
    common border types.
Additional border styles include BevelBorder, SoftBevelBorder,
    EtchedBorder, LineBorder, TitledBorder, and MatteBorder.
To create a new border class, subclass AbstractBorder.
raw docstring

javax.swing.border.CompoundBorder

A composite Border class used to compose two Border objects into a single border by nesting an inside Border object within the insets of an outside Border object.

For example, this class may be used to add blank margin space to a component with an existing decorative border:

Border border = comp.getBorder(); Border margin = new EmptyBorder(10,10,10,10); comp.setBorder(new CompoundBorder(border, margin));

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A composite Border class used to compose two Border objects
into a single border by nesting an inside Border object within
the insets of an outside Border object.

For example, this class may be used to add blank margin space
to a component with an existing decorative border:



   Border border = comp.getBorder();
   Border margin = new EmptyBorder(10,10,10,10);
   comp.setBorder(new CompoundBorder(border, margin));

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.border.core

No vars found in this namespace.

javax.swing.border.EmptyBorder

A class which provides an empty, transparent border which takes up space but does no drawing.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class which provides an empty, transparent border which
takes up space but does no drawing.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.border.EtchedBorder

A class which implements a simple etched border which can either be etched-in or etched-out. If no highlight/shadow colors are initialized when the border is created, then these colors will be dynamically derived from the background color of the component argument passed into the paintBorder() 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class which implements a simple etched border which can
either be etched-in or etched-out.  If no highlight/shadow
colors are initialized when the border is created, then
these colors will be dynamically derived from the background
color of the component argument passed into the paintBorder()
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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.border.LineBorder

A class which implements a line border of arbitrary thickness and of a single color.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class which implements a line border of arbitrary thickness
and of a single color.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.border.MatteBorder

A class which provides a matte-like border of either a solid color or a tiled icon.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class which provides a matte-like border of either a solid color
or a tiled icon.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.border.SoftBevelBorder

A class which implements a raised or lowered bevel with softened corners.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class which implements a raised or lowered bevel with
softened corners.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.border.StrokeBorder

A class which implements a border of an arbitrary stroke.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class which implements a border of an arbitrary stroke.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI
between applications running the same version of Swing.
As of 1.4, support for long term storage of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.border.TitledBorder

A class which implements an arbitrary border with the addition of a String title in a specified position and justification.

If the border, font, or color property values are not specified in the constructor or by invoking the appropriate set methods, the property values will be defined by the current look and feel, using the following property names in the Defaults Table:

"TitledBorder.border" "TitledBorder.font" "TitledBorder.titleColor"

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class which implements an arbitrary border
with the addition of a String title in a
specified position and justification.

If the border, font, or color property values are not
specified in the constructor or by invoking the appropriate
set methods, the property values will be defined by the current
look and feel, using the following property names in the
Defaults Table:

"TitledBorder.border"
"TitledBorder.font"
"TitledBorder.titleColor"


Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

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.
raw docstring

javax.swing.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, such as Slider and ScrollBar.

The minimum and maximum set methods "correct" the other three properties to accommodate their new value argument. For example setting the model's minimum may change its maximum, value, and extent properties (in that order), to maintain the constraints specified above.

The value and extent set methods "correct" their argument to fit within the limits defined by the other three properties. For example if value == maximum, setExtent(10) would change the extent (back) to zero.

The four BoundedRangeModel values are defined as Java Beans properties however Swing ChangeEvents are used to notify clients of changes rather than PropertyChangeEvents. This was done to keep the overhead of monitoring a BoundedRangeModel low. Changes are often reported at MouseDragged rates.

For an example of specifying custom bounded range models used by sliders, see Separable model architecture in A Swing Architecture Overview.

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, such as Slider and
ScrollBar.


  The minimum and maximum set methods "correct" the other
  three properties to accommodate their new value argument.  For
  example setting the model's minimum may change its maximum, value,
  and extent properties (in that order), to maintain the constraints
  specified above.


  The value and extent set methods "correct" their argument to
  fit within the limits defined by the other three properties.
  For example if value == maximum, setExtent(10)
  would change the extent (back) to zero.


  The four BoundedRangeModel values are defined as Java Beans properties
  however Swing ChangeEvents are used to notify clients of changes rather
  than PropertyChangeEvents. This was done to keep the overhead of monitoring
  a BoundedRangeModel low. Changes are often reported at MouseDragged rates.




For an example of specifying custom bounded range models used by sliders,
see Separable model architecture
in A Swing Architecture Overview.
raw docstring

javax.swing.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.

If you are implementing a BoxLayout you can find further information and examples in How to Use BoxLayout, 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.

If you are implementing a BoxLayout you
can find further information and examples in
How to Use BoxLayout,
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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.BoxLayout

A layout manager that allows multiple components to be laid 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 BoxLayout manager is constructed with an axis parameter that specifies the type of layout that will be done. There are four choices:

X_AXIS - Components are laid out horizontally from left to right.

Y_AXIS - Components are laid out vertically from top to bottom.

LINE_AXIS - Components are laid out the way words are laid out in a line, based on the container's ComponentOrientation property. If the container's ComponentOrientation is horizontal then components are laid out horizontally, otherwise they are laid out vertically. For horizontal orientations, if the container's ComponentOrientation is left to right then components are laid out left to right, otherwise they are laid out right to left. For vertical orientations components are always laid out from top to bottom.

PAGE_AXIS - Components are laid out the way text lines are laid out on a page, based on the container's ComponentOrientation property. If the container's ComponentOrientation is horizontal then components are laid out vertically, otherwise they are laid out horizontally. For horizontal orientations, if the container's ComponentOrientation is left to right then components are laid out left to right, otherwise they are laid out right to left. For vertical orientations components are always laid out from top to bottom.

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

BoxLayout attempts to arrange components at their preferred widths (for horizontal layout) or heights (for vertical layout). For a horizontal 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 a Y alignment of 0.5, which means that the vertical center of the component should have the same Y coordinate as the vertical centers of other components with 0.5 Y alignment.

Similarly, for a vertical layout, BoxLayout attempts to make all components in the column as wide as the widest component. If that fails, it aligns them horizontally according to their X alignments. 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.

For further information and examples see How to Use BoxLayout, 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A layout manager that allows multiple components to be laid 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 BoxLayout manager is constructed with an axis parameter that
specifies the type of layout that will be done. There are four choices:

X_AXIS - Components are laid out horizontally
from left to right.

Y_AXIS - Components are laid out vertically
from top to bottom.

LINE_AXIS - Components are laid out the way
words are laid out in a line, based on the container's
ComponentOrientation property. If the container's
ComponentOrientation is horizontal then components are laid out
horizontally, otherwise they are laid out vertically.  For horizontal
orientations, if the container's ComponentOrientation is left to
right then components are laid out left to right, otherwise they are laid
out right to left. For vertical orientations components are always laid out
from top to bottom.

PAGE_AXIS - Components are laid out the way
text lines are laid out on a page, based on the container's
ComponentOrientation property. If the container's
ComponentOrientation is horizontal then components are laid out
vertically, otherwise they are laid out horizontally.  For horizontal
orientations, if the container's ComponentOrientation is left to
right then components are laid out left to right, otherwise they are laid
out right to left.  For vertical orientations components are always
laid out from top to bottom.

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

BoxLayout attempts to arrange components
at their preferred widths (for horizontal layout)
or heights (for vertical layout).
For a horizontal 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 a Y alignment of 0.5,
which means that the vertical center of the component
should have the same Y coordinate as
the vertical centers of other components with 0.5 Y alignment.

Similarly, for a vertical layout,
BoxLayout attempts to make all components in the column
as wide as the widest component.
If that fails, it aligns them horizontally
according to their X alignments.  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.

For further information and examples see
How to Use BoxLayout,
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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.ButtonModel

State model for buttons.

This model is used for regular buttons, as well as check boxes and radio buttons, which are special kinds of buttons. In practice, a button's UI takes the responsibility of calling methods on its model to manage the state, as detailed below:

In simple terms, pressing and releasing the mouse over a regular button triggers the button and causes and ActionEvent to be fired. The same behavior can be produced via a keyboard key defined by the look and feel of the button (typically the SPACE BAR). Pressing and releasing this key while the button has focus will give the same results. For check boxes and radio buttons, the mouse or keyboard equivalent sequence just described causes the button to become selected.

In details, the state model for buttons works as follows when used with the mouse:

Pressing the mouse on top of a button makes the model both armed and pressed. As long as the mouse remains down, the model remains pressed, even if the mouse moves outside the button. On the contrary, the model is only armed while the mouse remains pressed within the bounds of the button (it can move in or out of the button, but the model is only armed during the portion of time spent within the button). A button is triggered, and an ActionEvent is fired, when the mouse is released while the model is armed

  • meaning when it is released over top of the button after the mouse has previously been pressed on that button (and not already released). Upon mouse release, the model becomes unarmed and unpressed.

In details, the state model for buttons works as follows when used with the keyboard:

Pressing the look and feel defined keyboard key while the button has focus makes the model both armed and pressed. As long as this key remains down, the model remains in this state. Releasing the key sets the model to unarmed and unpressed, triggers the button, and causes an ActionEvent to be fired.

State model for buttons.

This model is used for regular buttons, as well as check boxes
and radio buttons, which are special kinds of buttons. In practice,
a button's UI takes the responsibility of calling methods on its
model to manage the state, as detailed below:

In simple terms, pressing and releasing the mouse over a regular
button triggers the button and causes and ActionEvent
to be fired. The same behavior can be produced via a keyboard key
defined by the look and feel of the button (typically the SPACE BAR).
Pressing and releasing this key while the button has
focus will give the same results. For check boxes and radio buttons, the
mouse or keyboard equivalent sequence just described causes the button
to become selected.

In details, the state model for buttons works as follows
when used with the mouse:

Pressing the mouse on top of a button makes the model both
armed and pressed. As long as the mouse remains down,
the model remains pressed, even if the mouse moves
outside the button. On the contrary, the model is only
armed while the mouse remains pressed within the bounds of
the button (it can move in or out of the button, but the model
is only armed during the portion of time spent within the button).
A button is triggered, and an ActionEvent is fired,
when the mouse is released while the model is armed
- meaning when it is released over top of the button after the mouse
has previously been pressed on that button (and not already released).
Upon mouse release, the model becomes unarmed and unpressed.

In details, the state model for buttons works as follows
when used with the keyboard:

Pressing the look and feel defined keyboard key while the button
has focus makes the model both armed and pressed. As long as this key
remains down, the model remains in this state. Releasing the key sets
the model to unarmed and unpressed, triggers the button, and causes an
ActionEvent to be fired.
raw docstring

javax.swing.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 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 approach and provide a companion object which implements the CellEditor interface (See DefaultCellEditor for example). The wrapper approach 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.

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 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 approach and provide a companion object which
implements the CellEditor interface (See
DefaultCellEditor for example).  The wrapper approach
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.
raw docstring

javax.swing.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 propagate 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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 propagate 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.colorchooser.AbstractColorChooserPanel

This is the abstract superclass for color choosers. If you want to add a new color chooser panel into a JColorChooser, subclass this 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

This is the abstract superclass for color choosers.  If you want to add
a new color chooser panel into a JColorChooser, subclass
this 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.colorchooser.ColorChooserComponentFactory

A class designed to produce preconfigured "accessory" objects to insert into color choosers.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class designed to produce preconfigured "accessory" objects to
insert into color choosers.


Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.colorchooser.core

No vars found in this namespace.

javax.swing.ComboBoxEditor

The editor component used for JComboBox components.

The editor component used for JComboBox components.
raw docstring

javax.swing.ComboBoxModel

A data model for a combo box. This interface extends ListDataModel and adds the concept of a selected item. The selected item is generally the item which is visible in the combo box display area.

The selected item may not necessarily be managed by the underlying ListModel. This disjoint behavior allows for the temporary storage and retrieval of a selected item in the model.

A data model for a combo box. This interface extends ListDataModel
and adds the concept of a selected item. The selected item is generally
the item which is visible in the combo box display area.

The selected item may not necessarily be managed by the underlying
ListModel. This disjoint behavior allows for the temporary
storage and retrieval of a selected item in the model.
raw docstring

javax.swing.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.

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.
raw docstring

javax.swing.core

No vars found in this namespace.

javax.swing.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);

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);
raw docstring

javax.swing.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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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. As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.DefaultDesktopManager

This is an implementation of the DesktopManager. It currently implements the basic behaviors for managing JInternalFrames in an arbitrary parent. JInternalFrames that are not children of a JDesktop will use this component to handle their desktop-like actions. This class provides a policy for the various JInternalFrame methods, it is not meant to be called directly rather the various JInternalFrame methods will call into the DesktopManager.

This is an implementation of the DesktopManager.
It currently implements the basic behaviors for managing
JInternalFrames in an arbitrary parent.
JInternalFrames that are not children of a
JDesktop will use this component
to handle their desktop-like actions.
This class provides a policy for the various JInternalFrame methods,
it is not meant to be called directly rather the various JInternalFrame
methods will call into the DesktopManager.
raw docstring

javax.swing.DefaultFocusManager

This 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

How to Use the Focus Subsystem, a section in The Java Tutorial, and the Focus Specification for more information.

This 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

How to Use the Focus Subsystem,
a section in The Java Tutorial, and the
Focus Specification
for more information.
raw docstring

javax.swing.DefaultListCellRenderer

Renders an item in a list.

Implementation Note: This class overrides invalidate, validate, revalidate, repaint, isOpaque, 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Renders an item in a list.

Implementation Note:
This class overrides
invalidate,
validate,
revalidate,
repaint,
isOpaque,
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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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 ListDataListeners when changes occur. Presently it delegates to a Vector, in a future release it will be a real Collection implementation.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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 ListDataListeners when changes occur.
Presently it delegates to a Vector,
in a future release it will be a real Collection implementation.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.DefaultRowSorter

An implementation of RowSorter that provides sorting and filtering around a grid-based data model. Beyond creating and installing a RowSorter, you very rarely need to interact with one directly. Refer to TableRowSorter for a concrete implementation of RowSorter for JTable.

Sorting is done based on the current SortKeys, in order. If two objects are equal (the Comparator for the column returns 0) the next SortKey is used. If no SortKeys remain or the order is UNSORTED, then the order of the rows in the model is used.

Sorting of each column is done by way of a Comparator that you can specify using the setComparator method. If a Comparator has not been specified, the Comparator returned by Collator.getInstance() is used on the results of calling toString on the underlying objects. The Comparator is never passed null. A null value is treated as occurring before a non-null value, and two null values are considered equal.

If you specify a Comparator that casts its argument to a type other than that provided by the model, a ClassCastException will be thrown when the data is sorted.

In addition to sorting, DefaultRowSorter provides the ability to filter rows. Filtering is done by way of a RowFilter that is specified using the setRowFilter method. If no filter has been specified all rows are included.

By default, rows are in unsorted order (the same as the model) and every column is sortable. The default Comparators are documented in the subclasses (for example, TableRowSorter).

If the underlying model structure changes (the modelStructureChanged method is invoked) the following are reset to their default values: Comparators by column, current sort order, and whether each column is sortable. To find the default Comparators, see the concrete implementation (for example, TableRowSorter). The default sort order is unsorted (the same as the model), and columns are sortable by default.

If the underlying model structure changes (the modelStructureChanged method is invoked) the following are reset to their default values: Comparators by column, current sort order and whether a column is sortable.

DefaultRowSorter is an abstract class. Concrete subclasses must provide access to the underlying data by invoking setModelWrapper. The setModelWrapper method must be invoked soon after the constructor is called, ideally from within the subclass's constructor. Undefined behavior will result if you use a DefaultRowSorter without specifying a ModelWrapper.

DefaultRowSorter has two formal type parameters. The first type parameter corresponds to the class of the model, for example DefaultTableModel. The second type parameter corresponds to the class of the identifier passed to the RowFilter. Refer to TableRowSorter and RowFilter for more details on the type parameters.

An implementation of RowSorter that provides sorting and
filtering around a grid-based data model.
Beyond creating and installing a RowSorter, you very rarely
need to interact with one directly.  Refer to
TableRowSorter for a concrete
implementation of RowSorter for JTable.

Sorting is done based on the current SortKeys, in order.
If two objects are equal (the Comparator for the
column returns 0) the next SortKey is used.  If no
SortKeys remain or the order is UNSORTED, then
the order of the rows in the model is used.

Sorting of each column is done by way of a Comparator
that you can specify using the setComparator method.
If a Comparator has not been specified, the
Comparator returned by
Collator.getInstance() is used on the results of
calling toString on the underlying objects.  The
Comparator is never passed null.  A
null value is treated as occurring before a
non-null value, and two null values are
considered equal.

If you specify a Comparator that casts its argument to
a type other than that provided by the model, a
ClassCastException will be thrown when the data is sorted.

In addition to sorting, DefaultRowSorter provides the
ability to filter rows.  Filtering is done by way of a
RowFilter that is specified using the
setRowFilter method.  If no filter has been specified all
rows are included.

By default, rows are in unsorted order (the same as the model) and
every column is sortable. The default Comparators are
documented in the subclasses (for example, TableRowSorter).

If the underlying model structure changes (the
modelStructureChanged method is invoked) the following
are reset to their default values: Comparators by
column, current sort order, and whether each column is sortable. To
find the default Comparators, see the concrete
implementation (for example, TableRowSorter).  The default
sort order is unsorted (the same as the model), and columns are
sortable by default.

If the underlying model structure changes (the
modelStructureChanged method is invoked) the following
are reset to their default values: Comparators by column,
current sort order and whether a column is sortable.

DefaultRowSorter is an abstract class.  Concrete
subclasses must provide access to the underlying data by invoking
setModelWrapper. The setModelWrapper method
must be invoked soon after the constructor is
called, ideally from within the subclass's constructor.
Undefined behavior will result if you use a DefaultRowSorter without specifying a ModelWrapper.

DefaultRowSorter has two formal type parameters.  The
first type parameter corresponds to the class of the model, for example
DefaultTableModel.  The second type parameter
corresponds to the class of the identifier passed to the
RowFilter.  Refer to TableRowSorter and
RowFilter for more details on the type parameters.
raw docstring

javax.swing.DefaultRowSorter$ModelWrapper

DefaultRowSorter.ModelWrapper is responsible for providing the data that gets sorted by DefaultRowSorter. You normally do not interact directly with ModelWrapper. Subclasses of DefaultRowSorter provide an implementation of ModelWrapper wrapping another model. For example, TableRowSorter provides a ModelWrapper that wraps a TableModel.

ModelWrapper makes a distinction between values as Objects and Strings. This allows implementations to provide a custom string converter to be used instead of invoking toString on the object.

DefaultRowSorter.ModelWrapper is responsible for providing
the data that gets sorted by DefaultRowSorter.  You
normally do not interact directly with ModelWrapper.
Subclasses of DefaultRowSorter provide an
implementation of ModelWrapper wrapping another model.
For example,
TableRowSorter provides a ModelWrapper that
wraps a TableModel.

ModelWrapper makes a distinction between values as
Objects and Strings.  This allows
implementations to provide a custom string
converter to be used instead of invoking toString on the
object.
raw docstring

javax.swing.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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.) This class provides a policy for the various JInternalFrame methods, it is not meant to be called directly rather the various JInternalFrame methods will call into the 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.)
This class provides a policy for the various JInternalFrame methods, it is not
meant to be called directly rather the various JInternalFrame methods will call
into the DesktopManager.
raw docstring

javax.swing.event.AncestorEvent

An event reported to a child component that originated from an ancestor in the component hierarchy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An event reported to a child component that originated from an
ancestor in the component hierarchy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.AncestorListener

AncestorListener

Interface to support notification when changes occur to a JComponent or one of its ancestors. These include movement and when the component becomes visible or invisible, either by the setVisible() method or by being added or removed from the component hierarchy.

AncestorListener

Interface to support notification when changes occur to a JComponent or one
of its ancestors.  These include movement and when the component becomes
visible or invisible, either by the setVisible() method or by being added
or removed from the component hierarchy.
raw docstring

javax.swing.event.CaretEvent

CaretEvent is used to notify interested parties that the text caret has changed in the event source.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

CaretEvent is used to notify interested parties that
the text caret has changed in the event source.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.CaretListener

Listener for changes in the caret position of a text component.

Listener for changes in the caret position of a text
component.
raw docstring

javax.swing.event.CellEditorListener

CellEditorListener defines the interface for an object that listens to changes in a CellEditor

CellEditorListener defines the interface for an object that listens
to changes in a CellEditor
raw docstring

javax.swing.event.ChangeEvent

ChangeEvent is used to notify interested parties that state has changed in the event source.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

ChangeEvent is used to notify interested parties that
state has changed in the event source.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.ChangeListener

Defines an object which listens for ChangeEvents.

Defines an object which listens for ChangeEvents.
raw docstring

javax.swing.event.core

No vars found in this namespace.

javax.swing.event.DocumentEvent

Interface for document change notifications. This provides detailed information to Document observers about how the Document changed. It provides high level information such as type of change and where it occurred, as well as the more detailed structural changes (What Elements were inserted and removed).

Interface for document change notifications.  This provides
detailed information to Document observers about how the
Document changed.  It provides high level information such
as type of change and where it occurred, as well as the more
detailed structural changes (What Elements were inserted and
removed).
raw docstring

javax.swing.event.DocumentEvent$ElementChange

Describes changes made to a specific element.

Describes changes made to a specific element.
raw docstring

javax.swing.event.DocumentEvent$EventType

Enumeration for document event types

Enumeration for document event types
raw docstring

javax.swing.event.DocumentListener

Interface for an observer to register to receive notifications of changes to a text document.

The default implementation of the Document interface (AbstractDocument) supports asynchronous mutations. If this feature is used (i.e. mutations are made from a thread other than the Swing event thread), the listeners will be notified via the mutating thread. This means that if asynchronous updates are made, the implementation of this interface must be threadsafe!

The DocumentEvent notification is based upon the JavaBeans event model. There is no guarantee about the order of delivery to listeners, and all listeners must be notified prior to making further mutations to the Document. This means implementations of the DocumentListener may not mutate the source of the event (i.e. the associated Document).

Interface for an observer to register to receive notifications
of changes to a text document.

The default implementation of
the Document interface (AbstractDocument) supports asynchronous
mutations.  If this feature is used (i.e. mutations are made
from a thread other than the Swing event thread), the listeners
will be notified via the mutating thread.  This means that
if asynchronous updates are made, the implementation of this
interface must be threadsafe!

The DocumentEvent notification is based upon the JavaBeans
event model.  There is no guarantee about the order of delivery
to listeners, and all listeners must be notified prior to making
further mutations to the Document.  This means implementations
of the DocumentListener may not mutate the source of the event
(i.e. the associated Document).
raw docstring

javax.swing.event.EventListenerList

A class that holds a list of EventListeners. A single instance can be used to hold all listeners (of all types) for the instance using the list. It is the responsiblity of the class using the EventListenerList to provide type-safe API (preferably conforming to the JavaBeans spec) and methods which dispatch event notification methods to appropriate Event Listeners on the list.

The main benefits that this class provides are that it is relatively cheap in the case of no listeners, and it provides serialization for event-listener lists in a single place, as well as a degree of MT safety (when used correctly).

Usage example: Say one is defining a class that sends out FooEvents, and one wants to allow users of the class to register FooListeners and receive notification when FooEvents occur. The following should be added to the class definition:

EventListenerList listenerList = new EventListenerList(); FooEvent fooEvent = null;

public void addFooListener(FooListener l) { listenerList.add(FooListener.class, l); }

public void removeFooListener(FooListener l) { listenerList.remove(FooListener.class, l); }

// Notify all listeners that have registered interest for // notification on this event type. The event instance // is lazily created using the parameters passed into // the fire method.

protected void fireFooXXX() { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==FooListener.class) { // Lazily create the event: if (fooEvent == null) fooEvent = new FooEvent(this); ((FooListener)listeners[i+1]).fooXXX(fooEvent); } } } foo should be changed to the appropriate name, and fireFooXxx to the appropriate method name. One fire method should exist for each notification method in the FooListener interface.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A class that holds a list of EventListeners.  A single instance
can be used to hold all listeners (of all types) for the instance
using the list.  It is the responsiblity of the class using the
EventListenerList to provide type-safe API (preferably conforming
to the JavaBeans spec) and methods which dispatch event notification
methods to appropriate Event Listeners on the list.

The main benefits that this class provides are that it is relatively
cheap in the case of no listeners, and it provides serialization for
event-listener lists in a single place, as well as a degree of MT safety
(when used correctly).

Usage example:
   Say one is defining a class that sends out FooEvents, and one wants
to allow users of the class to register FooListeners and receive
notification when FooEvents occur.  The following should be added
to the class definition:


EventListenerList listenerList = new EventListenerList();
FooEvent fooEvent = null;

public void addFooListener(FooListener l) {
    listenerList.add(FooListener.class, l);
}

public void removeFooListener(FooListener l) {
    listenerList.remove(FooListener.class, l);
}


// Notify all listeners that have registered interest for
// notification on this event type.  The event instance
// is lazily created using the parameters passed into
// the fire method.

protected void fireFooXXX() {
    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==FooListener.class) {
            // Lazily create the event:
            if (fooEvent == null)
                fooEvent = new FooEvent(this);
            ((FooListener)listeners[i+1]).fooXXX(fooEvent);
        }
    }
}
foo should be changed to the appropriate name, and fireFooXxx to the
appropriate method name.  One fire method should exist for each
notification method in the FooListener interface.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.HyperlinkEvent

HyperlinkEvent is used to notify interested parties that something has happened with respect to a hypertext link.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

HyperlinkEvent is used to notify interested parties that
something has happened with respect to a hypertext link.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.HyperlinkEvent$EventType

Defines the ENTERED, EXITED, and ACTIVATED event types, along with their string representations, returned by toString().

Defines the ENTERED, EXITED, and ACTIVATED event types, along
with their string representations, returned by toString().
raw docstring

javax.swing.event.InternalFrameAdapter

An abstract adapter class for receiving internal frame events. The methods in this class are empty. This class exists as convenience for creating listener objects, and is functionally equivalent to the WindowAdapter class in the AWT.

See How to Write an Internal Frame Listener in The Java Tutorial

An abstract adapter class for receiving internal frame events.
The methods in this class are empty. This class exists as
convenience for creating listener objects, and is functionally
equivalent to the WindowAdapter class in the AWT.

See How to Write an Internal Frame Listener
in The Java Tutorial
raw docstring

javax.swing.event.InternalFrameEvent

An AWTEvent that adds support for JInternalFrame objects as the event source. This class has the same event types as WindowEvent, although different IDs are used. Help on handling internal frame events is in How to Write an Internal Frame Listener, 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An AWTEvent that adds support for
JInternalFrame objects as the event source.  This class has the
same event types as WindowEvent,
although different IDs are used.
Help on handling internal frame events
is in
How to Write an Internal Frame Listener,
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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.InternalFrameListener

The listener interface for receiving internal frame events. This class is functionally equivalent to the WindowListener class in the AWT.

See How to Write an Internal Frame Listener in The Java Tutorial for further documentation.

The listener interface for receiving internal frame events.
This class is functionally equivalent to the WindowListener class
in the AWT.

See How to Write an Internal Frame Listener
in The Java Tutorial for further documentation.
raw docstring

javax.swing.event.ListDataEvent

Defines an event that encapsulates changes to a list.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Defines an event that encapsulates changes to a list.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.ListSelectionEvent

An event that characterizes a change in selection. The change is limited to a a single inclusive interval. The selection of at least one index within the range will have changed. A decent ListSelectionModel implementation will keep the range as small as possible. ListSelectionListeners will generally query the source of the event for the new selected status of each potentially changed row.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An event that characterizes a change in selection. The change is limited to a
a single inclusive interval. The selection of at least one index within the
range will have changed. A decent ListSelectionModel implementation
will keep the range as small as possible. ListSelectionListeners will
generally query the source of the event for the new selected status of each
potentially changed row.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.ListSelectionListener

The listener that's notified when a lists selection value changes.

The listener that's notified when a lists selection value
changes.
raw docstring

javax.swing.event.MenuDragMouseEvent

MenuDragMouseEvent is used to notify interested parties that the menu element has received a MouseEvent forwarded to it under drag conditions.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

MenuDragMouseEvent is used to notify interested parties that
the menu element has received a MouseEvent forwarded to it
under drag conditions.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.MenuEvent

MenuEvent is used to notify interested parties that the menu which is the event source has been posted, selected, or canceled.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

MenuEvent is used to notify interested parties that
the menu which is the event source has been posted,
selected, or canceled.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.MenuKeyEvent

MenuKeyEvent is used to notify interested parties that the menu element has received a KeyEvent forwarded to it in a menu tree.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

MenuKeyEvent is used to notify interested parties that
the menu element has received a KeyEvent forwarded to it
in a menu tree.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.MenuListener

Defines a listener for menu events.

Defines a listener for menu events.
raw docstring

javax.swing.event.MouseInputAdapter

An empty implementation of the MouseInputListener interface, provided as a convenience to simplify the task of creating listeners, by extending and implementing only the methods of interest. This class also provides an empty implementation of the MouseWheelListener interface, through its extension from AWT's MouseAdapter.

An empty implementation of the MouseInputListener interface, provided
as a convenience to simplify the task of creating listeners, by extending
and implementing only the methods of interest. This class also provides an
empty implementation of the MouseWheelListener interface, through
its extension from AWT's MouseAdapter.
raw docstring

javax.swing.event.MouseInputListener

A listener implementing all the methods in both the MouseListener and MouseMotionListener interfaces.

A listener implementing all the methods in both the MouseListener and
MouseMotionListener interfaces.
raw docstring

No vars found in this namespace.

javax.swing.event.PopupMenuEvent

PopupMenuEvent only contains the source of the event which is the JPoupMenu sending the event

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

PopupMenuEvent only contains the source of the event which is the JPoupMenu
sending the event

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.RowSorterEvent

RowSorterEvent provides notification of changes to a RowSorter. Two types of notification are possible:

Type.SORT_ORDER_CHANGED: indicates the sort order has changed. This is typically followed by a notification of: Type.SORTED: indicates the contents of the model have been transformed in some way. For example, the contents may have been sorted or filtered.

RowSorterEvent provides notification of changes to
a RowSorter.  Two types of notification are possible:

Type.SORT_ORDER_CHANGED: indicates the sort order has
    changed.  This is typically followed by a notification of:
Type.SORTED: indicates the contents of the model have
    been transformed in some way.  For example, the contents may have
    been sorted or filtered.
raw docstring

javax.swing.event.RowSorterListener

RowSorterListeners are notified of changes to a RowSorter.

RowSorterListeners are notified of changes to a
RowSorter.
raw docstring

javax.swing.event.SwingPropertyChangeSupport

This subclass of java.beans.PropertyChangeSupport is almost identical in functionality. The only difference is if constructed with SwingPropertyChangeSupport(sourceBean, true) it ensures listeners are only ever notified on the Event Dispatch Thread.

This subclass of java.beans.PropertyChangeSupport is almost
identical in functionality. The only difference is if constructed with
SwingPropertyChangeSupport(sourceBean, true) it ensures
listeners are only ever notified on the Event Dispatch Thread.
raw docstring

javax.swing.event.TableColumnModelEvent

TableColumnModelEvent is used to notify listeners that a table column model has changed, such as a column was added, removed, or moved.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

TableColumnModelEvent is used to notify listeners that a table
column model has changed, such as a column was added, removed, or
moved.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.TableColumnModelListener

TableColumnModelListener defines the interface for an object that listens to changes in a TableColumnModel.

TableColumnModelListener defines the interface for an object that listens
to changes in a TableColumnModel.
raw docstring

javax.swing.event.TableModelEvent

TableModelEvent is used to notify listeners that a table model has changed. The model event describes changes to a TableModel and all references to rows and columns are in the co-ordinate system of the model. Depending on the parameters used in the constructors, the TableModelevent can be used to specify the following types of changes:

TableModelEvent(source); // The data, ie. all rows changed TableModelEvent(source, HEADER_ROW); // Structure change, reallocate TableColumns TableModelEvent(source, 1); // Row 1 changed TableModelEvent(source, 3, 6); // Rows 3 to 6 inclusive changed TableModelEvent(source, 2, 2, 6); // Cell at (2, 6) changed TableModelEvent(source, 3, 6, ALL_COLUMNS, INSERT); // Rows (3, 6) were inserted TableModelEvent(source, 3, 6, ALL_COLUMNS, DELETE); // Rows (3, 6) were deleted

It is possible to use other combinations of the parameters, not all of them are meaningful. By subclassing, you can add other information, for example: whether the event WILL happen or DID happen. This makes the specification of rows in DELETE events more useful but has not been included in the swing package as the JTable only needs post-event notification.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

TableModelEvent is used to notify listeners that a table model
has changed. The model event describes changes to a TableModel
and all references to rows and columns are in the co-ordinate
system of the model.
Depending on the parameters used in the constructors, the TableModelevent
can be used to specify the following types of changes:



TableModelEvent(source);              //  The data, ie. all rows changed
TableModelEvent(source, HEADER_ROW);  //  Structure change, reallocate TableColumns
TableModelEvent(source, 1);           //  Row 1 changed
TableModelEvent(source, 3, 6);        //  Rows 3 to 6 inclusive changed
TableModelEvent(source, 2, 2, 6);     //  Cell at (2, 6) changed
TableModelEvent(source, 3, 6, ALL_COLUMNS, INSERT); // Rows (3, 6) were inserted
TableModelEvent(source, 3, 6, ALL_COLUMNS, DELETE); // Rows (3, 6) were deleted

It is possible to use other combinations of the parameters, not all of them
are meaningful. By subclassing, you can add other information, for example:
whether the event WILL happen or DID happen. This makes the specification
of rows in DELETE events more useful but has not been included in
the swing package as the JTable only needs post-event notification.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.TableModelListener

TableModelListener defines the interface for an object that listens to changes in a TableModel.

TableModelListener defines the interface for an object that listens
to changes in a TableModel.
raw docstring

javax.swing.event.TreeExpansionEvent

An event used to identify a single path in a tree. The source returned by getSource will be an instance of JTree.

For further documentation and examples see the following sections in The Java Tutorial: How to Write a Tree Expansion Listener and How to Write a Tree-Will-Expand Listener.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An event used to identify a single path in a tree.  The source
returned by getSource will be an instance of JTree.

For further documentation and examples see
the following sections in The Java Tutorial:
How to Write a Tree Expansion Listener and
How to Write a Tree-Will-Expand Listener.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.TreeExpansionListener

The listener that's notified when a tree expands or collapses a node. For further documentation and examples see How to Write a Tree Expansion Listener, a section in The Java Tutorial.

The listener that's notified when a tree expands or collapses
a node.
For further documentation and examples see
How to Write a Tree Expansion Listener,
a section in The Java Tutorial.
raw docstring

javax.swing.event.TreeModelEvent

Encapsulates information describing changes to a tree model, and used to notify tree model listeners of the change. For more information and examples see How to Write a Tree Model Listener, 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Encapsulates information describing changes to a tree model, and
used to notify tree model listeners of the change.
For more information and examples see
How to Write a Tree Model Listener,
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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.TreeModelListener

Defines the interface for an object that listens to changes in a TreeModel. For further information and examples see How to Write a Tree Model Listener, a section in The Java Tutorial.

Defines the interface for an object that listens
to changes in a TreeModel.
For further information and examples see
How to Write a Tree Model Listener,
a section in The Java Tutorial.
raw docstring

javax.swing.event.TreeSelectionEvent

An event that characterizes a change in the current selection. The change is based on any number of paths. TreeSelectionListeners will generally query the source of the event for the new selected status of each potentially changed row.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An event that characterizes a change in the current
selection.  The change is based on any number of paths.
TreeSelectionListeners will generally query the source of
the event for the new selected status of each potentially
changed row.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.TreeSelectionListener

The listener that's notified when the selection in a TreeSelectionModel changes. For more information and examples see How to Write a Tree Selection Listener, a section in The Java Tutorial.

The listener that's notified when the selection in a TreeSelectionModel
changes.
For more information and examples see
How to Write a Tree Selection Listener,
a section in The Java Tutorial.
raw docstring

javax.swing.event.TreeWillExpandListener

The listener that's notified when a tree expands or collapses a node. For further information and examples see How to Write a Tree-Will-Expand Listener, a section in The Java Tutorial.

The listener that's notified when a tree expands or collapses
a node.
For further information and examples see
How to Write a Tree-Will-Expand Listener,
a section in The Java Tutorial.
raw docstring

javax.swing.event.UndoableEditEvent

An event indicating that an operation which can be undone has occurred.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An event indicating that an operation which can be undone has occurred.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.event.UndoableEditListener

Interface implemented by a class interested in hearing about undoable operations.

Interface implemented by a class interested in hearing about
undoable operations.
raw docstring

javax.swing.filechooser.core

No vars found in this namespace.

javax.swing.filechooser.FileFilter

FileFilter is an abstract class used by JFileChooser for filtering the set of files shown to the user. See FileNameExtensionFilter for an implementation that filters using the file name extension.

A FileFilter can be set on a JFileChooser to keep unwanted files from appearing in the directory listing. For an example implementation of a simple file filter, see yourJDK/demo/jfc/FileChooserDemo/ExampleFileFilter.java. For more information and examples see How to Use File Choosers, a section in The Java Tutorial.

FileFilter is an abstract class used by JFileChooser
for filtering the set of files shown to the user. See
FileNameExtensionFilter for an implementation that filters using
the file name extension.

A FileFilter
can be set on a JFileChooser to
keep unwanted files from appearing in the directory listing.
For an example implementation of a simple file filter, see
yourJDK/demo/jfc/FileChooserDemo/ExampleFileFilter.java.
For more information and examples see
How to Use File Choosers,
a section in The Java Tutorial.
raw docstring

javax.swing.filechooser.FileNameExtensionFilter

An implementation of FileFilter that filters using a specified set of extensions. The extension for a file is the portion of the file name after the last ".". Files whose name does not contain a "." have no file name extension. File name extension comparisons are case insensitive.

The following example creates a FileNameExtensionFilter that will show jpg files:

FileFilter filter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg"); JFileChooser fileChooser = ...; fileChooser.addChoosableFileFilter(filter);

An implementation of FileFilter that filters using a
specified set of extensions. The extension for a file is the
portion of the file name after the last ".". Files whose name does
not contain a "." have no file name extension. File name extension
comparisons are case insensitive.

The following example creates a
FileNameExtensionFilter that will show jpg files:


FileFilter filter = new FileNameExtensionFilter("JPEG file", "jpg", "jpeg");
JFileChooser fileChooser = ...;
fileChooser.addChoosableFileFilter(filter);
raw docstring

javax.swing.filechooser.FileSystemView

FileSystemView is JFileChooser's gateway to the file system. Since the JDK1.1 File API doesn't allow access to such information as root partitions, file type information, or hidden file bits, this class is designed to intuit as much OS-specific file system information as possible.

Java Licensees may want to provide a different implementation of FileSystemView to better handle a given operating system.

FileSystemView is JFileChooser's gateway to the
file system. Since the JDK1.1 File API doesn't allow
access to such information as root partitions, file type
information, or hidden file bits, this class is designed
to intuit as much OS-specific file system information as
possible.



Java Licensees may want to provide a different implementation of
FileSystemView to better handle a given operating system.
raw docstring

javax.swing.filechooser.FileView

FileView defines an abstract class that can be implemented to provide the filechooser with UI information for a File. Each L&F JFileChooserUI object implements this class to pass back the correct icons and type descriptions specific to that L&F. For example, the Microsoft Windows L&F returns the generic Windows icons for directories and generic files. Additionally, you may want to provide your own FileView to JFileChooser to return different icons or additional information using JFileChooser.setFileView(javax.swing.filechooser.FileView).

JFileChooser first looks to see if there is a user defined FileView, if there is, it gets type information from there first. If FileView returns null for any method, JFileChooser then uses the L&F specific view to get the information. So, for example, if you provide a FileView class that returns an Icon for JPG files, and returns null icons for all other files, the UI's FileView will provide default icons for all other files.

For an example implementation of a simple file view, see yourJDK/demo/jfc/FileChooserDemo/ExampleFileView.java. For more information and examples see How to Use File Choosers, a section in The Java Tutorial.

FileView defines an abstract class that can be implemented
to provide the filechooser with UI information for a File.
Each L&F JFileChooserUI object implements this
class to pass back the correct icons and type descriptions specific to
that L&F. For example, the Microsoft Windows L&F returns the
generic Windows icons for directories and generic files.
Additionally, you may want to provide your own FileView to
JFileChooser to return different icons or additional
information using JFileChooser.setFileView(javax.swing.filechooser.FileView).



JFileChooser first looks to see if there is a user defined
FileView, if there is, it gets type information from
there first. If FileView returns null for
any method, JFileChooser then uses the L&F specific
view to get the information.
So, for example, if you provide a FileView class that
returns an Icon for JPG files, and returns null
icons for all other files, the UI's FileView will provide
default icons for all other files.



For an example implementation of a simple file view, see
yourJDK/demo/jfc/FileChooserDemo/ExampleFileView.java.
For more information and examples see
How to Use File Choosers,
a section in The Java Tutorial.
raw docstring

javax.swing.FocusManager

This 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

How to Use the Focus Subsystem, a section in The Java Tutorial, and the Focus Specification for more information.

This 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

How to Use the Focus Subsystem,
a section in The Java Tutorial, and the
Focus Specification
for more information.
raw docstring

javax.swing.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.

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.
raw docstring

javax.swing.GroupLayout

GroupLayout is a LayoutManager that hierarchically groups components in order to position them in a Container. GroupLayout is intended for use by builders, but may be hand-coded as well. Grouping is done by instances of the Group class. GroupLayout supports two types of groups. A sequential group positions its child elements sequentially, one after another. A parallel group aligns its child elements in one of four ways.

Each group may contain any number of elements, where an element is a Group, Component, or gap. A gap can be thought of as an invisible component with a minimum, preferred and maximum size. In addition GroupLayout supports a preferred gap, whose value comes from LayoutStyle.

Elements are similar to a spring. Each element has a range as specified by a minimum, preferred and maximum. Gaps have either a developer-specified range, or a range determined by LayoutStyle. The range for Components is determined from the Component's getMinimumSize, getPreferredSize and getMaximumSize methods. In addition, when adding Components you may specify a particular range to use instead of that from the component. The range for a Group is determined by the type of group. A ParallelGroup's range is the maximum of the ranges of its elements. A SequentialGroup's range is the sum of the ranges of its elements.

GroupLayout treats each axis independently. That is, there is a group representing the horizontal axis, and a group representing the vertical axis. The horizontal group is responsible for determining the minimum, preferred and maximum size along the horizontal axis as well as setting the x and width of the components contained in it. The vertical group is responsible for determining the minimum, preferred and maximum size along the vertical axis as well as setting the y and height of the components contained in it. Each Component must exist in both a horizontal and vertical group, otherwise an IllegalStateException is thrown during layout, or when the minimum, preferred or maximum size is requested.

The following diagram shows a sequential group along the horizontal axis. The sequential group contains three components. A parallel group was used along the vertical axis.

To reinforce that each axis is treated independently the diagram shows the range of each group and element along each axis. The range of each component has been projected onto the axes, and the groups are rendered in blue (horizontal) and red (vertical). For readability there is a gap between each of the elements in the sequential group.

The sequential group along the horizontal axis is rendered as a solid blue line. Notice the sequential group is the sum of the children elements it contains.

Along the vertical axis the parallel group is the maximum of the height of each of the components. As all three components have the same height, the parallel group has the same height.

The following diagram shows the same three components, but with the parallel group along the horizontal axis and the sequential group along the vertical axis.

As c1 is the largest of the three components, the parallel group is sized to c1. As c2 and c3 are smaller than c1 they are aligned based on the alignment specified for the component (if specified) or the default alignment of the parallel group. In the diagram c2 and c3 were created with an alignment of LEADING. If the component orientation were right-to-left then c2 and c3 would be positioned on the opposite side.

The following diagram shows a sequential group along both the horizontal and vertical axis.

GroupLayout provides the ability to insert gaps between Components. The size of the gap is determined by an instance of LayoutStyle. This may be turned on using the setAutoCreateGaps method. Similarly, you may use the setAutoCreateContainerGaps method to insert gaps between components that touch the edge of the parent container and the container.

The following builds a panel consisting of two labels in one column, followed by two textfields in the next column:

JComponent panel = ...; GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout);

// Turn on automatically adding gaps between components layout.setAutoCreateGaps(true);

// Turn on automatically creating gaps between components that touch // the edge of the container and the container. layout.setAutoCreateContainerGaps(true);

// Create a sequential group for the horizontal axis.

GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();

// The sequential group in turn contains two parallel groups. // One parallel group contains the labels, the other the text fields. // Putting the labels in a parallel group along the horizontal axis // positions them at the same x location. // // Variable indentation is used to reinforce the level of grouping. hGroup.addGroup(layout.createParallelGroup(). addComponent(label1).addComponent(label2)); hGroup.addGroup(layout.createParallelGroup(). addComponent(tf1).addComponent(tf2)); layout.setHorizontalGroup(hGroup);

// Create a sequential group for the vertical axis. GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup();

// The sequential group contains two parallel groups that align // the contents along the baseline. The first parallel group contains // the first label and text field, and the second parallel group contains // the second label and text field. By using a sequential group // the labels and text fields are positioned vertically after one another. vGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE). addComponent(label1).addComponent(tf1)); vGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE). addComponent(label2).addComponent(tf2)); layout.setVerticalGroup(vGroup);

When run the following is produced.

This layout consists of the following. The horizontal axis consists of a sequential group containing two parallel groups. The first parallel group contains the labels, and the second parallel group contains the text fields. The vertical axis consists of a sequential group containing two parallel groups. The parallel groups are configured to align their components along the baseline. The first parallel group contains the first label and first text field, and the second group consists of the second label and second text field.

There are a couple of things to notice in this code:

You need not explicitly add the components to the container; this is indirectly done by using one of the add methods of Group. The various add methods return the caller. This allows for easy chaining of invocations. For example, group.addComponent(label1).addComponent(label2); is equivalent to group.addComponent(label1); group.addComponent(label2);. There are no public constructors for Groups; instead use the create methods of GroupLayout.

GroupLayout is a LayoutManager that hierarchically
groups components in order to position them in a Container.
GroupLayout is intended for use by builders, but may be
hand-coded as well.
Grouping is done by instances of the Group class. GroupLayout supports two types of groups. A sequential group
positions its child elements sequentially, one after another. A
parallel group aligns its child elements in one of four ways.

Each group may contain any number of elements, where an element is
a Group, Component, or gap. A gap can be thought
of as an invisible component with a minimum, preferred and maximum
size. In addition GroupLayout supports a preferred gap,
whose value comes from LayoutStyle.

Elements are similar to a spring. Each element has a range as
specified by a minimum, preferred and maximum.  Gaps have either a
developer-specified range, or a range determined by LayoutStyle. The range for Components is determined from
the Component's getMinimumSize, getPreferredSize and getMaximumSize methods. In addition,
when adding Components you may specify a particular range
to use instead of that from the component. The range for a Group is determined by the type of group. A ParallelGroup's
range is the maximum of the ranges of its elements. A SequentialGroup's range is the sum of the ranges of its elements.

GroupLayout treats each axis independently.  That is, there
is a group representing the horizontal axis, and a group
representing the vertical axis.  The horizontal group is
responsible for determining the minimum, preferred and maximum size
along the horizontal axis as well as setting the x and width of the
components contained in it. The vertical group is responsible for
determining the minimum, preferred and maximum size along the
vertical axis as well as setting the y and height of the
components contained in it. Each Component must exist in both
a horizontal and vertical group, otherwise an IllegalStateException
is thrown during layout, or when the minimum, preferred or
maximum size is requested.

The following diagram shows a sequential group along the horizontal
axis. The sequential group contains three components. A parallel group
was used along the vertical axis.



To reinforce that each axis is treated independently the diagram shows
the range of each group and element along each axis. The
range of each component has been projected onto the axes,
and the groups are rendered in blue (horizontal) and red (vertical).
For readability there is a gap between each of the elements in the
sequential group.

The sequential group along the horizontal axis is rendered as a solid
blue line. Notice the sequential group is the sum of the children elements
it contains.

Along the vertical axis the parallel group is the maximum of the height
of each of the components. As all three components have the same height,
the parallel group has the same height.

The following diagram shows the same three components, but with the
parallel group along the horizontal axis and the sequential group along
the vertical axis.




As c1 is the largest of the three components, the parallel
group is sized to c1. As c2 and c3 are smaller
than c1 they are aligned based on the alignment specified
for the component (if specified) or the default alignment of the
parallel group. In the diagram c2 and c3 were created
with an alignment of LEADING. If the component orientation were
right-to-left then c2 and c3 would be positioned on
the opposite side.

The following diagram shows a sequential group along both the horizontal
and vertical axis.



GroupLayout provides the ability to insert gaps between
Components. The size of the gap is determined by an
instance of LayoutStyle. This may be turned on using the
setAutoCreateGaps method.  Similarly, you may use
the setAutoCreateContainerGaps method to insert gaps
between components that touch the edge of the parent container and the
container.

The following builds a panel consisting of two labels in
one column, followed by two textfields in the next column:


  JComponent panel = ...;
  GroupLayout layout = new GroupLayout(panel);
  panel.setLayout(layout);

  // Turn on automatically adding gaps between components
  layout.setAutoCreateGaps(true);

  // Turn on automatically creating gaps between components that touch
  // the edge of the container and the container.
  layout.setAutoCreateContainerGaps(true);

  // Create a sequential group for the horizontal axis.

  GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup();

  // The sequential group in turn contains two parallel groups.
  // One parallel group contains the labels, the other the text fields.
  // Putting the labels in a parallel group along the horizontal axis
  // positions them at the same x location.
  //
  // Variable indentation is used to reinforce the level of grouping.
  hGroup.addGroup(layout.createParallelGroup().
           addComponent(label1).addComponent(label2));
  hGroup.addGroup(layout.createParallelGroup().
           addComponent(tf1).addComponent(tf2));
  layout.setHorizontalGroup(hGroup);

  // Create a sequential group for the vertical axis.
  GroupLayout.SequentialGroup vGroup = layout.createSequentialGroup();

  // The sequential group contains two parallel groups that align
  // the contents along the baseline. The first parallel group contains
  // the first label and text field, and the second parallel group contains
  // the second label and text field. By using a sequential group
  // the labels and text fields are positioned vertically after one another.
  vGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE).
           addComponent(label1).addComponent(tf1));
  vGroup.addGroup(layout.createParallelGroup(Alignment.BASELINE).
           addComponent(label2).addComponent(tf2));
  layout.setVerticalGroup(vGroup);

When run the following is produced.



This layout consists of the following.
The horizontal axis consists of a sequential group containing two
        parallel groups.  The first parallel group contains the labels,
        and the second parallel group contains the text fields.
    The vertical axis consists of a sequential group
        containing two parallel groups.  The parallel groups are configured
        to align their components along the baseline. The first parallel
        group contains the first label and first text field, and
        the second group consists of the second label and second
        text field.

There are a couple of things to notice in this code:

  You need not explicitly add the components to the container; this
      is indirectly done by using one of the add methods of
      Group.
  The various add methods return
      the caller.  This allows for easy chaining of invocations.  For
      example, group.addComponent(label1).addComponent(label2); is
      equivalent to
      group.addComponent(label1); group.addComponent(label2);.
  There are no public constructors for Groups; instead
      use the create methods of GroupLayout.
raw docstring

javax.swing.Icon

A small fixed size picture, typically used to decorate components.

A small fixed size picture, typically used to decorate components.
raw docstring

javax.swing.ImageIcon

An implementation of the Icon interface that paints Icons from Images. Images that are created from a URL, filename or byte array 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An implementation of the Icon interface that paints Icons
from Images. Images that are created from a URL, filename or byte array
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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

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.
raw docstring

javax.swing.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 tf1 = new JTextField ("Type "pass" here"); getContentPane().add (tf1, BorderLayout.NORTH); tf1.setInputVerifier(new PassVerifier());

    JTextField tf2 = new JTextField ("TextField2");
    getContentPane().add (tf2, BorderLayout.SOUTH);

    WindowListener l = new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    addWindowListener(l);
}

class PassVerifier extends InputVerifier {
    public boolean verify(JComponent input) {
        JTextField tf = (JTextField) input;
        return "pass".equals(tf.getText());
    }
}

public static void main(String[] args) {
    Frame f = new VerifierTest();
    f.pack();
    f.setVisible(true);
}

}

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 tf1 = new JTextField ("Type \"pass\" here");
        getContentPane().add (tf1, BorderLayout.NORTH);
        tf1.setInputVerifier(new PassVerifier());

        JTextField tf2 = new JTextField ("TextField2");
        getContentPane().add (tf2, BorderLayout.SOUTH);

        WindowListener l = new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        };
        addWindowListener(l);
    }

    class PassVerifier extends InputVerifier {
        public boolean verify(JComponent input) {
            JTextField tf = (JTextField) input;
            return "pass".equals(tf.getText());
        }
    }

    public static void main(String[] args) {
        Frame f = new VerifierTest();
        f.pack();
        f.setVisible(true);
    }
}
raw docstring

javax.swing.InternalFrameFocusTraversalPolicy

A FocusTraversalPolicy which can optionally provide an algorithm for determining a JInternalFrame's initial Component. The initial Component is the first to receive focus when the JInternalFrame is first selected. By default, this is the same as the JInternalFrame's default Component to focus.

A FocusTraversalPolicy which can optionally provide an algorithm for
determining a JInternalFrame's initial Component. The initial Component is
the first to receive focus when the JInternalFrame is first selected. By
default, this is the same as the JInternalFrame's default Component to
focus.
raw docstring

javax.swing.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 its only child. The contentPane should be the parent of any children of the JApplet. As a convenience, the add, remove, and setLayout methods of this class are overridden, so that they delegate calls to the corresponding methods of the ContentPane. For example, you can add a child component to an applet as follows:

  applet.add(child);

And the child will be added to the contentPane. 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. Refer to RootPaneContainer for details on adding, removing and setting the LayoutManager of a JApplet.

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

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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 its only child.  The contentPane
should be the parent of any children of the JApplet.
As a convenience, the add, remove, and setLayout
methods of this class are overridden, so that they delegate calls
to the corresponding methods of the ContentPane.
For example, you can add a child component to an applet as follows:


      applet.add(child);

And the child will be added to the contentPane.
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.
Refer to RootPaneContainer
for details on adding, removing and setting the LayoutManager
of a JApplet.

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

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JButton

An implementation of a "push" button.

Buttons can be configured, and to some degree controlled, by Actions. Using an Action with a button has many benefits beyond directly configuring a button. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

See How to Use Buttons, Check Boxes, and Radio Buttons in The Java Tutorial for information and examples of using buttons.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An implementation of a "push" button.

Buttons can be configured, and to some degree controlled, by
Actions.  Using an
Action with a button has many benefits beyond directly
configuring a button.  Refer to
Swing Components Supporting Action for more
details, and you can find more information in How
to Use Actions, a section in The Java Tutorial.

See How to Use Buttons, Check Boxes, and Radio Buttons
in The Java Tutorial
for information and examples of using buttons.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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 Buttons, Check Boxes, and Radio Buttons in The Java Tutorial for examples and information on using check boxes.

Buttons can be configured, and to some degree controlled, by Actions. Using an Action with a button has many benefits beyond directly configuring a button. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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 Buttons, Check Boxes, and Radio Buttons
in The Java Tutorial
for examples and information on using check boxes.

Buttons can be configured, and to some degree controlled, by
Actions.  Using an
Action with a button has many benefits beyond directly
configuring a button.  Refer to
Swing Components Supporting Action for more
details, and you can find more information in How
to Use Actions, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

Menu items can be configured, and to some degree controlled, by Actions. Using an Action with a menu item has many benefits beyond directly configuring a menu item. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

For further information and examples of using check box menu items, see How to Use Menus, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.

Menu items can be configured, and to some degree controlled, by
Actions.  Using an
Action with a menu item has many benefits beyond directly
configuring a menu item.  Refer to
Swing Components Supporting Action for more
details, and you can find more information in How
to Use Actions, a section in The Java Tutorial.

For further information and examples of using check box menu items,
see How to Use Menus,
a section in The Java Tutorial.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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:

A static convenience method which shows a modal color-chooser dialog and returns the color selected by the user. 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. 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: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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:

A static convenience method which shows a modal color-chooser
dialog and returns the color selected by the user.
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.
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: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JComboBox

A component that combines a button or editable 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 an editable field into which the user can type a value.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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

A component that combines a button or editable 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 an editable field into which the user can type a value.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.


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

javax.swing.JComboBox$KeySelectionManager

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

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

javax.swing.JComponent

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

The JComponent class provides:

The base class for both standard and custom components that use the Swing architecture. A "pluggable look and feel" (L&F) that can be specified by the programmer or (optionally) selected by the user at runtime. The look and feel for each component is provided by a UI delegate -- an object that descends from ComponentUI. See How to Set the Look and Feel in The Java Tutorial for more information. Comprehensive keystroke handling. See the document How to Use Key Bindings, an article in The Java Tutorial, for more information. Support for tool tips -- short descriptions that pop up when the cursor lingers over a component. See How to Use Tool Tips in The Java Tutorial for more information. Support for accessibility. JComponent contains all of the methods in the Accessible interface, but it doesn't actually implement the interface. That is the responsibility of the individual classes that extend JComponent. Support for component-specific properties. With the putClientProperty(java.lang.Object, java.lang.Object) and getClientProperty(java.lang.Object) methods, you can associate name-object pairs with any object that descends from JComponent. An infrastructure for painting that includes double buffering and support for borders. For more information see Painting and How to Use Borders, both of which are sections in The Java Tutorial.

For more information on these subjects, see the Swing package description and The Java Tutorial section The JComponent Class.

JComponent and its subclasses document default values for certain properties. For example, JTable documents the default row height as 16. Each JComponent subclass that has a ComponentUI will create the ComponentUI as part of its constructor. In order to provide a particular look and feel each ComponentUI may set properties back on the JComponent that created it. For example, a custom look and feel may require JTables to have a row height of 24. The documented defaults are the value of a property BEFORE the ComponentUI has been installed. If you need a specific value for a particular property you should explicitly set it.

In release 1.4, the focus subsystem was rearchitected. For more information, see

How to Use the Focus Subsystem, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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


The JComponent class provides:

The base class for both standard and custom components
    that use the Swing architecture.
A "pluggable look and feel" (L&F) that can be specified by the
    programmer or (optionally) selected by the user at runtime.
    The look and feel for each component is provided by a
    UI delegate -- an object that descends from
    ComponentUI.
    See How
    to Set the Look and Feel
    in The Java Tutorial
    for more information.
Comprehensive keystroke handling.
    See the document How to Use Key Bindings,
    an article in The Java Tutorial,
    for more information.
Support for tool tips --
    short descriptions that pop up when the cursor lingers
    over a component.
    See How
    to Use Tool Tips
    in The Java Tutorial
    for more information.
Support for accessibility.
    JComponent contains all of the methods in the
    Accessible interface,
    but it doesn't actually implement the interface.  That is the
    responsibility of the individual classes
    that extend JComponent.
Support for component-specific properties.
    With the putClientProperty(java.lang.Object, java.lang.Object)
    and getClientProperty(java.lang.Object) methods,
    you can associate name-object pairs
    with any object that descends from JComponent.
An infrastructure for painting
    that includes double buffering and support for borders.
    For more information see Painting and
How
    to Use Borders,
    both of which are sections in The Java Tutorial.

For more information on these subjects, see the
Swing package description
and The Java Tutorial section
The JComponent Class.

JComponent and its subclasses document default values
for certain properties.  For example, JTable documents the
default row height as 16.  Each JComponent subclass
that has a ComponentUI will create the
ComponentUI as part of its constructor.  In order
to provide a particular look and feel each
ComponentUI may set properties back on the
JComponent that created it.  For example, a custom
look and feel may require JTables to have a row
height of 24. The documented defaults are the value of a property
BEFORE the ComponentUI has been installed.  If you
need a specific value for a particular property you should
explicitly set it.

In release 1.4, the focus subsystem was rearchitected.
For more information, see

How to Use the Focus Subsystem,
a section in The Java Tutorial.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JDesktopPane

A container used to create a multiple-document interface or a virtual desktop. You create JInternalFrame objects and add them to the JDesktopPane. JDesktopPane extends JLayeredPane to manage the potentially overlapping internal frames. It also maintains a reference to an instance of DesktopManager that is set by the UI class for the current look and feel (L&F). 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 further documentation and examples see How to Use Internal Frames, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A container used to create a multiple-document interface or a virtual desktop.
You create JInternalFrame objects and add them to the
JDesktopPane. JDesktopPane extends
JLayeredPane to manage the potentially overlapping internal
frames. It also maintains a reference to an instance of
DesktopManager that is set by the UI
class for the current look and feel (L&F).  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 further documentation and examples see
How to Use Internal Frames,
a section in The Java Tutorial.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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. As a convenience, the add, remove, and setLayout methods of this class are overridden, so that they delegate calls to the corresponding methods of the ContentPane. For example, you can add a child component to a dialog as follows:

  dialog.add(child);

And the child will be added to the contentPane. 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. Refer to RootPaneContainer for details on adding, removing and setting the LayoutManager of a JDialog.

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 Frame for more information.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.
As a convenience, the add, remove, and setLayout
methods of this class are overridden, so that they delegate calls
to the corresponding methods of the ContentPane.
For example, you can add a child component to a dialog as follows:


      dialog.add(child);
And the child will be added to the contentPane.
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.
Refer to RootPaneContainer
for details on adding, removing and setting the LayoutManager
of a JDialog.

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 Frame for
more information.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

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.

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.

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.

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();
                }
            }
        }
    }
}

For information on customizing how text/html is rendered please see W3C_LENGTH_UNITS and HONOR_DISPLAY_PROPERTIES

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.

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.

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: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.


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.

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.

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.


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();
                    }
                }
            }
        }
    }

For information on customizing how text/html is rendered please see
W3C_LENGTH_UNITS and HONOR_DISPLAY_PROPERTIES

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.


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.

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: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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(); FileNameExtensionFilter filter = new FileNameExtensionFilter( "JPG & GIF Images", "jpg", "gif"); 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()); }

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

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();
   FileNameExtensionFilter filter = new FileNameExtensionFilter(
       "JPG & GIF Images", "jpg", "gif");
   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());
   }

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.
raw docstring

javax.swing.JFormattedTextField

JFormattedTextField extends JTextField adding support for formatting arbitrary values, as well as retrieving a particular object once the user has edited the text. The following illustrates configuring a JFormattedTextField to edit dates:

JFormattedTextField ftf = new JFormattedTextField(); ftf.setValue(new Date());

Once a JFormattedTextField has been created, you can listen for editing changes by way of adding a PropertyChangeListener and listening for PropertyChangeEvents with the property name value.

JFormattedTextField allows configuring what action should be taken when focus is lost. The possible configurations are:

ValueDescription JFormattedTextField.REVERT Revert the display to match that of getValue, possibly losing the current edit. JFormattedTextField.COMMIT Commits the current value. If the value being edited isn't considered a legal value by the AbstractFormatter that is, a ParseException is thrown, then the value will not change, and then edited value will persist. JFormattedTextField.COMMIT_OR_REVERT Similar to COMMIT, but if the value isn't legal, behave like REVERT. JFormattedTextField.PERSIST Do nothing, don't obtain a new AbstractFormatter, and don't update the value.

The default is JFormattedTextField.COMMIT_OR_REVERT, refer to setFocusLostBehavior(int) for more information on this.

JFormattedTextField allows the focus to leave, even if the currently edited value is invalid. To lock the focus down while the JFormattedTextField is an invalid edit state you can attach an InputVerifier. The following code snippet shows a potential implementation of such an InputVerifier:

public class FormattedTextFieldVerifier extends InputVerifier { public boolean verify(JComponent input) { if (input instanceof JFormattedTextField) { JFormattedTextField ftf = (JFormattedTextField)input; AbstractFormatter formatter = ftf.getFormatter(); if (formatter != null) { String text = ftf.getText(); try { formatter.stringToValue(text); return true; } catch (ParseException pe) { return false; } } } return true; } public boolean shouldYieldFocus(JComponent input) { return verify(input); } }

Alternatively, you could invoke commitEdit, which would also commit the value.

JFormattedTextField does not do the formatting it self, rather formatting is done through an instance of JFormattedTextField.AbstractFormatter which is obtained from an instance of JFormattedTextField.AbstractFormatterFactory. Instances of JFormattedTextField.AbstractFormatter are notified when they become active by way of the install method, at which point the JFormattedTextField.AbstractFormatter can install whatever it needs to, typically a DocumentFilter. Similarly when JFormattedTextField no longer needs the AbstractFormatter, it will invoke uninstall.

JFormattedTextField typically queries the AbstractFormatterFactory for an AbstractFormat when it gains or loses focus. Although this can change based on the focus lost policy. If the focus lost policy is JFormattedTextField.PERSIST and the JFormattedTextField has been edited, the AbstractFormatterFactory will not be queried until the value has been committed. Similarly if the focus lost policy is JFormattedTextField.COMMIT and an exception is thrown from stringToValue, the AbstractFormatterFactory will not be queried when focus is lost or gained.

JFormattedTextField.AbstractFormatter is also responsible for determining when values are committed to the JFormattedTextField. Some JFormattedTextField.AbstractFormatters will make new values available on every edit, and others will never commit the value. You can force the current value to be obtained from the current JFormattedTextField.AbstractFormatter by way of invoking commitEdit. commitEdit will be invoked whenever return is pressed in the JFormattedTextField.

If an AbstractFormatterFactory has not been explicitly set, one will be set based on the Class of the value type after setValue has been invoked (assuming value is non-null). For example, in the following code an appropriate AbstractFormatterFactory and AbstractFormatter will be created to handle formatting of numbers:

JFormattedTextField tf = new JFormattedTextField(); tf.setValue(100);

Warning: As the AbstractFormatter will typically install a DocumentFilter on the Document, and a NavigationFilter on the JFormattedTextField you should not install your own. If you do, you are likely to see odd behavior in that the editing policy of the AbstractFormatter will not be enforced.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

JFormattedTextField extends JTextField adding
support for formatting arbitrary values, as well as retrieving a particular
object once the user has edited the text. The following illustrates
configuring a JFormattedTextField to edit dates:


  JFormattedTextField ftf = new JFormattedTextField();
  ftf.setValue(new Date());

Once a JFormattedTextField has been created, you can
listen for editing changes by way of adding
a PropertyChangeListener and listening for
PropertyChangeEvents with the property name value.

JFormattedTextField allows
configuring what action should be taken when focus is lost. The possible
configurations are:

ValueDescription
JFormattedTextField.REVERT
           Revert the display to match that of getValue,
               possibly losing the current edit.
       JFormattedTextField.COMMIT
           Commits the current value. If the value being edited
               isn't considered a legal value by the
               AbstractFormatter that is, a
               ParseException is thrown, then the value
               will not change, and then edited value will persist.
       JFormattedTextField.COMMIT_OR_REVERT
           Similar to COMMIT, but if the value isn't
               legal, behave like REVERT.
       JFormattedTextField.PERSIST
           Do nothing, don't obtain a new
               AbstractFormatter, and don't update the value.

The default is JFormattedTextField.COMMIT_OR_REVERT,
refer to setFocusLostBehavior(int) for more information on this.

JFormattedTextField allows the focus to leave, even if
the currently edited value is invalid. To lock the focus down while the
JFormattedTextField is an invalid edit state
you can attach an InputVerifier. The following code snippet
shows a potential implementation of such an InputVerifier:


public class FormattedTextFieldVerifier extends InputVerifier {
    public boolean verify(JComponent input) {
        if (input instanceof JFormattedTextField) {
            JFormattedTextField ftf = (JFormattedTextField)input;
            AbstractFormatter formatter = ftf.getFormatter();
            if (formatter != null) {
                String text = ftf.getText();
                try {
                     formatter.stringToValue(text);
                     return true;
                 } catch (ParseException pe) {
                     return false;
                 }
             }
         }
         return true;
     }
     public boolean shouldYieldFocus(JComponent input) {
         return verify(input);
     }
 }

Alternatively, you could invoke commitEdit, which would also
commit the value.

JFormattedTextField does not do the formatting it self,
rather formatting is done through an instance of
JFormattedTextField.AbstractFormatter which is obtained from
an instance of JFormattedTextField.AbstractFormatterFactory.
Instances of JFormattedTextField.AbstractFormatter are
notified when they become active by way of the
install method, at which point the
JFormattedTextField.AbstractFormatter can install whatever
it needs to, typically a DocumentFilter. Similarly when
JFormattedTextField no longer
needs the AbstractFormatter, it will invoke
uninstall.

JFormattedTextField typically
queries the AbstractFormatterFactory for an
AbstractFormat when it gains or loses focus. Although this
can change based on the focus lost policy. If the focus lost
policy is JFormattedTextField.PERSIST
and the JFormattedTextField has been edited, the
AbstractFormatterFactory will not be queried until the
value has been committed. Similarly if the focus lost policy is
JFormattedTextField.COMMIT and an exception
is thrown from stringToValue, the
AbstractFormatterFactory will not be queried when focus is
lost or gained.

JFormattedTextField.AbstractFormatter
is also responsible for determining when values are committed to
the JFormattedTextField. Some
JFormattedTextField.AbstractFormatters will make new values
available on every edit, and others will never commit the value. You can
force the current value to be obtained
from the current JFormattedTextField.AbstractFormatter
by way of invoking commitEdit. commitEdit will
be invoked whenever return is pressed in the
JFormattedTextField.

If an AbstractFormatterFactory has not been explicitly
set, one will be set based on the Class of the value type after
setValue has been invoked (assuming value is non-null).
For example, in the following code an appropriate
AbstractFormatterFactory and AbstractFormatter
will be created to handle formatting of numbers:


  JFormattedTextField tf = new JFormattedTextField();
  tf.setValue(100);

Warning: As the AbstractFormatter will
typically install a DocumentFilter on the
Document, and a NavigationFilter on the
JFormattedTextField you should not install your own. If you do,
you are likely to see odd behavior in that the editing policy of the
AbstractFormatter will not be enforced.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JFormattedTextField$AbstractFormatter

Instances of AbstractFormatter are used by JFormattedTextField to handle the conversion both from an Object to a String, and back from a String to an Object. AbstractFormatters can also enforce editing policies, or navigation policies, or manipulate the JFormattedTextField in any way it sees fit to enforce the desired policy.

An AbstractFormatter can only be active in one JFormattedTextField at a time. JFormattedTextField invokes install when it is ready to use it followed by uninstall when done. Subclasses that wish to install additional state should override install and message super appropriately.

Subclasses must override the conversion methods stringToValue and valueToString. Optionally they can override getActions, getNavigationFilter and getDocumentFilter to restrict the JFormattedTextField in a particular way.

Subclasses that allow the JFormattedTextField to be in a temporarily invalid state should invoke setEditValid at the appropriate times.

Instances of AbstractFormatter are used by
JFormattedTextField to handle the conversion both
from an Object to a String, and back from a String to an Object.
AbstractFormatters can also enforce editing policies,
or navigation policies, or manipulate the
JFormattedTextField in any way it sees fit to
enforce the desired policy.

An AbstractFormatter can only be active in
one JFormattedTextField at a time.
JFormattedTextField invokes
install when it is ready to use it followed
by uninstall when done. Subclasses
that wish to install additional state should override
install and message super appropriately.

Subclasses must override the conversion methods
stringToValue and valueToString. Optionally
they can override getActions,
getNavigationFilter and getDocumentFilter
to restrict the JFormattedTextField in a particular
way.

Subclasses that allow the JFormattedTextField to be in
a temporarily invalid state should invoke setEditValid
at the appropriate times.
raw docstring

javax.swing.JFormattedTextField$AbstractFormatterFactory

Instances of AbstractFormatterFactory are used by JFormattedTextField to obtain instances of AbstractFormatter which in turn are used to format values. AbstractFormatterFactory can return different AbstractFormatters based on the state of the JFormattedTextField, perhaps returning different AbstractFormatters when the JFormattedTextField has focus vs when it doesn't have focus.

Instances of AbstractFormatterFactory are used by
JFormattedTextField to obtain instances of
AbstractFormatter which in turn are used to format values.
AbstractFormatterFactory can return different
AbstractFormatters based on the state of the
JFormattedTextField, perhaps returning different
AbstractFormatters when the
JFormattedTextField has focus vs when it
doesn't have focus.
raw docstring

javax.swing.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. As a convenience, the add, remove, and setLayout methods of this class are overridden, so that they delegate calls to the corresponding methods of the ContentPane. For example, you can add a child component to a frame as follows:

  frame.add(child);

And the child will be added to the contentPane. 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. Refer to RootPaneContainer for details on adding, removing and setting the LayoutManager of a JFrame.

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(int). 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 Frame for more information.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.
As a convenience, the add, remove, and setLayout
methods of this class are overridden, so that they delegate calls
to the corresponding methods of the ContentPane.
For example, you can add a child component to a frame as follows:


      frame.add(child);
And the child will be added to the contentPane.
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.
Refer to RootPaneContainer
for details on adding, removing and setting the LayoutManager
of a JFrame.

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(int).
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 Frame for more
information.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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 content pane is where you add child components. As a convenience, the add, remove, and setLayout methods of this class are overridden, so that they delegate calls to the corresponding methods of the ContentPane. For example, you can add a child component to an internal frame as follows:

  internalFrame.add(child);

And the child will be added to the contentPane. The content pane is actually managed by an instance of JRootPane, which also manages a layout pane, glass pane, and optional menu bar for the internal frame. Please see the JRootPane documentation for a complete description of these components. Refer to RootPaneContainer for details on adding, removing and setting the LayoutManager of a JInternalFrame.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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 content pane
is where you add child components.
As a convenience, the add, remove, and setLayout
methods of this class are overridden, so that they delegate calls
to the corresponding methods of the ContentPane.
For example, you can add a child component to an internal frame as follows:


      internalFrame.add(child);
And the child will be added to the contentPane.
The content pane is actually managed by an instance of
JRootPane,
which also manages a layout pane, glass pane, and
optional menu bar for the internal frame. Please see the
JRootPane
documentation for a complete description of these components.
Refer to RootPaneContainer
for details on adding, removing and setting the LayoutManager
of a JInternalFrame.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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 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: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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
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: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JLayer

JLayer is a universal decorator for Swing components which enables you to implement various advanced painting effects as well as receive notifications of all AWTEvents generated within its borders.

JLayer delegates the handling of painting and input events to a LayerUI object, which performs the actual decoration.

The custom painting implemented in the LayerUI and events notification work for the JLayer itself and all its subcomponents. This combination enables you to enrich existing components by adding new advanced functionality such as temporary locking of a hierarchy, data tips for compound components, enhanced mouse scrolling etc and so on.

JLayer is a good solution if you only need to do custom painting over compound component or catch input events from its subcomponents.

import javax.swing.; import javax.swing.plaf.LayerUI; import java.awt.;

public class JLayerSample {

private static JLayer<JComponent> createLayer() {
    // This custom layerUI will fill the layer with translucent green
    // and print out all mouseMotion events generated within its borders
    LayerUI<JComponent> layerUI = new LayerUI<JComponent>() {

        public void paint(Graphics g, JComponent c) {
            // paint the layer as is
            super.paint(g, c);
            // fill it with the translucent green
            g.setColor(new Color(0, 128, 0, 128));
            g.fillRect(0, 0, c.getWidth(), c.getHeight());
        }

        public void installUI(JComponent c) {
            super.installUI(c);
            // enable mouse motion events for the layer's subcomponents
            ((JLayer) c).setLayerEventMask(AWTEvent.MOUSE_MOTION_EVENT_MASK);
        }

        public void uninstallUI(JComponent c) {
            super.uninstallUI(c);
            // reset the layer event mask
            ((JLayer) c).setLayerEventMask(0);
        }

        // overridden method which catches MouseMotion events
        public void eventDispatched(AWTEvent e, JLayer<? extends JComponent> l) {
            System.out.println("AWTEvent detected: "  e);
        }
    };
    // create a component to be decorated with the layer
    JPanel panel = new JPanel();
    panel.add(new JButton("JButton"));

    // create the layer for the panel using our custom layerUI
    return new JLayer<JComponent>(panel, layerUI);
}

private static void createAndShowGUI() {
    final JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // work with the layer as with any other Swing component
    frame.add(createLayer());

    frame.setSize(200, 200);
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}

public static void main(String[] args) throws Exception {
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            createAndShowGUI();
        }
    });
}

}

Note: JLayer doesn't support the following methods:

Container.add(java.awt.Component) Container.add(String, java.awt.Component) Container.add(java.awt.Component, int) Container.add(java.awt.Component, Object) Container.add(java.awt.Component, Object, int)

using any of of them will cause UnsupportedOperationException to be thrown, to add a component to JLayer use setView(Component) or setGlassPane(JPanel).

JLayer is a universal decorator for Swing components
which enables you to implement various advanced painting effects as well as
receive notifications of all AWTEvents generated within its borders.

JLayer delegates the handling of painting and input events to a
LayerUI object, which performs the actual decoration.

The custom painting implemented in the LayerUI and events notification
work for the JLayer itself and all its subcomponents.
This combination enables you to enrich existing components
by adding new advanced functionality such as temporary locking of a hierarchy,
data tips for compound components, enhanced mouse scrolling etc and so on.

JLayer is a good solution if you only need to do custom painting
over compound component or catch input events from its subcomponents.


import javax.swing.*;
import javax.swing.plaf.LayerUI;
import java.awt.*;

public class JLayerSample {

    private static JLayer<JComponent> createLayer() {
        // This custom layerUI will fill the layer with translucent green
        // and print out all mouseMotion events generated within its borders
        LayerUI<JComponent> layerUI = new LayerUI<JComponent>() {

            public void paint(Graphics g, JComponent c) {
                // paint the layer as is
                super.paint(g, c);
                // fill it with the translucent green
                g.setColor(new Color(0, 128, 0, 128));
                g.fillRect(0, 0, c.getWidth(), c.getHeight());
            }

            public void installUI(JComponent c) {
                super.installUI(c);
                // enable mouse motion events for the layer's subcomponents
                ((JLayer) c).setLayerEventMask(AWTEvent.MOUSE_MOTION_EVENT_MASK);
            }

            public void uninstallUI(JComponent c) {
                super.uninstallUI(c);
                // reset the layer event mask
                ((JLayer) c).setLayerEventMask(0);
            }

            // overridden method which catches MouseMotion events
            public void eventDispatched(AWTEvent e, JLayer<? extends JComponent> l) {
                System.out.println("AWTEvent detected: "  e);
            }
        };
        // create a component to be decorated with the layer
        JPanel panel = new JPanel();
        panel.add(new JButton("JButton"));

        // create the layer for the panel using our custom layerUI
        return new JLayer<JComponent>(panel, layerUI);
    }

    private static void createAndShowGUI() {
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // work with the layer as with any other Swing component
        frame.add(createLayer());

        frame.setSize(200, 200);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }

    public static void main(String[] args) throws Exception {
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
}

Note: JLayer doesn't support the following methods:

Container.add(java.awt.Component)
Container.add(String, java.awt.Component)
Container.add(java.awt.Component, int)
Container.add(java.awt.Component, Object)
Container.add(java.awt.Component, Object, int)

using any of of them will cause UnsupportedOperationException to be thrown,
to add a component to JLayer
use setView(Component) or setGlassPane(JPanel).
raw docstring

javax.swing.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 its 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: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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 its 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: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JList

A component that displays a list of objects and allows the user to select one or more items. A separate model, ListModel, maintains the contents of the list.

It's easy to display an array or Vector of objects, using the JList constructor that automatically builds a read-only ListModel instance for you:

// Create a JList that displays strings from an array

String[] data = {"one", "two", "three", "four"}; JList<String> myList = new JList<String>(data);

// Create a JList that displays the superclasses of JList.class, by // creating it with a Vector populated with this data

Vector<Class<?>> superClasses = new Vector<Class<?>>(); Class<JList> rootClass = javax.swing.JList.class; for(Class<?> cls = rootClass; cls != null; cls = cls.getSuperclass()) { superClasses.addElement(cls); } JList<Class<?>> myList = new JList<Class<?>>(superClasses);

// The automatically created model is stored in JList's "model" // property, which you can retrieve

ListModel<Class<?>> model = myList.getModel(); for(int i = 0; i < model.getSize(); i++) { System.out.println(model.getElementAt(i)); }

A ListModel can be supplied directly to a JList by way of a constructor or the setModel method. The contents need not be static - the number of items, and the values of items can change over time. A correct ListModel implementation notifies the set of javax.swing.event.ListDataListeners that have been added to it, each time a change occurs. These changes are characterized by a javax.swing.event.ListDataEvent, which identifies the range of list indices that have been modified, added, or removed. JList's ListUI is responsible for keeping the visual representation up to date with changes, by listening to the model.

Simple, dynamic-content, JList applications can use the DefaultListModel class to maintain list elements. This class implements the ListModel interface and also provides a java.util.Vector-like API. Applications that need a more custom ListModel implementation may instead wish to subclass AbstractListModel, which provides basic support for managing and notifying listeners. For example, a read-only implementation of AbstractListModel:

// This list model has about 2^16 elements. Enjoy scrolling.

ListModel<String> bigData = new AbstractListModel<String>() { public int getSize() { return Short.MAX_VALUE; } public String getElementAt(int index) { return "Index " index; } };

The selection state of a JList is managed by another separate model, an instance of ListSelectionModel. JList is initialized with a selection model on construction, and also contains methods to query or set this selection model. Additionally, JList provides convenient methods for easily managing the selection. These methods, such as setSelectedIndex and getSelectedValue, are cover methods that take care of the details of interacting with the selection model. By default, JList's selection model is configured to allow any combination of items to be selected at a time; selection mode MULTIPLE_INTERVAL_SELECTION. The selection mode can be changed on the selection model directly, or via JList's cover method. Responsibility for updating the selection model in response to user gestures lies with the list's ListUI.

A correct ListSelectionModel implementation notifies the set of javax.swing.event.ListSelectionListeners that have been added to it each time a change to the selection occurs. These changes are characterized by a javax.swing.event.ListSelectionEvent, which identifies the range of the selection change.

The preferred way to listen for changes in list selection is to add ListSelectionListeners directly to the JList. JList then takes care of listening to the the selection model and notifying your listeners of change.

Responsibility for listening to selection changes in order to keep the list's visual representation up to date lies with the list's ListUI.

Painting of cells in a JList is handled by a delegate called a cell renderer, installed on the list as the cellRenderer property. The renderer provides a java.awt.Component that is used like a "rubber stamp" to paint the cells. Each time a cell needs to be painted, the list's ListUI asks the cell renderer for the component, moves it into place, and has it paint the contents of the cell by way of its paint method. A default cell renderer, which uses a JLabel component to render, is installed by the lists's ListUI. You can substitute your own renderer using code like this:

// Display an icon and a string for each object in the list.

class MyCellRenderer extends JLabel implements ListCellRenderer<Object> { 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,           // the list
  Object value,            // value to display
  int index,               // cell index
  boolean isSelected,      // is the cell selected
  boolean cellHasFocus)    // does the cell have 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;
}

}

myList.setCellRenderer(new MyCellRenderer());

Another job for the cell renderer is in helping to determine sizing information for the list. By default, the list's ListUI determines the size of cells by asking the cell renderer for its preferred size for each list item. This can be expensive for large lists of items. To avoid these calculations, you can set a fixedCellWidth and fixedCellHeight on the list, or have these values calculated automatically based on a single prototype value:

JList<String> bigDataList = new JList<String>(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 doesn't implement scrolling directly. To create a list that scrolls, make it the viewport view of a JScrollPane. For example:

JScrollPane scrollPane = new JScrollPane(myList);

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

JList doesn't provide any special handling of double or triple (or N) mouse clicks, but it's easy to add a MouseListener if you wish to take action on these events. Use the locationToIndex method to determine what cell was clicked. For example:

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

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

See How to Use Lists in The Java Tutorial for further documentation.

A component that displays a list of objects and allows the user to select
one or more items. A separate model, ListModel, maintains the
contents of the list.

It's easy to display an array or Vector of objects, using the JList
constructor that automatically builds a read-only ListModel instance
for you:


// Create a JList that displays strings from an array

String[] data = {"one", "two", "three", "four"};
JList<String> myList = new JList<String>(data);

// Create a JList that displays the superclasses of JList.class, by
// creating it with a Vector populated with this data

Vector<Class<?>> superClasses = new Vector<Class<?>>();
Class<JList> rootClass = javax.swing.JList.class;
for(Class<?> cls = rootClass; cls != null; cls = cls.getSuperclass()) {
    superClasses.addElement(cls);
}
JList<Class<?>> myList = new JList<Class<?>>(superClasses);

// The automatically created model is stored in JList's "model"
// property, which you can retrieve

ListModel<Class<?>> model = myList.getModel();
for(int i = 0; i < model.getSize(); i++) {
    System.out.println(model.getElementAt(i));
}

A ListModel can be supplied directly to a JList by way of a
constructor or the setModel method. The contents need not be static -
the number of items, and the values of items can change over time. A correct
ListModel implementation notifies the set of
javax.swing.event.ListDataListeners that have been added to it, each
time a change occurs. These changes are characterized by a
javax.swing.event.ListDataEvent, which identifies the range of list
indices that have been modified, added, or removed. JList's
ListUI is responsible for keeping the visual representation up to
date with changes, by listening to the model.

Simple, dynamic-content, JList applications can use the
DefaultListModel class to maintain list elements. This class
implements the ListModel interface and also provides a
java.util.Vector-like API. Applications that need a more
custom ListModel implementation may instead wish to subclass
AbstractListModel, which provides basic support for managing and
notifying listeners. For example, a read-only implementation of
AbstractListModel:


// This list model has about 2^16 elements.  Enjoy scrolling.

ListModel<String> bigData = new AbstractListModel<String>() {
    public int getSize() { return Short.MAX_VALUE; }
    public String getElementAt(int index) { return "Index "  index; }
};

The selection state of a JList is managed by another separate
model, an instance of ListSelectionModel. JList is
initialized with a selection model on construction, and also contains
methods to query or set this selection model. Additionally, JList
provides convenient methods for easily managing the selection. These methods,
such as setSelectedIndex and getSelectedValue, are cover
methods that take care of the details of interacting with the selection
model. By default, JList's selection model is configured to allow any
combination of items to be selected at a time; selection mode
MULTIPLE_INTERVAL_SELECTION. The selection mode can be changed
on the selection model directly, or via JList's cover method.
Responsibility for updating the selection model in response to user gestures
lies with the list's ListUI.

A correct ListSelectionModel implementation notifies the set of
javax.swing.event.ListSelectionListeners that have been added to it
each time a change to the selection occurs. These changes are characterized
by a javax.swing.event.ListSelectionEvent, which identifies the range
of the selection change.

The preferred way to listen for changes in list selection is to add
ListSelectionListeners directly to the JList. JList
then takes care of listening to the the selection model and notifying your
listeners of change.

Responsibility for listening to selection changes in order to keep the list's
visual representation up to date lies with the list's ListUI.


Painting of cells in a JList is handled by a delegate called a
cell renderer, installed on the list as the cellRenderer property.
The renderer provides a java.awt.Component that is used
like a "rubber stamp" to paint the cells. Each time a cell needs to be
painted, the list's ListUI asks the cell renderer for the component,
moves it into place, and has it paint the contents of the cell by way of its
paint method. A default cell renderer, which uses a JLabel
component to render, is installed by the lists's ListUI. You can
substitute your own renderer using code like this:


 // Display an icon and a string for each object in the list.

class MyCellRenderer extends JLabel implements ListCellRenderer<Object> {
    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,           // the list
      Object value,            // value to display
      int index,               // cell index
      boolean isSelected,      // is the cell selected
      boolean cellHasFocus)    // does the cell have 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;
    }
}

myList.setCellRenderer(new MyCellRenderer());

Another job for the cell renderer is in helping to determine sizing
information for the list. By default, the list's ListUI determines
the size of cells by asking the cell renderer for its preferred
size for each list item. This can be expensive for large lists of items.
To avoid these calculations, you can set a fixedCellWidth and
fixedCellHeight on the list, or have these values calculated
automatically based on a single prototype value:



JList<String> bigDataList = new JList<String>(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 doesn't implement scrolling directly. To create a list that
scrolls, make it the viewport view of a JScrollPane. For example:


JScrollPane scrollPane = new JScrollPane(myList);

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

JList doesn't provide any special handling of double or triple
(or N) mouse clicks, but it's easy to add a MouseListener if you
wish to take action on these events. Use the locationToIndex
method to determine what cell was clicked. For example:


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

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.

See How to Use Lists
in The Java Tutorial
for further documentation.
raw docstring

javax.swing.JList$DropLocation

A subclass of TransferHandler.DropLocation representing a drop location for a JList.

A subclass of TransferHandler.DropLocation representing
a drop location for a JList.
raw docstring

javax.swing.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.

Menus can be configured, and to some degree controlled, by Actions. Using an Action with a menu has many benefits beyond directly configuring a menu. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

For information and examples of using menus see How to Use Menus, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.

Menus can be configured, and to some degree controlled, by
Actions.  Using an
Action with a menu has many benefits beyond directly
configuring a menu.  Refer to
Swing Components Supporting Action for more
details, and you can find more information in How
to Use Actions, a section in The Java Tutorial.

For information and examples of using menus see
How to Use Menus,
a section in The Java Tutorial.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Warning: By default, pressing the Tab key does not transfer focus from a JMenuBar which is added to a container together with other Swing components, because the focusTraversalKeysEnabled property of JMenuBar is set to false. To resolve this, you should call the JMenuBar.setFocusTraversalKeysEnabled(true) method.

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.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.

Warning:
By default, pressing the Tab key does not transfer focus from a
JMenuBar which is added to a container together with other Swing
components, because the focusTraversalKeysEnabled property
of JMenuBar is set to false. To resolve this,
you should call the JMenuBar.setFocusTraversalKeysEnabled(true)
method.
raw docstring

javax.swing.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.

Menu items can be configured, and to some degree controlled, by Actions. Using an Action with a menu item has many benefits beyond directly configuring a menu item. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

For further documentation and for examples, see How to Use Menus in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.

Menu items can be configured, and to some degree controlled, by
Actions.  Using an
Action with a menu item has many benefits beyond directly
configuring a menu item.  Refer to
Swing Components Supporting Action for more
details, and you can find more information in How
to Use Actions, a section in The Java Tutorial.

For further documentation and for examples, see
How to Use Menus
in The Java Tutorial.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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:

Method Name
Description


showConfirmDialog
Asks a confirming question, like yes/no/cancel.


showInputDialog
Prompt for some input.

showMessageDialog Tell the user about something that has happened.

showOptionDialog The 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 JInternalFrame). Multiple 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 caller 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 ultimately 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. ComponentThe Component is displayed in the dialog. IconThe Icon is wrapped in a JLabel and displayed in the dialog. othersThe object is converted to a String by calling its toString method. The result is wrapped in a JLabel and displayed.

messageTypeDefines 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

optionTypeDefines 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. optionsA 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:

ComponentThe component is added to the button row directly. IconA JButton is created with this as its label. otherThe Object is converted to a string using its toString method and the result is used to label a JButton.

iconA decorative icon to be placed in the dialog box. A default value for this is determined by the messageType parameter. titleThe title for the dialog box. initialValueThe default selection (input value).

When the selection is changed, setValue is invoked, which generates a PropertyChangeEvent.

If a JOptionPane has configured to all input setWantsInput the bound property JOptionPane.INPUT_VALUE_PROPERTY can also be listened to, to determine when the user has input or selected a value.

When one of the showXxxDialog methods returns an integer, the possible values are:

YES_OPTION NO_OPTION CANCEL_OPTION OK_OPTION CLOSED_OPTION

Examples:

Show an error dialog that displays the message, 'alert':

JOptionPane.showMessageDialog(null, "alert", "alert", JOptionPane.ERROR_MESSAGE);

Show an internal information dialog with the message, 'information':

JOptionPane.showInternalMessageDialog(frame, "information", "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 < maxCounter; counter++) {
    if(options[counter].equals(selectedValue))
    return counter;
 }
 return CLOSED_OPTION;

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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:





    Method Name
    Description


    showConfirmDialog
    Asks a confirming question, like yes/no/cancel.


    showInputDialog
    Prompt for some input.


   showMessageDialog
   Tell the user about something that has happened.


   showOptionDialog
   The 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
 JInternalFrame).
 Multiple 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 caller 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
 ultimately 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.
 ComponentThe Component is displayed in the dialog.
 IconThe Icon is wrapped in a JLabel
               and displayed in the dialog.
 othersThe object is converted to a String by calling
               its toString method. The result is wrapped in a
               JLabel and displayed.

 messageTypeDefines 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

 optionTypeDefines 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.
 optionsA 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:

 ComponentThe component is added to the button row directly.
 IconA JButton is created with this as its label.
 otherThe Object is converted to a string using its
              toString method and the result is used to
              label a JButton.

 iconA decorative icon to be placed in the dialog box. A default
 value for this is determined by the messageType parameter.
 titleThe title for the dialog box.
 initialValueThe default selection (input value).



 When the selection is changed, setValue is invoked,
 which generates a PropertyChangeEvent.

 If a JOptionPane has configured to all input
 setWantsInput
 the bound property JOptionPane.INPUT_VALUE_PROPERTY
  can also be listened
 to, to determine when the user has input or selected a value.

 When one of the showXxxDialog methods returns an integer,
 the possible values are:

 YES_OPTION
 NO_OPTION
 CANCEL_OPTION
 OK_OPTION
 CLOSED_OPTION

 Examples:

 Show an error dialog that displays the message, 'alert':

 JOptionPane.showMessageDialog(null, "alert", "alert", JOptionPane.ERROR_MESSAGE);

 Show an internal information dialog with the message, 'information':


 JOptionPane.showInternalMessageDialog(frame, "information",
             "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 < maxCounter; counter++) {
        if(options[counter].equals(selectedValue))
        return counter;
     }
     return CLOSED_OPTION;

 Warning: Swing is not thread safe. For more
 information see Swing's Threading
 Policy.

 Warning:
 Serialized objects of this class will not be compatible with
 future Swing releases. The current serialization support is
 appropriate for short term storage or RMI between applications running
 the same version of Swing.  As of 1.4, support for long term storage
 of all JavaBeans™
 has been added to the java.beans package.
 Please see XMLEncoder.
raw docstring

javax.swing.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: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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 separately to make it easier to safely change the UI for the JTextField without affecting password entries.

NOTE: By default, JPasswordField disables input methods; otherwise, input characters could be visible while they were composed using input methods. If an application needs the input methods support, please use the inherited method, enableInputMethods(true).

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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 separately
to make it easier to safely change the UI for the
JTextField without affecting password entries.

NOTE:
By default, JPasswordField disables input methods; otherwise, input
characters could be visible while they were composed using input methods.
If an application needs the input methods support, please use the
inherited method, enableInputMethods(true).

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JPopupMenu$Separator

A popup menu-specific separator.

A popup menu-specific separator.
raw docstring

javax.swing.JProgressBar

A component that visually displays the progress of some task. As the task progresses towards completion, the progress bar displays the task's percentage of completion. This percentage is typically represented visually by a rectangle which starts out empty and gradually becomes filled in as the task progresses. In addition, the progress bar can display a textual representation of this percentage.

JProgressBar uses a BoundedRangeModel as its data model, with the value property representing the "current" state of the task, and the minimum and maximum properties representing the beginning and end points, respectively.

To indicate that 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 (representing some piece of work) which returns information about the progress of the task:

progressBar = new JProgressBar(0, task.getLengthOfTask()); progressBar.setValue(0); progressBar.setStringPainted(true);

Here is an example of querying the current state of the task, and using the returned value to update 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: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A component that visually displays the progress of some task.  As the task
 progresses towards completion, the progress bar displays the
 task's percentage of completion.
 This percentage is typically represented visually by a rectangle which
 starts out empty and gradually becomes filled in as the task progresses.
 In addition, the progress bar can display a textual representation of this
 percentage.

 JProgressBar uses a BoundedRangeModel as its data model,
 with the value property representing the "current" state of the task,
 and the minimum and maximum properties representing the
 beginning and end points, respectively.

 To indicate that 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 (representing some piece of work)
 which returns information about the progress of the task:



progressBar = new JProgressBar(0, task.getLengthOfTask());
progressBar.setValue(0);
progressBar.setStringPainted(true);

 Here is an example of querying the current state of the task, and using
 the returned value to update 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: Swing is not thread safe. For more
 information see Swing's Threading
 Policy.

 Warning:
 Serialized objects of this class will not be compatible with
 future Swing releases. The current serialization support is
 appropriate for short term storage or RMI between applications running
 the same version of Swing.  As of 1.4, support for long term storage
 of all JavaBeans™
 has been added to the java.beans package.
 Please see XMLEncoder.
raw docstring

javax.swing.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. To create a button panel, you should still create a JPanel or similar container-object and add a Border to it to set it off from surrounding components.

Buttons can be configured, and to some degree controlled, by Actions. Using an Action with a button has many benefits beyond directly configuring a button. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

See How to Use Buttons, Check Boxes, and Radio Buttons in The Java Tutorial for further documentation.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.
To create a button panel, you should still create a JPanel or similar
container-object and add a Border to it to set it off from surrounding
components.


Buttons can be configured, and to some degree controlled, by
Actions.  Using an
Action with a button has many benefits beyond directly
configuring a button.  Refer to
Swing Components Supporting Action for more
details, and you can find more information in How
to Use Actions, a section in The Java Tutorial.

See How to Use Buttons, Check Boxes, and Radio Buttons
in The Java Tutorial
for further documentation.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

Menu items can be configured, and to some degree controlled, by Actions. Using an Action with a menu item has many benefits beyond directly configuring a menu item. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

For further documentation and examples see How to Use Menus, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.

Menu items can be configured, and to some degree controlled, by
Actions.  Using an
Action with a menu item has many benefits beyond directly
configuring a menu item.  Refer to
Swing Components Supporting Action for more
details, and you can find more information in How
to Use Actions, a section in The Java Tutorial.

For further documentation and examples see
How to Use Menus,
a section in The Java Tutorial.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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 JInternalFrame is also shown. All five 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.

To add components to the JRootPane (other than the optional menu bar), you add the object to the contentPane of the JRootPane, like this:

  rootPane.getContentPane().add(child);

The same principle 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:

The glassPane fills the entire viewable area of the JRootPane (bounds - insets). The layeredPane fills the entire viewable area of the JRootPane. (bounds - insets) The menuBar is positioned at the upper edge of the layeredPane. The contentPane fills the entire viewable area, minus the menuBar, if present.

Any other views in the JRootPane view hierarchy are ignored.

If you replace the LayoutManager of the JRootPane, you are responsible for managing all of these views. So ordinarily you will want to be sure that you change the layout manager for the contentPane rather than for the JRootPane itself!

The painting architecture of Swing requires an opaque JComponent to exist in the containment hierarchy above all other components. This is typically provided by way of the content pane. If you replace the content pane, it is recommended that you make the content pane opaque by way of setOpaque(true). Additionally, if the content pane overrides paintComponent, it will need to completely fill in the background in an opaque color in paintComponent.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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
JInternalFrame is also shown.
All five 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.

To add components to the JRootPane (other than the
optional menu bar), you add the object to the contentPane
of the JRootPane, like this:


      rootPane.getContentPane().add(child);
The same principle 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:

The glassPane fills the entire viewable
    area of the JRootPane (bounds - insets).
The layeredPane fills the entire viewable area of the
    JRootPane. (bounds - insets)
The menuBar is positioned at the upper edge of the
    layeredPane.
The contentPane fills the entire viewable area,
    minus the menuBar, if present.

Any other views in the JRootPane view hierarchy are ignored.

If you replace the LayoutManager of the JRootPane,
you are responsible for managing all of these views.
So ordinarily you will want to be sure that you
change the layout manager for the contentPane rather than
for the JRootPane itself!

The painting architecture of Swing requires an opaque
JComponent
to exist in the containment hierarchy above all other components. This is
typically provided by way of the content pane. If you replace the content
pane, it is recommended that you make the content pane opaque
by way of setOpaque(true). Additionally, if the content pane
overrides paintComponent, it
will need to completely fill in the background in an opaque color in
paintComponent.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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 position 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: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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 position 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: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

Where two scroll bars meet, the row header meets the column header, or a scroll bar meets one of the headers, both components stop short of the corner, leaving a rectangular space which is, by default, empty. These spaces can potentially exist in any number of the four corners. In the previous diagram, the top right space is present and identified by the label "corner component".

Any number of these empty spaces can be replaced by using the setCorner method to add a component to a particular corner. (Note: The same component cannot be added to multiple corners.) This is useful if there's some extra decoration or function you'd like to add to the scroll pane. The size of each corner component is entirely determined by the size of the headers and/or scroll bars that surround it.

A corner component will only be visible if there is an empty space in that corner for it to exist in. For example, consider a component set into the top right corner of a scroll pane with a column header. If the scroll pane's vertical scrollbar is not present, perhaps because the view component hasn't grown large enough to require it, then the corner component will not be shown (since there is no empty space in that corner created by the meeting of the header and vertical scroll bar). Forcing the scroll bar to always be shown, using setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS), will ensure that the space for the corner component always exists.

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

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:

If the view implements Scrollable a combination of getPreferredScrollableViewportSize, getScrollableTracksViewportWidth and getScrollableTracksViewportHeightis used, otherwise getPreferredSize is used.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.

Where two scroll bars meet, the row header meets the column header,
or a scroll bar meets one of the headers, both components stop short
of the corner, leaving a rectangular space which is, by default, empty.
These spaces can potentially exist in any number of the four corners.
In the previous diagram, the top right space is present and identified
by the label "corner component".

Any number of these empty spaces can be replaced by using the
setCorner method to add a component to a particular corner.
(Note: The same component cannot be added to multiple corners.)
This is useful if there's
some extra decoration or function you'd like to add to the scroll pane.
The size of each corner component is entirely determined by the size of the
headers and/or scroll bars that surround it.

A corner component will only be visible if there is an empty space in that
corner for it to exist in. For example, consider a component set into the
top right corner of a scroll pane with a column header. If the scroll pane's
vertical scrollbar is not present, perhaps because the view component hasn't
grown large enough to require it, then the corner component will not be
shown (since there is no empty space in that corner created by the meeting
of the header and vertical scroll bar). Forcing the scroll bar to always be
shown, using
setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS),
will ensure that the space for the corner component always exists.

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

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:

  If the view implements Scrollable
      a combination of getPreferredScrollableViewportSize,
      getScrollableTracksViewportWidth and
      getScrollableTracksViewportHeightis used, otherwise
  getPreferredSize is used.


Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JSeparator

JSeparator provides a general purpose 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: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

JSeparator provides a general purpose 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: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JSlider

A component that lets the user graphically select a value by sliding a knob within a bounded interval. The knob is always positioned at the points that match integer values within the specified interval.

The slider can show both major tick marks, and minor tick marks between the major ones. The number of values between the tick marks is controlled with setMajorTickSpacing and setMinorTickSpacing. Painting of tick marks is controlled by setPaintTicks.

Sliders can also print text labels at regular intervals (or at arbitrary locations) along the slider track. Painting of labels is controlled by setLabelTable and setPaintLabels.

For further information and examples see How to Use Sliders, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A component that lets the user graphically select a value by sliding
a knob within a bounded interval. The knob is always positioned
at the points that match integer values within the specified interval.

The slider can show both
major tick marks, and minor tick marks between the major ones.  The number of
values between the tick marks is controlled with
setMajorTickSpacing and setMinorTickSpacing.
Painting of tick marks is controlled by setPaintTicks.

Sliders can also print text labels at regular intervals (or at
arbitrary locations) along the slider track.  Painting of labels is
controlled by setLabelTable and setPaintLabels.

For further information and examples see
How to Use Sliders,
a section in The Java Tutorial.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JSpinner

A single line input field that lets the user select a number or an object value from an ordered sequence. Spinners typically provide a pair of tiny arrow buttons for stepping through the elements of the sequence. The keyboard up/down arrow keys also cycle through the elements. The user may also be allowed to type a (legal) value directly into the spinner. Although combo boxes provide similar functionality, spinners are sometimes preferred because they don't require a drop down list that can obscure important data.

A JSpinner's sequence value is defined by its SpinnerModel. The model can be specified as a constructor argument and changed with the model property. SpinnerModel classes for some common types are provided: SpinnerListModel, SpinnerNumberModel, and SpinnerDateModel.

A JSpinner has a single child component that's responsible for displaying and potentially changing the current element or value of the model, which is called the editor. The editor is created by the JSpinner's constructor and can be changed with the editor property. The JSpinner's editor stays in sync with the model by listening for ChangeEvents. If the user has changed the value displayed by the editor it is possible for the model's value to differ from that of the editor. To make sure the model has the same value as the editor use the commitEdit method, eg:

try { spinner.commitEdit(); } catch (ParseException pe) { // Edited value is invalid, spinner.getValue() will return // the last valid value, you could revert the spinner to show that: JComponent editor = spinner.getEditor(); if (editor instanceof DefaultEditor) { ((DefaultEditor)editor).getTextField().setValue(spinner.getValue()); } // reset the value to some known value: spinner.setValue(fallbackValue); // or treat the last valid value as the current, in which // case you don't need to do anything. } return spinner.getValue();

For information and examples of using spinner see How to Use Spinners, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A single line input field that lets the user select a
number or an object value from an ordered sequence. Spinners typically
provide a pair of tiny arrow buttons for stepping through the elements
of the sequence. The keyboard up/down arrow keys also cycle through the
elements. The user may also be allowed to type a (legal) value directly
into the spinner. Although combo boxes provide similar functionality,
spinners are sometimes preferred because they don't require a drop down list
that can obscure important data.

A JSpinner's sequence value is defined by its
SpinnerModel.
The model can be specified as a constructor argument and
changed with the model property.  SpinnerModel
classes for some common types are provided: SpinnerListModel,
SpinnerNumberModel, and SpinnerDateModel.

A JSpinner has a single child component that's
responsible for displaying
and potentially changing the current element or value of
the model, which is called the editor.  The editor is created
by the JSpinner's constructor and can be changed with the
editor property.  The JSpinner's editor stays
in sync with the model by listening for ChangeEvents. If the
user has changed the value displayed by the editor it is
possible for the model's value to differ from that of
the editor. To make sure the model has the same
value as the editor use the commitEdit method, eg:


  try {
      spinner.commitEdit();
  }
  catch (ParseException pe) {
      // Edited value is invalid, spinner.getValue() will return
      // the last valid value, you could revert the spinner to show that:
      JComponent editor = spinner.getEditor();
      if (editor instanceof DefaultEditor) {
          ((DefaultEditor)editor).getTextField().setValue(spinner.getValue());
      }
      // reset the value to some known value:
      spinner.setValue(fallbackValue);
      // or treat the last valid value as the current, in which
      // case you don't need to do anything.
  }
  return spinner.getValue();

For information and examples of using spinner see
How to Use Spinners,
a section in The Java Tutorial.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JSpinner$DateEditor

An editor for a JSpinner whose model is a SpinnerDateModel. The value of the editor is displayed with a JFormattedTextField whose format is defined by a DateFormatter instance whose minimum and maximum properties are mapped to the SpinnerDateModel.

An editor for a JSpinner whose model is a
SpinnerDateModel.  The value of the editor is
displayed with a JFormattedTextField whose format
is defined by a DateFormatter instance whose
minimum and maximum properties
are mapped to the SpinnerDateModel.
raw docstring

javax.swing.JSpinner$DefaultEditor

A simple base class for more specialized editors that displays a read-only view of the model's current value with a JFormattedTextField. Subclasses can configure the JFormattedTextField to create an editor that's appropriate for the type of model they support and they may want to override the stateChanged and propertyChanged methods, which keep the model and the text field in sync.

This class defines a dismiss method that removes the editors ChangeListener from the JSpinner that it's part of. The setEditor method knows about DefaultEditor.dismiss, so if the developer replaces an editor that's derived from JSpinner.DefaultEditor its ChangeListener connection back to the JSpinner will be removed. However after that, it's up to the developer to manage their editor listeners. Similarly, if a subclass overrides createEditor, it's up to the subclasser to deal with their editor subsequently being replaced (with setEditor). We expect that in most cases, and in editor installed with setEditor or created by a createEditor override, will not be replaced anyway.

This class is the LayoutManager for it's single JFormattedTextField child. By default the child is just centered with the parents insets.

A simple base class for more specialized editors
that displays a read-only view of the model's current
value with a JFormattedTextField.  Subclasses
can configure the JFormattedTextField to create
an editor that's appropriate for the type of model they
support and they may want to override
the stateChanged and propertyChanged
methods, which keep the model and the text field in sync.

This class defines a dismiss method that removes the
editors ChangeListener from the JSpinner
that it's part of.   The setEditor method knows about
DefaultEditor.dismiss, so if the developer
replaces an editor that's derived from JSpinner.DefaultEditor
its ChangeListener connection back to the
JSpinner will be removed.  However after that,
it's up to the developer to manage their editor listeners.
Similarly, if a subclass overrides createEditor,
it's up to the subclasser to deal with their editor
subsequently being replaced (with setEditor).
We expect that in most cases, and in editor installed
with setEditor or created by a createEditor
override, will not be replaced anyway.

This class is the LayoutManager for it's single
JFormattedTextField child.   By default the
child is just centered with the parents insets.
raw docstring

javax.swing.JSpinner$ListEditor

An editor for a JSpinner whose model is a SpinnerListModel.

An editor for a JSpinner whose model is a
SpinnerListModel.
raw docstring

javax.swing.JSpinner$NumberEditor

An editor for a JSpinner whose model is a SpinnerNumberModel. The value of the editor is displayed with a JFormattedTextField whose format is defined by a NumberFormatter instance whose minimum and maximum properties are mapped to the SpinnerNumberModel.

An editor for a JSpinner whose model is a
SpinnerNumberModel.  The value of the editor is
displayed with a JFormattedTextField whose format
is defined by a NumberFormatter instance whose
minimum and maximum properties
are mapped to the SpinnerNumberModel.
raw docstring

javax.swing.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(java.awt.Dimension).

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.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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(java.awt.Dimension).

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.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

The tab title can be rendered by a Component. For example, the following produce similar results:

// In this case the look and feel renders the title for the tab. tabbedPane.addTab("Tab", myComponent); // In this case the custom component is responsible for rendering the // title of the tab. tabbedPane.addTab(null, myComponent); tabbedPane.setTabComponentAt(0, new JLabel("Tab")); The latter is typically used when you want a more complex user interaction that requires custom components on the tab. For example, you could provide a custom component that animates or one that has widgets for closing the tab.

If you specify a component for a tab, the JTabbedPane will not render any text or icon you have specified for the tab.

Note: Do not use setVisible directly on a tab component to make it visible, use setSelectedComponent or setSelectedIndex methods instead.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.

The tab title can be rendered by a Component.
For example, the following produce similar results:


// In this case the look and feel renders the title for the tab.
tabbedPane.addTab("Tab", myComponent);
// In this case the custom component is responsible for rendering the
// title of the tab.
tabbedPane.addTab(null, myComponent);
tabbedPane.setTabComponentAt(0, new JLabel("Tab"));
The latter is typically used when you want a more complex user interaction
that requires custom components on the tab.  For example, you could
provide a custom component that animates or one that has widgets for
closing the tab.

If you specify a component for a tab, the JTabbedPane
will not render any text or icon you have specified for the tab.

Note:
Do not use setVisible directly on a tab component to make it visible,
use setSelectedComponent or setSelectedIndex methods instead.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JTable

The JTable is used to display and edit regular two-dimensional tables of 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);

JTables are typically placed inside of a JScrollPane. By default, a JTable will adjust its width such that a horizontal scrollbar is unnecessary. To allow for a horizontal scrollbar, invoke setAutoResizeMode(int) with AUTO_RESIZE_OFF. Note 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.

To enable sorting and filtering of rows, use a RowSorter. You can set up a row sorter in either of two ways:

Directly set the RowSorter. For example: table.setRowSorter(new TableRowSorter(model)). Set the autoCreateRowSorter property to true, so that the JTable creates a RowSorter for you. For example: setAutoCreateRowSorter(true).

When designing applications that use the JTable it is worth paying close attention to the data structures that will represent the table's data. The DefaultTableModel is a model implementation that uses a Vector of Vectors of Objects to store the cell values. As well as copying the data from an application into the DefaultTableModel, it is also possible to wrap the data in the methods of the TableModel interface so that the data can be passed to the JTable directly, as in the example above. This often results in more efficient applications because the model is free to choose the internal representation that best suits the data. A good rule of thumb for deciding whether to use the AbstractTableModel or the DefaultTableModel is to use the AbstractTableModel as the base class for creating subclasses and the DefaultTableModel when subclassing is not required.

The "TableExample" directory in the 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.

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 the values from the model during painting. It is important to remember that the column and row indexes returned by various JTable methods are in terms of the JTable (the view) and are not necessarily the same indexes used by the model.

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.

Similarly when using the sorting and filtering functionality provided by RowSorter the underlying TableModel does not need to know how to do sorting, rather RowSorter will handle it. Coordinate conversions will be necessary when using the row based methods of JTable with the underlying TableModel. All of JTables row based methods are in terms of the RowSorter, which is not necessarily the same as that of the underlying TableModel. For example, the selection is always in terms of JTable so that when using RowSorter you will need to convert using convertRowIndexToView or convertRowIndexToModel. The following shows how to convert coordinates from JTable to that of the underlying model:

int[] selection = table.getSelectedRows(); for (int i = 0; i < selection.length; i++) { selection[i] = table.convertRowIndexToModel(selection[i]); } // selection is now in terms of the underlying TableModel

By default if sorting is enabled JTable will persist the selection and variable row heights in terms of the model on sorting. For example if row 0, in terms of the underlying model, is currently selected, after the sort row 0, in terms of the underlying model will be selected. Visually the selection may change, but in terms of the underlying model it will remain the same. The one exception to that is if the model index is no longer visible or was removed. For example, if row 0 in terms of model was filtered out the selection will be empty after the sort.

J2SE 5 adds methods to JTable to provide convenient access to some common printing needs. Simple new print() methods allow for quick and easy addition of printing support to your application. In addition, a new getPrintable(javax.swing.JTable.PrintMode, java.text.MessageFormat, java.text.MessageFormat) method is available for more advanced printing needs.

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.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The JTable is used to display and edit regular two-dimensional tables
of 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);

JTables are typically placed inside of a JScrollPane.  By
default, a JTable will adjust its width such that
a horizontal scrollbar is unnecessary.  To allow for a horizontal scrollbar,
invoke setAutoResizeMode(int) with AUTO_RESIZE_OFF.
Note 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.

To enable sorting and filtering of rows, use a
RowSorter.
You can set up a row sorter in either of two ways:

  Directly set the RowSorter. For example:
       table.setRowSorter(new TableRowSorter(model)).
  Set the autoCreateRowSorter
      property to true, so that the JTable
      creates a RowSorter for
      you. For example: setAutoCreateRowSorter(true).


When designing applications that use the JTable it is worth paying
close attention to the data structures that will represent the table's data.
The DefaultTableModel is a model implementation that
uses a Vector of Vectors of Objects to
store the cell values. As well as copying the data from an
application into the DefaultTableModel,
it is also possible to wrap the data in the methods of the
TableModel interface so that the data can be passed to the
JTable directly, as in the example above. This often results
in more efficient applications because the model is free to choose the
internal representation that best suits the data.
A good rule of thumb for deciding whether to use the AbstractTableModel
or the DefaultTableModel is to use the AbstractTableModel
as the base class for creating subclasses and the DefaultTableModel
when subclassing is not required.

The "TableExample" directory in the 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.

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 the
values from the model during painting.  It is important to remember that
the column and row indexes returned by various JTable methods
are in terms of the JTable (the view) and are not
necessarily the same indexes used by the model.

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.

Similarly when using the sorting and filtering functionality
provided by RowSorter the underlying
TableModel does not need to know how to do sorting,
rather RowSorter will handle it.  Coordinate
conversions will be necessary when using the row based methods of
JTable with the underlying TableModel.
All of JTables row based methods are in terms of the
RowSorter, which is not necessarily the same as that
of the underlying TableModel.  For example, the
selection is always in terms of JTable so that when
using RowSorter you will need to convert using
convertRowIndexToView or
convertRowIndexToModel.  The following shows how to
convert coordinates from JTable to that of the
underlying model:


  int[] selection = table.getSelectedRows();
  for (int i = 0; i < selection.length; i++) {
    selection[i] = table.convertRowIndexToModel(selection[i]);
  }
  // selection is now in terms of the underlying TableModel

By default if sorting is enabled JTable will persist the
selection and variable row heights in terms of the model on
sorting.  For example if row 0, in terms of the underlying model,
is currently selected, after the sort row 0, in terms of the
underlying model will be selected.  Visually the selection may
change, but in terms of the underlying model it will remain the
same.  The one exception to that is if the model index is no longer
visible or was removed.  For example, if row 0 in terms of model
was filtered out the selection will be empty after the sort.

J2SE 5 adds methods to JTable to provide convenient access to some
common printing needs. Simple new print() methods allow for quick
and easy addition of printing support to your application. In addition, a new
getPrintable(javax.swing.JTable.PrintMode, java.text.MessageFormat, java.text.MessageFormat) method is available for more advanced printing needs.

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.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JTable$DropLocation

A subclass of TransferHandler.DropLocation representing a drop location for a JTable.

A subclass of TransferHandler.DropLocation representing
a drop location for a JTable.
raw docstring

javax.swing.JTextArea

A JTextArea 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 capabilities 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 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 TextEvents. 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);

Newlines

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

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A JTextArea 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 capabilities 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 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 TextEvents.
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);


Newlines

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



Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.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.

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 < upper.length; i++) {
            upper[i] = Character.toUpperCase(upper[i]);
        }
        super.insertString(offs, new String(upper), a);
    }
}

}

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

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.

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 < upper.length; i++) {
                upper[i] = Character.toUpperCase(upper[i]);
            }
            super.insertString(offs, new String(upper), a);
        }
    }
}

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JTextPane

A text component that can be marked up with attributes that are represented graphically. You can find how-to information and examples of using text panes in Using Text Components, a section in The Java Tutorial.

This component models paragraphs that are composed of runs of character level attributes. Each paragraph may have a logical style attached to it which contains the default attributes to use if not overridden by attributes set on the paragraph or character run. Components and images may be embedded in the flow of text.

Newlines

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

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A text component that can be marked up with attributes that are
represented graphically.
You can find how-to information and examples of using text panes in
Using Text Components,
a section in The Java Tutorial.


This component models paragraphs
that are composed of runs of character level attributes.  Each
paragraph may have a logical style attached to it which contains
the default attributes to use if not overridden by attributes set
on the paragraph or character run.  Components and images may
be embedded in the flow of text.


Newlines

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



Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JToggleButton

An implementation of a two-state button. The JRadioButton and JCheckBox classes are subclasses of this class. For information on using them see How to Use Buttons, Check Boxes, and Radio Buttons, a section in The Java Tutorial.

Buttons can be configured, and to some degree controlled, by Actions. Using an Action with a button has many benefits beyond directly configuring a button. Refer to Swing Components Supporting Action for more details, and you can find more information in How to Use Actions, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An implementation of a two-state button.
The JRadioButton and JCheckBox classes
are subclasses of this class.
For information on using them see
How to Use Buttons, Check Boxes, and Radio Buttons,
a section in The Java Tutorial.

Buttons can be configured, and to some degree controlled, by
Actions.  Using an
Action with a button has many benefits beyond directly
configuring a button.  Refer to
Swing Components Supporting Action for more
details, and you can find more information in How
to Use Actions, a section in The Java Tutorial.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JToggleButton$ToggleButtonModel

The ToggleButton model

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The ToggleButton model

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JToolBar

JToolBar provides a component that is useful for displaying commonly used Actions or controls. For examples and information on using tool bars see How to Use Tool Bars, a section in The Java Tutorial.

With most look and feels, the user can drag out a tool bar into a separate window (unless the floatable property is set to false). For drag-out to work correctly, it is recommended that you add JToolBar instances to one of the four "sides" of a container whose layout manager is a BorderLayout, and do not add children to any of the other four "sides".

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

JToolBar provides a component that is useful for
displaying commonly used Actions or controls.
For examples and information on using tool bars see
How to Use Tool Bars,
a section in The Java Tutorial.


With most look and feels,
the user can drag out a tool bar into a separate window
(unless the floatable property is set to false).
For drag-out to work correctly, it is recommended that you add
JToolBar instances to one of the four "sides" of a
container whose layout manager is a BorderLayout,
and do not add children to any of the other four "sides".

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JToolBar$Separator

A toolbar-specific separator. An object with dimension but no contents used to divide buttons on a tool bar into groups.

A toolbar-specific separator. An object with dimension but
no contents used to divide buttons on a tool bar into groups.
raw docstring

javax.swing.JToolTip

Used to display a "Tip" for a Component. Typically components provide api to automate the process of using ToolTips. For example, any Swing component can use the JComponent setToolTipText method to specify the text for a standard tooltip. A component that wants to create a custom ToolTip display can override JComponent's createToolTip method and use a subclass of this class.

See How to Use Tool Tips in The Java Tutorial for further documentation.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Used to display a "Tip" for a Component. Typically components provide api
to automate the process of using ToolTips.
For example, any Swing component can use the JComponent
setToolTipText method to specify the text
for a standard tooltip. A component that wants to create a custom
ToolTip
display can override JComponent's createToolTip
method and use a subclass of this class.

See How to Use Tool Tips
in The Java Tutorial
for further documentation.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JTree

A control that displays a set of hierarchical data as an outline. You can find task-oriented documentation and examples of using trees in How to Use Trees, a section in The Java Tutorial.

A specific node in a tree can be identified either by a TreePath (an object that encapsulates a node and all of its ancestors), or by its display row, where each row in the display area displays one node. An expanded node is a non-leaf node (as identified by TreeModel.isLeaf(node) returning false) that will displays its children when all its ancestors are expanded. A collapsed node is one which hides them. A hidden node is one which is under a collapsed ancestor. All of a viewable nodes parents are expanded, but may or may not be displayed. A displayed node is both viewable and in the display area, where it can be seen.

The following JTree methods use "visible" to mean "displayed":

isRootVisible() setRootVisible() scrollPathToVisible() scrollRowToVisible() getVisibleRowCount() setVisibleRowCount()

The next group of JTree methods use "visible" to mean "viewable" (under an expanded parent):

isVisible() makeVisible()

If you are interested in knowing when the selection changes implement the TreeSelectionListener interface and add the instance using the method addTreeSelectionListener. valueChanged will be invoked when the selection changes, that is if the user clicks twice on the same node valueChanged will only be invoked once.

If you are interested in detecting either double-click events or when a user clicks on a node, regardless of whether or not it was selected, we recommend you do the following:

final JTree tree = ...;

MouseListener ml = new MouseAdapter() { public void mousePressed(MouseEvent e) { int selRow = tree.getRowForLocation(e.getX(), e.getY()); TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); if(selRow != -1) { if(e.getClickCount() == 1) { mySingleClick(selRow, selPath); } else if(e.getClickCount() == 2) { myDoubleClick(selRow, selPath); } } } }; tree.addMouseListener(ml); NOTE: This example obtains both the path and row, but you only need to get the one you're interested in.

To use JTree to display compound nodes (for example, nodes containing both a graphic icon and text), subclass TreeCellRenderer and use setCellRenderer(javax.swing.tree.TreeCellRenderer) to tell the tree to use it. To edit such nodes, subclass TreeCellEditor and use setCellEditor(javax.swing.tree.TreeCellEditor).

Like all JComponent classes, you can use InputMap and ActionMap to associate an Action object with a KeyStroke and execute the action under specified conditions.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

 A control that displays a set of hierarchical data as an outline.
You can find task-oriented documentation and examples of using trees in
How to Use Trees,
a section in The Java Tutorial.

A specific node in a tree can be identified either by a
TreePath (an object
that encapsulates a node and all of its ancestors), or by its
display row, where each row in the display area displays one node.
An expanded node is a non-leaf node (as identified by
TreeModel.isLeaf(node) returning false) that will displays
its children when all its ancestors are expanded.
A collapsed
node is one which hides them. A hidden node is one which is
under a collapsed ancestor. All of a viewable nodes parents
are expanded, but may or may not be displayed. A displayed node
is both viewable and in the display area, where it can be seen.

The following JTree methods use "visible" to mean "displayed":

isRootVisible()
setRootVisible()
scrollPathToVisible()
scrollRowToVisible()
getVisibleRowCount()
setVisibleRowCount()

The next group of JTree methods use "visible" to mean
"viewable" (under an expanded parent):

isVisible()
makeVisible()

If you are interested in knowing when the selection changes implement
the TreeSelectionListener interface and add the instance
using the method addTreeSelectionListener.
valueChanged will be invoked when the
selection changes, that is if the user clicks twice on the same
node valueChanged will only be invoked once.

If you are interested in detecting either double-click events or when
a user clicks on a node, regardless of whether or not it was selected,
we recommend you do the following:



final JTree tree = ...;

MouseListener ml = new MouseAdapter() {
    public void mousePressed(MouseEvent e) {
        int selRow = tree.getRowForLocation(e.getX(), e.getY());
        TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
        if(selRow != -1) {
            if(e.getClickCount() == 1) {
                mySingleClick(selRow, selPath);
            }
            else if(e.getClickCount() == 2) {
                myDoubleClick(selRow, selPath);
            }
        }
    }
};
tree.addMouseListener(ml);
NOTE: This example obtains both the path and row, but you only need to
get the one you're interested in.

To use JTree to display compound nodes
(for example, nodes containing both
a graphic icon and text), subclass TreeCellRenderer and use
setCellRenderer(javax.swing.tree.TreeCellRenderer) to tell the tree to use it. To edit such nodes,
subclass TreeCellEditor and use setCellEditor(javax.swing.tree.TreeCellEditor).


Like all JComponent classes, you can use InputMap and
ActionMap
to associate an Action object with a KeyStroke
and execute the action under specified conditions.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JTree$DropLocation

A subclass of TransferHandler.DropLocation representing a drop location for a JTree.

A subclass of TransferHandler.DropLocation representing
a drop location for a JTree.
raw docstring

javax.swing.JTree$DynamicUtilTreeNode

DynamicUtilTreeNode can wrap vectors/hashtables/arrays/strings and create the appropriate children tree nodes as necessary. It is dynamic in that it will only create the children as necessary.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

DynamicUtilTreeNode can wrap
vectors/hashtables/arrays/strings and
create the appropriate children tree nodes as necessary. It is
dynamic in that it will only create the children as necessary.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JTree$EmptySelectionModel

EmptySelectionModel is a TreeSelectionModel that does not allow anything to be selected.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

EmptySelectionModel is a TreeSelectionModel
that does not allow anything to be selected.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JViewport

The "viewport" or "porthole" through which you see the underlying information. When you scroll, what moves is the viewport. It is like peering through a camera's viewfinder. Moving the viewfinder upwards brings new things into view at the top of the picture and loses things that were at the bottom.

By default, JViewport is opaque. To change this, use the setOpaque method.

NOTE:We have implemented a faster scrolling algorithm that does not require a buffer to draw in. The algorithm works as follows: The view and parent view and checked to see if they are JComponents, if they aren't, stop and repaint the whole viewport. If the viewport is obscured by an ancestor, stop and repaint the whole viewport. Compute the region that will become visible, if it is as big as the viewport, stop and repaint the whole view region. Obtain the ancestor Window's graphics and do a copyArea on the scrolled region. Message the view to repaint the newly visible region. The next time paint is invoked on the viewport, if the clip region is smaller than the viewport size a timer is kicked off to repaint the whole region.

In general this approach is much faster. Compared to the backing store approach this avoids the overhead of maintaining an offscreen buffer and having to do two copyAreas. Compared to the non backing store case this approach will greatly reduce the painted region.

This approach can cause slower times than the backing store approach when the viewport is obscured by another window, or partially offscreen. When another window obscures the viewport the copyArea will copy garbage and a paint event will be generated by the system to inform us we need to paint the newly exposed region. The only way to handle this is to repaint the whole viewport, which can cause slower performance than the backing store case. In most applications very rarely will the user be scrolling while the viewport is obscured by another window or offscreen, so this optimization is usually worth the performance hit when obscured.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The "viewport" or "porthole" through which you see the underlying
information. When you scroll, what moves is the viewport. It is like
peering through a camera's viewfinder. Moving the viewfinder upwards
brings new things into view at the top of the picture and loses
things that were at the bottom.

By default, JViewport is opaque. To change this, use the
setOpaque method.

NOTE:We have implemented a faster scrolling algorithm that
does not require a buffer to draw in. The algorithm works as follows:
The view and parent view and checked to see if they are
JComponents,
if they aren't, stop and repaint the whole viewport.
If the viewport is obscured by an ancestor, stop and repaint the whole
viewport.
Compute the region that will become visible, if it is as big as
the viewport, stop and repaint the whole view region.
Obtain the ancestor Window's graphics and
do a copyArea on the scrolled region.
Message the view to repaint the newly visible region.
The next time paint is invoked on the viewport, if the clip region
is smaller than the viewport size a timer is kicked off to repaint the
whole region.

In general this approach is much faster. Compared to the backing store
approach this avoids the overhead of maintaining an offscreen buffer and
having to do two copyAreas.
Compared to the non backing store case this
approach will greatly reduce the painted region.

This approach can cause slower times than the backing store approach
when the viewport is obscured by another window, or partially offscreen.
When another window
obscures the viewport the copyArea will copy garbage and a
paint event will be generated by the system to inform us we need to
paint the newly exposed region. The only way to handle this is to
repaint the whole viewport, which can cause slower performance than the
backing store case. In most applications very rarely will the user be
scrolling while the viewport is obscured by another window or offscreen,
so this optimization is usually worth the performance hit when obscured.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.JWindow

A JWindow is a container that can be displayed anywhere on the user's desktop. It does not have the title bar, window-management buttons, or other trimmings associated with a JFrame, but it is still a "first-class citizen" of the user's desktop, and can exist anywhere on it.

The JWindow component contains a JRootPane as its only child. The contentPane should be the parent of any children of the JWindow. As a convenience, the add, remove, and setLayout methods of this class are overridden, so that they delegate calls to the corresponding methods of the ContentPane. For example, you can add a child component to a window as follows:

  window.add(child);

And the child will be added to the contentPane. The contentPane will always be non-null. Attempting to set it to null will cause the JWindow to throw an exception. The default contentPane will have a BorderLayout manager set on it. Refer to RootPaneContainer for details on adding, removing and setting the LayoutManager of a JWindow.

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

In a multi-screen environment, you can create a JWindow on a different screen device. See Window for more information.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A JWindow is a container that can be displayed anywhere on the
user's desktop. It does not have the title bar, window-management buttons,
or other trimmings associated with a JFrame, but it is still a
"first-class citizen" of the user's desktop, and can exist anywhere
on it.

The JWindow component contains a JRootPane
as its only child.  The contentPane should be the parent
of any children of the JWindow.
As a convenience, the add, remove, and setLayout
methods of this class are overridden, so that they delegate calls
to the corresponding methods of the ContentPane.
For example, you can add a child component to a window as follows:


      window.add(child);
And the child will be added to the contentPane.
The contentPane will always be non-null.
Attempting to set it to null will cause the JWindow
to throw an exception. The default contentPane will have a
BorderLayout manager set on it.
Refer to RootPaneContainer
for details on adding, removing and setting the LayoutManager
of a JWindow.

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

In a multi-screen environment, you can create a JWindow
on a different screen device.  See Window for more
information.

Warning: Swing is not thread safe. For more
information see Swing's Threading
Policy.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.KeyStroke

A KeyStroke represents a key action on the keyboard, or equivalent input device. KeyStrokes can correspond to only a press or release of a particular key, just as KEY_PRESSED and KEY_RELEASED KeyEvents do; alternately, they can correspond to typing a specific Java character, just as KEY_TYPED KeyEvents do. In all cases, KeyStrokes can specify modifiers (alt, shift, control, meta, altGraph, or a combination thereof) which must be present during the action for an exact match.

KeyStrokes are used to define high-level (semantic) action events. Instead of trapping every keystroke and throwing away the ones you are not interested in, those keystrokes you care about automatically initiate actions on the Components with which they are registered.

KeyStrokes are immutable, and are intended to be unique. Client code cannot create a KeyStroke; a variant of getKeyStroke must be used instead. These factory methods allow the KeyStroke implementation to cache and share instances efficiently.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A KeyStroke represents a key action on the keyboard, or equivalent input
device. KeyStrokes can correspond to only a press or release of a particular
key, just as KEY_PRESSED and KEY_RELEASED KeyEvents do; alternately, they
can correspond to typing a specific Java character, just as KEY_TYPED
KeyEvents do. In all cases, KeyStrokes can specify modifiers (alt, shift,
control, meta, altGraph, or a combination thereof) which must be present during the
action for an exact match.

KeyStrokes are used to define high-level (semantic) action events. Instead
of trapping every keystroke and throwing away the ones you are not
interested in, those keystrokes you care about automatically initiate
actions on the Components with which they are registered.

KeyStrokes are immutable, and are intended to be unique. Client code cannot
create a KeyStroke; a variant of getKeyStroke must be used
instead. These factory methods allow the KeyStroke implementation to cache
and share instances efficiently.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.LayoutFocusTraversalPolicy

A SortingFocusTraversalPolicy which sorts Components based on their size, position, and orientation. Based on their size and position, Components are roughly categorized into rows and columns. For a Container with horizontal orientation, columns run left-to-right or right-to-left, and rows run top- to-bottom. For a Container with vertical orientation, columns run top-to- bottom and rows run left-to-right or right-to-left. See ComponentOrientation for more information. All columns in a row are fully traversed before proceeding to the next row.

A SortingFocusTraversalPolicy which sorts Components based on their size,
position, and orientation. Based on their size and position, Components are
roughly categorized into rows and columns. For a Container with horizontal
orientation, columns run left-to-right or right-to-left, and rows run top-
to-bottom. For a Container with vertical orientation, columns run top-to-
bottom and rows run left-to-right or right-to-left. See
ComponentOrientation for more information. All columns in a
row are fully traversed before proceeding to the next row.
raw docstring

javax.swing.LayoutStyle

LayoutStyle provides information about how to position components. This class is primarily useful for visual tools and layout managers. Most developers will not need to use this class.

You typically don't set or create a LayoutStyle. Instead use the static method getInstance to obtain the current instance.

LayoutStyle provides information about how to position
components.  This class is primarily useful for visual tools and
layout managers.  Most developers will not need to use this class.

You typically don't set or create a
LayoutStyle.  Instead use the static method
getInstance to obtain the current instance.
raw docstring

javax.swing.ListCellRenderer

Identifies components that can be used as "rubber stamps" to paint the cells in a JList. For example, to use a JLabel as a ListCellRenderer, you would write something like this:

class MyCellRenderer extends JLabel implements ListCellRenderer<Object> { public MyCellRenderer() { setOpaque(true); }

public Component getListCellRendererComponent(JList<?> list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus) {

    setText(value.toString());

    Color background;
    Color foreground;

    // check if this cell represents the current DnD drop location
    JList.DropLocation dropLocation = list.getDropLocation();
    if (dropLocation != null
            && !dropLocation.isInsert()
            && dropLocation.getIndex() == index) {

        background = Color.BLUE;
        foreground = Color.WHITE;

    // check if this cell is selected
    } else if (isSelected) {
        background = Color.RED;
        foreground = Color.WHITE;

    // unselected, and not the DnD drop location
    } else {
        background = Color.WHITE;
        foreground = Color.BLACK;
    };

    setBackground(background);
    setForeground(foreground);

    return this;
}

}

Identifies components that can be used as "rubber stamps" to paint
the cells in a JList.  For example, to use a JLabel as a
ListCellRenderer, you would write something like this:


class MyCellRenderer extends JLabel implements ListCellRenderer<Object> {
    public MyCellRenderer() {
        setOpaque(true);
    }

    public Component getListCellRendererComponent(JList<?> list,
                                                  Object value,
                                                  int index,
                                                  boolean isSelected,
                                                  boolean cellHasFocus) {

        setText(value.toString());

        Color background;
        Color foreground;

        // check if this cell represents the current DnD drop location
        JList.DropLocation dropLocation = list.getDropLocation();
        if (dropLocation != null
                && !dropLocation.isInsert()
                && dropLocation.getIndex() == index) {

            background = Color.BLUE;
            foreground = Color.WHITE;

        // check if this cell is selected
        } else if (isSelected) {
            background = Color.RED;
            foreground = Color.WHITE;

        // unselected, and not the DnD drop location
        } else {
            background = Color.WHITE;
            foreground = Color.BLACK;
        };

        setBackground(background);
        setForeground(foreground);

        return this;
    }
}
raw docstring

javax.swing.ListModel

This interface defines the methods components like JList use to get the value of each cell in a list and the length of the list. Logically the model is a vector, indices vary from 0 to ListDataModel.getSize() - 1. Any change to the contents or length of the data model must be reported to all of the ListDataListeners.

This interface defines the methods components like JList use
to get the value of each cell in a list and the length of the list.
Logically the model is a vector, indices vary from 0 to
ListDataModel.getSize() - 1.  Any change to the contents or
length of the data model must be reported to all of the
ListDataListeners.
raw docstring

javax.swing.ListSelectionModel

This interface represents the current state of the selection for any of the components that display a list of values with stable indices. The selection is modeled as a set of intervals, each interval represents a contiguous range of selected list elements. The methods for modifying the set of selected intervals all take a pair of indices, index0 and index1, that represent a closed interval, i.e. the interval includes both index0 and index1.

This interface represents the current state of the
selection for any of the components that display a
list of values with stable indices.  The selection is
modeled as a set of intervals, each interval represents
a contiguous range of selected list elements.
The methods for modifying the set of selected intervals
all take a pair of indices, index0 and index1, that represent
a closed interval, i.e. the interval includes both index0 and
index1.
raw docstring

javax.swing.LookAndFeel

LookAndFeel, as the name implies, encapsulates a look and feel. Beyond installing a look and feel most developers never need to interact directly with LookAndFeel. In general only developers creating a custom look and feel need to concern themselves with this class.

Swing is built upon the foundation that each JComponent subclass has an implementation of a specific ComponentUI subclass. The ComponentUI is often referred to as "the ui", "component ui", or "look and feel delegate". The ComponentUI subclass is responsible for providing the look and feel specific functionality of the component. For example, JTree requires an implementation of the ComponentUI subclass TreeUI. The implementation of the specific ComponentUI subclass is provided by the LookAndFeel. Each JComponent subclass identifies the ComponentUI subclass it requires by way of the JComponent method getUIClassID.

Each LookAndFeel implementation must provide an implementation of the appropriate ComponentUI subclass by specifying a value for each of Swing's ui class ids in the UIDefaults object returned from getDefaults. For example, BasicLookAndFeel uses BasicTreeUI as the concrete implementation for TreeUI. This is accomplished by BasicLookAndFeel providing the key-value pair "TreeUI"-"javax.swing.plaf.basic.BasicTreeUI", in the UIDefaults returned from getDefaults. Refer to UIDefaults.getUI(JComponent) for details on how the implementation of the ComponentUI subclass is obtained.

When a LookAndFeel is installed the UIManager does not check that an entry exists for all ui class ids. As such, random exceptions will occur if the current look and feel has not provided a value for a particular ui class id and an instance of the JComponent subclass is created.

Recommendations for Look and Feels

As noted in UIManager each LookAndFeel has the opportunity to provide a set of defaults that are layered in with developer and system defaults. Some of Swing's components require the look and feel to provide a specific set of defaults. These are documented in the classes that require the specific default.

ComponentUIs and defaults

All ComponentUIs typically need to set various properties on the JComponent the ComponentUI is providing the look and feel for. This is typically done when the ComponentUI is installed on the JComponent. Setting a property should only be done if the developer has not set the property. For non-primitive values it is recommended that the ComponentUI only change the property on the JComponent if the current value is null or implements UIResource. If the current value is null or implements UIResource it indicates the property has not been set by the developer, and the ui is free to change it. For example, BasicButtonUI.installDefaults only changes the font on the JButton if the return value from button.getFont() is null or implements UIResource. On the other hand if button.getFont() returned a non-null value that did not implement UIResource then BasicButtonUI.installDefaults would not change the JButton's font.

For primitive values, such as opaque, the method installProperty should be invoked. installProperty only changes the corresponding property if the value has not been changed by the developer.

ComponentUI implementations should use the various install methods provided by this class as they handle the necessary checking and install the property using the recommended guidelines.

Exceptions

All of the install methods provided by LookAndFeel need to access the defaults if the value of the property being changed is null or a UIResource. For example, installing the font does the following:

JComponent c; Font font = c.getFont(); if (font == null || (font instanceof UIResource)) { c.setFont(UIManager.getFont("fontKey")); } If the font is null or a UIResource, the defaults table is queried with the key fontKey. All of UIDefault's get methods throw a NullPointerException if passed in null. As such, unless otherwise noted each of the various install methods of LookAndFeel throw a NullPointerException if the current value is null or a UIResource and the supplied defaults key is null. In addition, unless otherwise specified all of the install methods throw a NullPointerException if a null component is passed in.

LookAndFeel, as the name implies, encapsulates a look and
feel. Beyond installing a look and feel most developers never need to
interact directly with LookAndFeel. In general only developers
creating a custom look and feel need to concern themselves with this class.

Swing is built upon the foundation that each JComponent
subclass has an implementation of a specific ComponentUI
subclass. The ComponentUI is often referred to as "the ui",
"component ui", or "look and feel delegate". The ComponentUI
subclass is responsible for providing the look and feel specific
functionality of the component. For example, JTree requires
an implementation of the ComponentUI subclass TreeUI. The implementation of the specific ComponentUI subclass is provided by the LookAndFeel. Each
JComponent subclass identifies the ComponentUI
subclass it requires by way of the JComponent method getUIClassID.

Each LookAndFeel implementation must provide
an implementation of the appropriate ComponentUI subclass by
specifying a value for each of Swing's ui class ids in the UIDefaults object returned from getDefaults. For example,
BasicLookAndFeel uses BasicTreeUI as the concrete
implementation for TreeUI. This is accomplished by BasicLookAndFeel providing the key-value pair "TreeUI"-"javax.swing.plaf.basic.BasicTreeUI", in the
UIDefaults returned from getDefaults. Refer to
UIDefaults.getUI(JComponent) for details on how the implementation
of the ComponentUI subclass is obtained.

When a LookAndFeel is installed the UIManager does
not check that an entry exists for all ui class ids. As such,
random exceptions will occur if the current look and feel has not
provided a value for a particular ui class id and an instance of
the JComponent subclass is created.

Recommendations for Look and Feels

As noted in UIManager each LookAndFeel has the opportunity
to provide a set of defaults that are layered in with developer and
system defaults. Some of Swing's components require the look and feel
to provide a specific set of defaults. These are documented in the
classes that require the specific default.

ComponentUIs and defaults

All ComponentUIs typically need to set various properties
on the JComponent the ComponentUI is providing the
look and feel for. This is typically done when the ComponentUI is installed on the JComponent. Setting a
property should only be done if the developer has not set the
property. For non-primitive values it is recommended that the
ComponentUI only change the property on the JComponent if the current value is null or implements
UIResource. If the current value is null or
implements UIResource it indicates the property has not
been set by the developer, and the ui is free to change it.  For
example, BasicButtonUI.installDefaults only changes the
font on the JButton if the return value from button.getFont() is null or implements UIResource. On the other hand if button.getFont() returned
a non-null value that did not implement UIResource
then BasicButtonUI.installDefaults would not change the
JButton's font.

For primitive values, such as opaque, the method installProperty should be invoked.  installProperty only changes
the corresponding property if the value has not been changed by the
developer.

ComponentUI implementations should use the various install methods
provided by this class as they handle the necessary checking and install
the property using the recommended guidelines.

Exceptions

All of the install methods provided by LookAndFeel need to
access the defaults if the value of the property being changed is
null or a UIResource. For example, installing the
font does the following:


  JComponent c;
  Font font = c.getFont();
  if (font == null || (font instanceof UIResource)) {
      c.setFont(UIManager.getFont("fontKey"));
  }
If the font is null or a UIResource, the
defaults table is queried with the key fontKey. All of
UIDefault's get methods throw a NullPointerException if passed in null. As such, unless
otherwise noted each of the various install methods of LookAndFeel throw a NullPointerException if the current
value is null or a UIResource and the supplied
defaults key is null. In addition, unless otherwise specified
all of the install methods throw a NullPointerException if
a null component is passed in.
raw docstring

javax.swing.MenuElement

Any component that can be placed into a menu should implement this interface. This interface is used by MenuSelectionManager to handle selection and navigation in menu hierarchies.

Any component that can be placed into a menu should implement this interface.
This interface is used by MenuSelectionManager
to handle selection and navigation in menu hierarchies.
raw docstring

javax.swing.MutableComboBoxModel

A mutable version of ComboBoxModel.

A mutable version of ComboBoxModel.
raw docstring

javax.swing.OverlayLayout

A layout manager to arrange components over the top of each other. The requested size of the container will be the largest requested size of the children, taking alignment needs into consideration.

The alignment is based upon what is needed to properly fit the children in the allocation area. The children will be placed such that their alignment points are all on top of each other.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A layout manager to arrange components over the top
of each other.  The requested size of the container
will be the largest requested size of the children,
taking alignment needs into consideration.

The alignment is based upon what is needed to properly
fit the children in the allocation area.  The children
will be placed such that their alignment points are all
on top of each other.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.Painter

A painting delegate. The Painter interface defines exactly one method, paint. It is used in situations where the developer can change the painting routine of a component without having to resort to subclassing the component. It is also generically useful when doing any form of painting delegation.

Painters are simply encapsulations of Java2D code and make it fairly trivial to reuse existing Painters or to combine them together. Implementations of this interface are also trivial to write, such that if you can't find a Painter that does what you need, you can write one with minimal effort. Writing a Painter requires knowledge of Java2D.

A Painter may be created with a type parameter. This type will be expected in the paint method. For example, you may wish to write a Painter that only works with subclasses of Component. In that case, when the Painter is declared, you may declare that it requires a Component, allowing the paint method to be type safe. Ex:

Painter<Component> p = new Painter<Component>() { public void paint(Graphics2D g, Component c, int width, int height) { g.setColor(c.getBackground()); //and so forth } }

This interface makes no guarantees of threadsafety.

A painting delegate. The Painter interface defines exactly one method,
paint. It is used in situations where the developer can change
the painting routine of a component without having to resort to subclassing
the component. It is also generically useful when doing any form of painting
delegation.

Painters are simply encapsulations of Java2D code and make
it fairly trivial to reuse existing Painters or to combine
them together. Implementations of this interface are also trivial to write,
such that if you can't find a Painter that does what you need,
you can write one with minimal effort. Writing a Painter requires
knowledge of Java2D.

A Painter may be created with a type parameter. This type will be
expected in the paint method. For example, you may wish to write a
Painter that only works with subclasses of Component.
In that case, when the Painter is declared, you may declare that
it requires a Component, allowing the paint method to be type safe. Ex:


Painter<Component> p = new Painter<Component>() {
    public void paint(Graphics2D g, Component c, int width, int height) {
        g.setColor(c.getBackground());
        //and so forth
    }
}

This interface makes no guarantees of threadsafety.
raw docstring

javax.swing.plaf.ActionMapUIResource

A subclass of javax.swing.ActionMap that implements UIResource. UI classes which provide an ActionMap should use this class.

A subclass of javax.swing.ActionMap that implements UIResource.
UI classes which provide an ActionMap should use this class.
raw docstring

javax.swing.plaf.basic.BasicArrowButton

JButton object that draws a scaled Arrow in one of the cardinal directions.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

JButton object that draws a scaled Arrow in one of the cardinal directions.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicBorders$RolloverButtonBorder

Special thin border for rollover toolbar buttons.

Special thin border for rollover toolbar buttons.
raw docstring

javax.swing.plaf.basic.BasicBorders$SplitPaneBorder

Draws the border around the splitpane. To work correctly you should also install a border on the divider (property SplitPaneDivider.border).

Draws the border around the splitpane. To work correctly you should
also install a border on the divider (property SplitPaneDivider.border).
raw docstring

javax.swing.plaf.basic.BasicCheckBoxUI

CheckboxUI implementation for BasicCheckboxUI

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

CheckboxUI implementation for BasicCheckboxUI

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicColorChooserUI

Provides the basic look and feel for a JColorChooser.

Provides the basic look and feel for a JColorChooser.
raw docstring

javax.swing.plaf.basic.BasicComboBoxEditor

The default editor for editable combo boxes. The editor is implemented as a JTextField.

The default editor for editable combo boxes. The editor is implemented as a JTextField.
raw docstring

javax.swing.plaf.basic.BasicComboBoxEditor$UIResource

A subclass of BasicComboBoxEditor that implements UIResource. BasicComboBoxEditor doesn't implement UIResource directly so that applications can safely override the cellRenderer property with BasicListCellRenderer 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A subclass of BasicComboBoxEditor that implements UIResource.
BasicComboBoxEditor doesn't implement UIResource
directly so that applications can safely override the
cellRenderer property with BasicListCellRenderer 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicComboBoxRenderer

ComboBox renderer

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

ComboBox renderer

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicComboBoxRenderer$UIResource

A subclass of BasicComboBoxRenderer that implements UIResource. BasicComboBoxRenderer doesn't implement UIResource directly so that applications can safely override the cellRenderer property with BasicListCellRenderer 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A subclass of BasicComboBoxRenderer that implements UIResource.
BasicComboBoxRenderer doesn't implement UIResource
directly so that applications can safely override the
cellRenderer property with BasicListCellRenderer 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicComboBoxUI

Basic UI implementation for JComboBox.

The combo box is a compound component which means that it is an aggregate of many simpler components. This class creates and manages the listeners on the combo box and the combo box model. These listeners update the user interface in response to changes in the properties and state of the combo box.

All event handling is handled by listener classes created with the createxxxListener() methods and internal classes. You can change the behavior of this class by overriding the createxxxListener() methods and supplying your own event listeners or subclassing from the ones supplied in this class.

For adding specific actions, overide installKeyboardActions to add actions in response to KeyStroke bindings. See the article How to Use Key Bindings

Basic UI implementation for JComboBox.

The combo box is a compound component which means that it is an aggregate of
many simpler components. This class creates and manages the listeners
on the combo box and the combo box model. These listeners update the user
interface in response to changes in the properties and state of the combo box.

All event handling is handled by listener classes created with the
createxxxListener() methods and internal classes.
You can change the behavior of this class by overriding the
createxxxListener() methods and supplying your own
event listeners or subclassing from the ones supplied in this class.

For adding specific actions,
overide installKeyboardActions to add actions in response to
KeyStroke bindings. See the article How to Use Key Bindings
raw docstring

javax.swing.plaf.basic.BasicComboPopup

This is a basic implementation of the ComboPopup interface.

This class represents the ui for the popup portion of the combo box.

All event handling is handled by listener classes created with the createxxxListener() methods and internal classes. You can change the behavior of this class by overriding the createxxxListener() methods and supplying your own event listeners or subclassing from the ones supplied in this 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

This is a basic implementation of the ComboPopup interface.

This class represents the ui for the popup portion of the combo box.

All event handling is handled by listener classes created with the
createxxxListener() methods and internal classes.
You can change the behavior of this class by overriding the
createxxxListener() methods and supplying your own
event listeners or subclassing from the ones supplied in this 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicEditorPaneUI

Provides the look and feel for a JEditorPane.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Provides the look and feel for a JEditorPane.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicFormattedTextFieldUI

Provides the look and feel implementation for JFormattedTextField.

Provides the look and feel implementation for
JFormattedTextField.
raw docstring

javax.swing.plaf.basic.BasicHTML

Support for providing html views for the swing components. This translates a simple html string to a javax.swing.text.View implementation that can render the html and provide the necessary layout semantics.

Support for providing html views for the swing components.
This translates a simple html string to a javax.swing.text.View
implementation that can render the html and provide the necessary
layout semantics.
raw docstring

javax.swing.plaf.basic.BasicIconFactory

Factory object that can vend Icons appropriate for the basic L & F.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Factory object that can vend Icons appropriate for the basic L & F.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicInternalFrameTitlePane

The class that manages a basic title bar

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The class that manages a basic title bar

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicLabelUI

A Windows L&F implementation of LabelUI. This implementation is completely static, i.e. there's only one UIView implementation that's shared by all JLabel objects.

A Windows L&F implementation of LabelUI.  This implementation
is completely static, i.e. there's only one UIView implementation
that's shared by all JLabel objects.
raw docstring

javax.swing.plaf.basic.BasicListUI

An extensible implementation of ListUI.

BasicListUI instances cannot be shared between multiple lists.

An extensible implementation of ListUI.

BasicListUI instances cannot be shared between multiple
lists.
raw docstring

javax.swing.plaf.basic.BasicLookAndFeel

A base class to use in creating a look and feel for Swing.

Each of the ComponentUIs provided by BasicLookAndFeel derives its behavior from the defaults table. Unless otherwise noted each of the ComponentUI implementations in this package document the set of defaults they use. Unless otherwise noted the defaults are installed at the time installUI is invoked, and follow the recommendations outlined in LookAndFeel for installing defaults.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A base class to use in creating a look and feel for Swing.

Each of the ComponentUIs provided by BasicLookAndFeel derives its behavior from the defaults
table. Unless otherwise noted each of the ComponentUI
implementations in this package document the set of defaults they
use. Unless otherwise noted the defaults are installed at the time
installUI is invoked, and follow the recommendations
outlined in LookAndFeel for installing defaults.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicMenuBarUI

A default L&F implementation of MenuBarUI. This implementation is a "combined" view/controller.

A default L&F implementation of MenuBarUI.  This implementation
is a "combined" view/controller.
raw docstring

javax.swing.plaf.basic.BasicMenuUI

A default L&F implementation of MenuUI. This implementation is a "combined" view/controller.

A default L&F implementation of MenuUI.  This implementation
is a "combined" view/controller.
raw docstring

javax.swing.plaf.basic.BasicOptionPaneUI

Provides the basic look and feel for a JOptionPane. BasicMessagePaneUI provides a means to place an icon, message and buttons into a Container. Generally, the layout will look like:

   ------------------
   | i | message    |
   | c | message    |
   | o | message    |
   | n | message    |
   ------------------
   |     buttons    |
   |________________|

icon is an instance of Icon that is wrapped inside a JLabel. The message is an opaque object and is tested for the following: if the message is a Component it is added to the Container, if it is an Icon it is wrapped inside a JLabel and added to the Container otherwise it is wrapped inside a JLabel.

The above layout is used when the option pane's ComponentOrientation property is horizontal, left-to-right. The layout will be adjusted appropriately for other orientations.

The Container, message, icon, and buttons are all determined from abstract methods.

Provides the basic look and feel for a JOptionPane.
BasicMessagePaneUI provides a means to place an icon,
message and buttons into a Container.
Generally, the layout will look like:


       ------------------
       | i | message    |
       | c | message    |
       | o | message    |
       | n | message    |
       ------------------
       |     buttons    |
       |________________|
icon is an instance of Icon that is wrapped inside a
JLabel.  The message is an opaque object and is tested
for the following: if the message is a Component it is
added to the Container, if it is an Icon
it is wrapped inside a JLabel and added to the
Container otherwise it is wrapped inside a JLabel.

The above layout is used when the option pane's
ComponentOrientation property is horizontal, left-to-right.
The layout will be adjusted appropriately for other orientations.

The Container, message, icon, and buttons are all
determined from abstract methods.
raw docstring

javax.swing.plaf.basic.BasicOptionPaneUI$ButtonAreaLayout

ButtonAreaLayout behaves in a similar manner to FlowLayout. It lays out all components from left to right. If syncAllWidths is true, the widths of each component will be set to the largest preferred size width.

This class should be treated as a "protected" inner class. Instantiate it only within subclasses of BasicOptionPaneUI.

ButtonAreaLayout behaves in a similar manner to
FlowLayout. It lays out all components from left to
right. If syncAllWidths is true, the widths of each
component will be set to the largest preferred size width.

This class should be treated as a "protected" inner class.
Instantiate it only within subclasses of BasicOptionPaneUI.
raw docstring

javax.swing.plaf.basic.BasicPasswordFieldUI

Provides the Windows look and feel for a password field. The only difference from the standard text field is that the view of the text is simply a string of the echo character as specified in JPasswordField, rather than the real text contained in the field.

Provides the Windows look and feel for a password field.
The only difference from the standard text field is that
the view of the text is simply a string of the echo
character as specified in JPasswordField, rather than the
real text contained in the field.
raw docstring

javax.swing.plaf.basic.BasicPopupMenuSeparatorUI

A Basic L&F implementation of PopupMenuSeparatorUI. This implementation is a "combined" view/controller.

A Basic L&F implementation of PopupMenuSeparatorUI.  This implementation
is a "combined" view/controller.
raw docstring

javax.swing.plaf.basic.BasicPopupMenuUI

A Windows L&F implementation of PopupMenuUI. This implementation is a "combined" view/controller.

A Windows L&F implementation of PopupMenuUI.  This implementation
is a "combined" view/controller.
raw docstring

javax.swing.plaf.basic.BasicRadioButtonUI

RadioButtonUI implementation for BasicRadioButtonUI

RadioButtonUI implementation for BasicRadioButtonUI
raw docstring

javax.swing.plaf.basic.BasicRootPaneUI

Basic implementation of RootPaneUI, there is one shared between all JRootPane instances.

Basic implementation of RootPaneUI, there is one shared between all
JRootPane instances.
raw docstring

javax.swing.plaf.basic.BasicSeparatorUI

A Basic L&F implementation of SeparatorUI. This implementation is a "combined" view/controller.

A Basic L&F implementation of SeparatorUI.  This implementation
is a "combined" view/controller.
raw docstring

javax.swing.plaf.basic.BasicSplitPaneDivider

Divider used by BasicSplitPaneUI. Subclassers may wish to override paint to do something more interesting. The border effect is drawn in BasicSplitPaneUI, so if you don't like that border, reset it there. To conditionally drag from certain areas subclass mousePressed and call super when you wish the dragging to begin.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Divider used by BasicSplitPaneUI. Subclassers may wish to override
paint to do something more interesting.
The border effect is drawn in BasicSplitPaneUI, so if you don't like
that border, reset it there.
To conditionally drag from certain areas subclass mousePressed and
call super when you wish the dragging to begin.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicTextAreaUI

Provides the look and feel for a plain text editor. In this implementation the default UI is extended to act as a simple view factory.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Provides the look and feel for a plain text editor.  In this
implementation the default UI is extended to act as a simple
view factory.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicTextFieldUI

Basis of a look and feel for a JTextField.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Basis of a look and feel for a JTextField.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicTextPaneUI

Provides the look and feel for a styled text editor.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Provides the look and feel for a styled text editor.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicTextUI

Basis of a text components look-and-feel. This provides the basic editor view and controller services that may be useful when creating a look-and-feel for an extension of JTextComponent.

Most state is held in the associated JTextComponent as bound properties, and the UI installs default values for the various properties. This default will install something for all of the properties. Typically, a LAF implementation will do more however. At a minimum, a LAF would generally install key bindings.

This class also provides some concurrency support if the Document associated with the JTextComponent is a subclass of AbstractDocument. Access to the View (or View hierarchy) is serialized between any thread mutating the model and the Swing event thread (which is expected to render, do model/view coordinate translation, etc). Any access to the root view should first acquire a read-lock on the AbstractDocument and release that lock in a finally block.

An important method to define is the getPropertyPrefix() method which is used as the basis of the keys used to fetch defaults from the UIManager. The string should reflect the type of TextUI (eg. TextField, TextArea, etc) without the particular LAF part of the name (eg Metal, Motif, etc).

To build a view of the model, one of the following strategies can be employed.

One strategy is to simply redefine the ViewFactory interface in the UI. By default, this UI itself acts as the factory for View implementations. This is useful for simple factories. To do this reimplement the create(javax.swing.text.Element) method.

A common strategy for creating more complex types of documents is to have the EditorKit implementation return a factory. Since the EditorKit ties all of the pieces necessary to maintain a type of document, the factory is typically an important part of that and should be produced by the EditorKit 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

 Basis of a text components look-and-feel.  This provides the
basic editor view and controller services that may be useful
when creating a look-and-feel for an extension of
JTextComponent.

Most state is held in the associated JTextComponent
as bound properties, and the UI installs default values for the
various properties.  This default will install something for
all of the properties.  Typically, a LAF implementation will
do more however.  At a minimum, a LAF would generally install
key bindings.

This class also provides some concurrency support if the
Document associated with the JTextComponent is a subclass of
AbstractDocument.  Access to the View (or View hierarchy) is
serialized between any thread mutating the model and the Swing
event thread (which is expected to render, do model/view coordinate
translation, etc).  Any access to the root view should first
acquire a read-lock on the AbstractDocument and release that lock
in a finally block.

An important method to define is the getPropertyPrefix() method
which is used as the basis of the keys used to fetch defaults
from the UIManager.  The string should reflect the type of
TextUI (eg. TextField, TextArea, etc) without the particular
LAF part of the name (eg Metal, Motif, etc).

To build a view of the model, one of the following strategies
can be employed.


One strategy is to simply redefine the
ViewFactory interface in the UI.  By default, this UI itself acts
as the factory for View implementations.  This is useful
for simple factories.  To do this reimplement the
create(javax.swing.text.Element) method.

A common strategy for creating more complex types of documents
is to have the EditorKit implementation return a factory.  Since
the EditorKit ties all of the pieces necessary to maintain a type
of document, the factory is typically an important part of that
and should be produced by the EditorKit 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.BasicToggleButtonUI

BasicToggleButton implementation

BasicToggleButton implementation
raw docstring

javax.swing.plaf.basic.BasicToolBarSeparatorUI

A Basic L&F implementation of ToolBarSeparatorUI. This implementation is a "combined" view/controller.

A Basic L&F implementation of ToolBarSeparatorUI.  This implementation
is a "combined" view/controller.
raw docstring

javax.swing.plaf.basic.BasicToolBarUI

A Basic L&F implementation of ToolBarUI. This implementation is a "combined" view/controller.

A Basic L&F implementation of ToolBarUI.  This implementation
is a "combined" view/controller.
raw docstring

javax.swing.plaf.basic.ComboPopup

The interface which defines the methods required for the implementation of the popup portion of a combo box.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The interface which defines the methods required for the implementation of the popup
portion of a combo box.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.basic.core

No vars found in this namespace.

javax.swing.plaf.basic.DefaultMenuLayout

The default layout manager for Popup menus and menubars. This class is an extension of BoxLayout which adds the UIResource tag so that pluggable L&Fs can distinguish it from user-installed layout managers on menus.

The default layout manager for Popup menus and menubars.  This
class is an extension of BoxLayout which adds the UIResource tag
so that pluggable L&Fs can distinguish it from user-installed
layout managers on menus.
raw docstring

javax.swing.plaf.ButtonUI

Pluggable look and feel interface for JButton.

Pluggable look and feel interface for JButton.
raw docstring

javax.swing.plaf.ColorChooserUI

Pluggable look and feel interface for JColorChooser.

Pluggable look and feel interface for JColorChooser.
raw docstring

javax.swing.plaf.ComboBoxUI

Pluggable look and feel interface for JComboBox.

Pluggable look and feel interface for JComboBox.
raw docstring

javax.swing.plaf.ComponentInputMapUIResource

A subclass of javax.swing.ComponentInputMap that implements UIResource. UI classes which provide a ComponentInputMap should use this class.

A subclass of javax.swing.ComponentInputMap that implements UIResource.
UI classes which provide a ComponentInputMap should use this class.
raw docstring

javax.swing.plaf.ComponentUI

The base class for all UI delegate objects in the Swing pluggable look and feel architecture. The UI delegate object for a Swing component is responsible for implementing the aspects of the component that depend on the look and feel. The JComponent class invokes methods from this class in order to delegate operations (painting, layout calculations, etc.) that may vary depending on the look and feel installed. Client programs should not invoke methods on this class directly.

The base class for all UI delegate objects in the Swing pluggable
look and feel architecture.  The UI delegate object for a Swing
component is responsible for implementing the aspects of the
component that depend on the look and feel.
The JComponent class
invokes methods from this class in order to delegate operations
(painting, layout calculations, etc.) that may vary depending on the
look and feel installed.  Client programs should not invoke methods
on this class directly.
raw docstring

javax.swing.plaf.core

No vars found in this namespace.

javax.swing.plaf.DesktopIconUI

Pluggable look and feel interface for JDesktopIcon.

Pluggable look and feel interface for JDesktopIcon.
raw docstring

javax.swing.plaf.DesktopPaneUI

Pluggable look and feel interface for JDesktopPane.

Pluggable look and feel interface for JDesktopPane.
raw docstring

javax.swing.plaf.FontUIResource

A subclass of java.awt.Font that implements UIResource. UI classes which set default font properties should use this 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A subclass of java.awt.Font that implements UIResource.
UI classes which set default font properties should use
this 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.IconUIResource

An Icon wrapper class which implements UIResource. UI classes which set icon properties should use this class to wrap any icons specified as defaults.

This class delegates all method invocations to the Icon "delegate" object specified at construction.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An Icon wrapper class which implements UIResource.  UI
classes which set icon properties should use this class
to wrap any icons specified as defaults.

This class delegates all method invocations to the
Icon "delegate" object specified at construction.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.InputMapUIResource

A subclass of javax.swing.InputMap that implements UIResource. UI classes which provide a InputMap should use this class.

A subclass of javax.swing.InputMap that implements UIResource.
UI classes which provide a InputMap should use this class.
raw docstring

javax.swing.plaf.InternalFrameUI

Pluggable look and feel interface for JInternalFrame.

Pluggable look and feel interface for JInternalFrame.
raw docstring

javax.swing.plaf.LabelUI

Pluggable look and feel interface for JLabel.

Pluggable look and feel interface for JLabel.
raw docstring

javax.swing.plaf.LayerUI

The base class for all JLayer's UI delegates.

paint(java.awt.Graphics, javax.swing.JComponent) method performs the painting of the JLayer and eventDispatched(AWTEvent, JLayer) method is notified about any AWTEvents which have been generated by a JLayer or any of its subcomponents.

The LayerUI differs from the UI delegates of the other components, because it is LookAndFeel independent and is not updated by default when the system LookAndFeel is changed.

The subclasses of LayerUI can either be stateless and shareable by multiple JLayers or not shareable.

The base class for all JLayer's UI delegates.

paint(java.awt.Graphics, javax.swing.JComponent) method performs the
painting of the JLayer
and eventDispatched(AWTEvent, JLayer) method is notified
about any AWTEvents which have been generated by a JLayer
or any of its subcomponents.

The LayerUI differs from the UI delegates of the other components,
because it is LookAndFeel independent and is not updated by default when
the system LookAndFeel is changed.

The subclasses of LayerUI can either be stateless and shareable
by multiple JLayers or not shareable.
raw docstring

javax.swing.plaf.ListUI

The JList pluggable look and feel delegate.

The JList pluggable look and feel delegate.
raw docstring

javax.swing.plaf.MenuBarUI

Pluggable look and feel interface for JMenuBar.

Pluggable look and feel interface for JMenuBar.
raw docstring

javax.swing.plaf.MenuItemUI

Pluggable look and feel interface for JMenuItem.

Pluggable look and feel interface for JMenuItem.
raw docstring

javax.swing.plaf.metal.core

No vars found in this namespace.

javax.swing.plaf.metal.DefaultMetalTheme

A concrete implementation of MetalTheme providing the original look of the Java Look and Feel, code-named "Steel". Refer to MetalLookAndFeel.setCurrentTheme(javax.swing.plaf.metal.MetalTheme) for details on changing the default theme.

All colors returned by DefaultMetalTheme are completely opaque.

Font Style

DefaultMetalTheme uses bold fonts for many controls. To make all controls (with the exception of the internal frame title bars and client decorated frame title bars) use plain fonts you can do either of the following:

Set the system property swing.boldMetal to false. For example, java -Dswing.boldMetal=false MyApp. Set the defaults property swing.boldMetal to Boolean.FALSE. For example: UIManager.put("swing.boldMetal", Boolean.FALSE);

The defaults property swing.boldMetal, if set, takes precedence over the system property of the same name. After setting this defaults property you need to re-install MetalLookAndFeel, as well as update the UI of any previously created widgets. Otherwise the results are undefined. The following illustrates how to do this:

// turn off bold fonts UIManager.put("swing.boldMetal", Boolean.FALSE);

// re-install the Metal Look and Feel UIManager.setLookAndFeel(new MetalLookAndFeel());

// Update the ComponentUIs for all Components. This // needs to be invoked for all windows. SwingUtilities.updateComponentTreeUI(rootComponent);

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A concrete implementation of MetalTheme providing
the original look of the Java Look and Feel, code-named "Steel". Refer
to MetalLookAndFeel.setCurrentTheme(javax.swing.plaf.metal.MetalTheme) for details on changing
the default theme.

All colors returned by DefaultMetalTheme are completely
opaque.

Font Style

DefaultMetalTheme uses bold fonts for many controls.  To make all
controls (with the exception of the internal frame title bars and
client decorated frame title bars) use plain fonts you can do either of
the following:

Set the system property swing.boldMetal to
    false.  For example,
    java -Dswing.boldMetal=false MyApp.
Set the defaults property swing.boldMetal to
    Boolean.FALSE.  For example:
    UIManager.put("swing.boldMetal", Boolean.FALSE);

The defaults property swing.boldMetal, if set,
takes precedence over the system property of the same name. After
setting this defaults property you need to re-install
MetalLookAndFeel, as well as update the UI
of any previously created widgets. Otherwise the results are undefined.
The following illustrates how to do this:


  // turn off bold fonts
  UIManager.put("swing.boldMetal", Boolean.FALSE);

  // re-install the Metal Look and Feel
  UIManager.setLookAndFeel(new MetalLookAndFeel());

  // Update the ComponentUIs for all Components. This
  // needs to be invoked for all windows.
  SwingUtilities.updateComponentTreeUI(rootComponent);

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalBorders

Factory object that can vend Borders appropriate for the metal L & F.

Factory object that can vend Borders appropriate for the metal L & F.
raw docstring

javax.swing.plaf.metal.MetalButtonUI

MetalButtonUI 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

MetalButtonUI 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalCheckBoxIcon

CheckboxIcon implementation for OrganicCheckBoxUI

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

CheckboxIcon implementation for OrganicCheckBoxUI

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalCheckBoxUI

CheckboxUI implementation for MetalCheckboxUI

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

CheckboxUI implementation for MetalCheckboxUI

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalComboBoxButton

JButton subclass to help out MetalComboBoxUI

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

JButton subclass to help out MetalComboBoxUI

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalComboBoxEditor

The default editor for Metal editable combo boxes

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The default editor for Metal editable combo boxes

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalComboBoxEditor$UIResource

A subclass of BasicComboBoxEditor that implements UIResource. BasicComboBoxEditor doesn't implement UIResource directly so that applications can safely override the cellRenderer property with BasicListCellRenderer 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A subclass of BasicComboBoxEditor that implements UIResource.
BasicComboBoxEditor doesn't implement UIResource
directly so that applications can safely override the
cellRenderer property with BasicListCellRenderer 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalComboBoxIcon

This utility class draws the horizontal bars which indicate a MetalComboBox

This utility class draws the horizontal bars which indicate a MetalComboBox
raw docstring

javax.swing.plaf.metal.MetalComboBoxUI

Metal UI for JComboBox

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Metal UI for JComboBox

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalIconFactory

Factory object that vends Icons for the Java™ look and feel (Metal). These icons are used extensively in Metal via the defaults mechanism. While other look and feels often use GIFs for icons, creating icons in code facilitates switching to other themes.

Each method in this class returns either an Icon or null, where null implies that there is no default icon.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Factory object that vends Icons for
the Java™ look and feel (Metal).
These icons are used extensively in Metal via the defaults mechanism.
While other look and feels often use GIFs for icons, creating icons
in code facilitates switching to other themes.


Each method in this class returns
either an Icon or null,
where null implies that there is no default icon.


Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalIconFactory$FileIcon16

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

 Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalIconFactory$FolderIcon16

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

 Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalIconFactory$TreeControlIcon

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

 Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalIconFactory$TreeFolderIcon

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

 Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalLabelUI

A Windows L&F implementation of LabelUI. This implementation is completely static, i.e. there's only one UIView implementation that's shared by all JLabel objects.

A Windows L&F implementation of LabelUI.  This implementation
is completely static, i.e. there's only one UIView implementation
that's shared by all JLabel objects.
raw docstring

javax.swing.plaf.metal.MetalLookAndFeel

The Java Look and Feel, otherwise known as Metal.

Each of the ComponentUIs provided by MetalLookAndFeel derives its behavior from the defaults table. Unless otherwise noted each of the ComponentUI implementations in this package document the set of defaults they use. Unless otherwise noted the defaults are installed at the time installUI is invoked, and follow the recommendations outlined in LookAndFeel for installing defaults.

MetalLookAndFeel derives it's color palette and fonts from MetalTheme. The default theme is OceanTheme. The theme can be changed using the setCurrentTheme method, refer to it for details on changing the theme. Prior to 1.5 the default theme was DefaultMetalTheme. The system property "swing.metalTheme" can be set to "steel" to indicate the default should be DefaultMetalTheme.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The Java Look and Feel, otherwise known as Metal.

Each of the ComponentUIs provided by MetalLookAndFeel derives its behavior from the defaults
table. Unless otherwise noted each of the ComponentUI
implementations in this package document the set of defaults they
use. Unless otherwise noted the defaults are installed at the time
installUI is invoked, and follow the recommendations
outlined in LookAndFeel for installing defaults.

MetalLookAndFeel derives it's color palette and fonts from
MetalTheme. The default theme is OceanTheme. The theme
can be changed using the setCurrentTheme method, refer to it
for details on changing the theme. Prior to 1.5 the default
theme was DefaultMetalTheme. The system property
"swing.metalTheme" can be set to "steel" to indicate
the default should be DefaultMetalTheme.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalMenuBarUI

Metal implementation of MenuBarUI. This class is responsible for providing the metal look and feel for JMenuBars.

Metal implementation of MenuBarUI. This class is responsible
for providing the metal look and feel for JMenuBars.
raw docstring

javax.swing.plaf.metal.MetalPopupMenuSeparatorUI

A Metal L&F implementation of PopupMenuSeparatorUI. This implementation is a "combined" view/controller.

A Metal L&F implementation of PopupMenuSeparatorUI.  This implementation
is a "combined" view/controller.
raw docstring

javax.swing.plaf.metal.MetalProgressBarUI

The Metal implementation of ProgressBarUI.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The Metal implementation of ProgressBarUI.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalRadioButtonUI

RadioButtonUI implementation for MetalRadioButtonUI

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

RadioButtonUI implementation for MetalRadioButtonUI

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalRootPaneUI

Provides the metal look and feel implementation of RootPaneUI.

MetalRootPaneUI provides support for the windowDecorationStyle property of JRootPane. MetalRootPaneUI does this by way of installing a custom LayoutManager, a private Component to render the appropriate widgets, and a private Border. The LayoutManager is always installed, regardless of the value of the windowDecorationStyle property, but the Border and Component are only installed/added if the windowDecorationStyle is other than JRootPane.NONE.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Provides the metal look and feel implementation of RootPaneUI.

MetalRootPaneUI provides support for the
windowDecorationStyle property of JRootPane.
MetalRootPaneUI does this by way of installing a custom
LayoutManager, a private Component to render
the appropriate widgets, and a private Border. The
LayoutManager is always installed, regardless of the value of
the windowDecorationStyle property, but the
Border and Component are only installed/added if
the windowDecorationStyle is other than
JRootPane.NONE.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalScrollBarUI

Implementation of ScrollBarUI for the Metal Look and Feel

Implementation of ScrollBarUI for the Metal Look and Feel
raw docstring

javax.swing.plaf.metal.MetalScrollButton

JButton object for Metal scrollbar arrows.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

JButton object for Metal scrollbar arrows.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalScrollPaneUI

A Metal L&F implementation of ScrollPaneUI.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A Metal L&F implementation of ScrollPaneUI.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalSeparatorUI

A Metal L&F implementation of SeparatorUI. This implementation is a "combined" view/controller.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A Metal L&F implementation of SeparatorUI.  This implementation
is a "combined" view/controller.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalSliderUI

A Java L&F implementation of SliderUI.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A Java L&F implementation of SliderUI.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalSplitPaneUI

Metal split pane.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Metal split pane.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalTabbedPaneUI

The Metal subclass of BasicTabbedPaneUI.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The Metal subclass of BasicTabbedPaneUI.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalTextFieldUI

Basis of a look and feel for a JTextField.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Basis of a look and feel for a JTextField.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalTheme

MetalTheme provides the color palette and fonts used by the Java Look and Feel.

MetalTheme is abstract, see DefaultMetalTheme and OceanTheme for concrete implementations.

MetalLookAndFeel maintains the current theme that the the ComponentUI implementations for metal use. Refer to MetalLookAndFeel.setCurrentTheme(MetalTheme) for details on changing the current theme.

MetalTheme provides a number of public methods for getting colors. These methods are implemented in terms of a handful of protected abstract methods. A subclass need only override the protected abstract methods (getPrimary1, getPrimary2, getPrimary3, getSecondary1, getSecondary2, and getSecondary3); although a subclass may override the other public methods for more control over the set of colors that are used.

Concrete implementations of MetalTheme must return non-null values from all methods. While the behavior of returning null is not specified, returning null will result in incorrect behavior.

It is strongly recommended that subclasses return completely opaque colors. To do otherwise may result in rendering problems, such as visual garbage.

MetalTheme provides the color palette and fonts used by
the Java Look and Feel.

MetalTheme is abstract, see DefaultMetalTheme and
OceanTheme for concrete implementations.

MetalLookAndFeel maintains the current theme that the
the ComponentUI implementations for metal use. Refer to
MetalLookAndFeel.setCurrentTheme(MetalTheme) for details on changing
the current theme.

MetalTheme provides a number of public methods for getting
colors. These methods are implemented in terms of a
handful of protected abstract methods. A subclass need only override
the protected abstract methods (getPrimary1,
getPrimary2, getPrimary3, getSecondary1,
getSecondary2, and getSecondary3); although a subclass
may override the other public methods for more control over the set of
colors that are used.

Concrete implementations of MetalTheme must return non-null
values from all methods. While the behavior of returning null is
not specified, returning null will result in incorrect behavior.

It is strongly recommended that subclasses return completely opaque colors.
To do otherwise may result in rendering problems, such as visual garbage.
raw docstring

javax.swing.plaf.metal.MetalToggleButtonUI

MetalToggleButton 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

MetalToggleButton 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalToolBarUI

A Metal Look and Feel implementation of ToolBarUI. This implementation is a "combined" view/controller.

A Metal Look and Feel implementation of ToolBarUI.  This implementation
is a "combined" view/controller.
raw docstring

javax.swing.plaf.metal.MetalToolTipUI

A Metal L&F extension of BasicToolTipUI.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A Metal L&F extension of BasicToolTipUI.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.metal.MetalTreeUI

The metal look and feel implementation of TreeUI.

MetalTreeUI allows for configuring how to visually render the spacing and delineation between nodes. The following hints are supported:

Angled A line is drawn connecting the child to the parent. For handling of the root node refer to JTree.setRootVisible(boolean) and JTree.setShowsRootHandles(boolean).

Horizontal
A horizontal line is drawn dividing the children of the root node.


 None
 Do not draw any visual indication between nodes.

As it is typically impractical to obtain the TreeUI from the JTree and cast to an instance of MetalTreeUI you enable this property via the client property JTree.lineStyle. For example, to switch to Horizontal style you would do: tree.putClientProperty("JTree.lineStyle", "Horizontal");

The default is Angled.

The metal look and feel implementation of TreeUI.

MetalTreeUI allows for configuring how to
visually render the spacing and delineation between nodes. The following
hints are supported:



   Angled
   A line is drawn connecting the child to the parent. For handling
         of the root node refer to
         JTree.setRootVisible(boolean) and
         JTree.setShowsRootHandles(boolean).



    Horizontal
    A horizontal line is drawn dividing the children of the root node.


     None
     Do not draw any visual indication between nodes.




As it is typically impractical to obtain the TreeUI from
the JTree and cast to an instance of MetalTreeUI
you enable this property via the client property
JTree.lineStyle. For example, to switch to
Horizontal style you would do:
tree.putClientProperty("JTree.lineStyle", "Horizontal");

The default is Angled.
raw docstring

javax.swing.plaf.metal.OceanTheme

The default theme for the MetalLookAndFeel.

The designers of the Metal Look and Feel strive to keep the default look up to date, possibly through the use of new themes in the future. Therefore, developers should only use this class directly when they wish to customize the "Ocean" look, or force it to be the current theme, regardless of future updates.

All colors returned by OceanTheme are completely opaque.

The default theme for the MetalLookAndFeel.

The designers
of the Metal Look and Feel strive to keep the default look up to
date, possibly through the use of new themes in the future.
Therefore, developers should only use this class directly when they
wish to customize the "Ocean" look, or force it to be the current
theme, regardless of future updates.


All colors returned by OceanTheme are completely
opaque.
raw docstring

javax.swing.plaf.multi.core

No vars found in this namespace.

javax.swing.plaf.multi.MultiButtonUI

A multiplexing UI used to combine ButtonUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine ButtonUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiColorChooserUI

A multiplexing UI used to combine ColorChooserUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine ColorChooserUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiComboBoxUI

A multiplexing UI used to combine ComboBoxUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine ComboBoxUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiDesktopIconUI

A multiplexing UI used to combine DesktopIconUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine DesktopIconUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiDesktopPaneUI

A multiplexing UI used to combine DesktopPaneUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine DesktopPaneUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiInternalFrameUI

A multiplexing UI used to combine InternalFrameUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine InternalFrameUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiLabelUI

A multiplexing UI used to combine LabelUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine LabelUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiListUI

A multiplexing UI used to combine ListUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine ListUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiLookAndFeel

A multiplexing look and feel that allows more than one UI to be associated with a component at the same time. The primary look and feel is called the default look and feel, and the other look and feels are called auxiliary.

For further information, see Using the Multiplexing Look and Feel.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A multiplexing look and feel that allows more than one UI
to be associated with a component at the same time.
The primary look and feel is called
the default look and feel,
and the other look and feels are called auxiliary.


For further information, see
Using the
Multiplexing Look and Feel.


Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.multi.MultiMenuBarUI

A multiplexing UI used to combine MenuBarUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine MenuBarUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiMenuItemUI

A multiplexing UI used to combine MenuItemUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine MenuItemUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiOptionPaneUI

A multiplexing UI used to combine OptionPaneUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine OptionPaneUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiPanelUI

A multiplexing UI used to combine PanelUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine PanelUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiPopupMenuUI

A multiplexing UI used to combine PopupMenuUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine PopupMenuUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiProgressBarUI

A multiplexing UI used to combine ProgressBarUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine ProgressBarUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiRootPaneUI

A multiplexing UI used to combine RootPaneUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine RootPaneUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiScrollBarUI

A multiplexing UI used to combine ScrollBarUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine ScrollBarUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiScrollPaneUI

A multiplexing UI used to combine ScrollPaneUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine ScrollPaneUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiSeparatorUI

A multiplexing UI used to combine SeparatorUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine SeparatorUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiSliderUI

A multiplexing UI used to combine SliderUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine SliderUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiSpinnerUI

A multiplexing UI used to combine SpinnerUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine SpinnerUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiTabbedPaneUI

A multiplexing UI used to combine TabbedPaneUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine TabbedPaneUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiTableHeaderUI

A multiplexing UI used to combine TableHeaderUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine TableHeaderUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiTableUI

A multiplexing UI used to combine TableUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine TableUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiToolBarUI

A multiplexing UI used to combine ToolBarUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine ToolBarUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiToolTipUI

A multiplexing UI used to combine ToolTipUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine ToolTipUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.multi.MultiViewportUI

A multiplexing UI used to combine ViewportUIs.

This file was automatically generated by AutoMulti.

A multiplexing UI used to combine ViewportUIs.

This file was automatically generated by AutoMulti.
raw docstring

javax.swing.plaf.nimbus.AbstractRegionPainter

Convenient base class for defining Painter instances for rendering a region or component in Nimbus.

Convenient base class for defining Painter instances for rendering a
region or component in Nimbus.
raw docstring

javax.swing.plaf.nimbus.AbstractRegionPainter$PaintContext

A class encapsulating state useful when painting. Generally, instances of this class are created once, and reused for each paint request without modification. This class contains values useful when hinting the cache engine, and when decoding control points and bezier curve anchors.

A class encapsulating state useful when painting. Generally, instances of this
class are created once, and reused for each paint request without modification.
This class contains values useful when hinting the cache engine, and when decoding
control points and bezier curve anchors.
raw docstring

javax.swing.plaf.nimbus.core

No vars found in this namespace.

javax.swing.plaf.nimbus.NimbusStyle

A SynthStyle implementation used by Nimbus. Each Region that has been registered with the NimbusLookAndFeel will have an associated NimbusStyle. Third party components that are registered with the NimbusLookAndFeel will therefore be handed a NimbusStyle from the look and feel from the #getStyle(JComponent, Region) method.

This class properly reads and retrieves values placed in the UIDefaults according to the standard Nimbus naming conventions. It will create and retrieve painters, fonts, colors, and other data stored there.

NimbusStyle also supports the ability to override settings on a per component basis. NimbusStyle checks the component's client property map for "Nimbus.Overrides". If the value associated with this key is an instance of UIDefaults, then the values in that defaults table will override the standard Nimbus defaults in UIManager, but for that component instance only.

Optionally, you may specify the client property "Nimbus.Overrides.InheritDefaults". If true, this client property indicates that the defaults located in UIManager should first be read, and then replaced with defaults located in the component client properties. If false, then only the defaults located in the component client property map will be used. If not specified, it is assumed to be true.

You must specify "Nimbus.Overrides" for "Nimbus.Overrides.InheritDefaults" to have any effect. "Nimbus.Overrides" indicates whether there are any overrides, while "Nimbus.Overrides.InheritDefaults" indicates whether those overrides should first be initialized with the defaults from UIManager.

The NimbusStyle is reloaded whenever a property change event is fired for a component for "Nimbus.Overrides" or "Nimbus.Overrides.InheritDefaults". So for example, setting a new UIDefaults on a component would cause the style to be reloaded.

The values are only read out of UIManager once, and then cached. If you need to read the values again (for example, if the UI is being reloaded), then discard this NimbusStyle and read a new one from NimbusLookAndFeel using NimbusLookAndFeel.getStyle.

The primary API of interest in this class for 3rd party component authors are the three methods which retrieve painters: #getBackgroundPainter, #getForegroundPainter, and #getBorderPainter.

NimbusStyle allows you to specify custom states, or modify the order of states. Synth (and thus Nimbus) has the concept of a "state". For example, a JButton might be in the "MOUSE_OVER" state, or the "ENABLED" state, or the "DISABLED" state. These are all "standard" states which are defined in synth, and which apply to all synth Regions.

Sometimes, however, you need to have a custom state. For example, you want JButton to render differently if it's parent is a JToolbar. In Nimbus, you specify these custom states by including a special key in UIDefaults. The following UIDefaults entries define three states for this button:

JButton.States = Enabled, Disabled, Toolbar
JButton[Enabled].backgroundPainter = somePainter
JButton[Disabled].background = BLUE
JButton[Toolbar].backgroundPainter = someOtherPaint

As you can see, the JButton.States entry lists the states that the JButton style will support. You then specify the settings for each state. If you do not specify the JButton.States entry, then the standard Synth states will be assumed. If you specify the entry but the list of states is empty or null, then the standard synth states will be assumed.

A SynthStyle implementation used by Nimbus. Each Region that has been
registered with the NimbusLookAndFeel will have an associated NimbusStyle.
Third party components that are registered with the NimbusLookAndFeel will
therefore be handed a NimbusStyle from the look and feel from the
#getStyle(JComponent, Region) method.

This class properly reads and retrieves values placed in the UIDefaults
according to the standard Nimbus naming conventions. It will create and
retrieve painters, fonts, colors, and other data stored there.

NimbusStyle also supports the ability to override settings on a per
component basis. NimbusStyle checks the component's client property map for
"Nimbus.Overrides". If the value associated with this key is an instance of
UIDefaults, then the values in that defaults table will override the standard
Nimbus defaults in UIManager, but for that component instance only.

Optionally, you may specify the client property
"Nimbus.Overrides.InheritDefaults". If true, this client property indicates
that the defaults located in UIManager should first be read, and then
replaced with defaults located in the component client properties. If false,
then only the defaults located in the component client property map will
be used. If not specified, it is assumed to be true.

You must specify "Nimbus.Overrides" for "Nimbus.Overrides.InheritDefaults"
to have any effect. "Nimbus.Overrides" indicates whether there are any
overrides, while "Nimbus.Overrides.InheritDefaults" indicates whether those
overrides should first be initialized with the defaults from UIManager.

The NimbusStyle is reloaded whenever a property change event is fired
for a component for "Nimbus.Overrides" or "Nimbus.Overrides.InheritDefaults".
So for example, setting a new UIDefaults on a component would cause the
style to be reloaded.

The values are only read out of UIManager once, and then cached. If
you need to read the values again (for example, if the UI is being reloaded),
then discard this NimbusStyle and read a new one from NimbusLookAndFeel
using NimbusLookAndFeel.getStyle.

The primary API of interest in this class for 3rd party component authors
are the three methods which retrieve painters: #getBackgroundPainter,
#getForegroundPainter, and #getBorderPainter.

NimbusStyle allows you to specify custom states, or modify the order of
states. Synth (and thus Nimbus) has the concept of a "state". For example,
a JButton might be in the "MOUSE_OVER" state, or the "ENABLED" state, or the
"DISABLED" state. These are all "standard" states which are defined in synth,
and which apply to all synth Regions.

Sometimes, however, you need to have a custom state. For example, you
want JButton to render differently if it's parent is a JToolbar. In Nimbus,
you specify these custom states by including a special key in UIDefaults.
The following UIDefaults entries define three states for this button:



    JButton.States = Enabled, Disabled, Toolbar
    JButton[Enabled].backgroundPainter = somePainter
    JButton[Disabled].background = BLUE
    JButton[Toolbar].backgroundPainter = someOtherPaint

As you can see, the JButton.States entry lists the states
that the JButton style will support. You then specify the settings for
each state. If you do not specify the JButton.States entry,
then the standard Synth states will be assumed. If you specify the entry
but the list of states is empty or null, then the standard synth states
will be assumed.
raw docstring

javax.swing.plaf.nimbus.State

Represents a built in, or custom, state in Nimbus.

Synth provides several built in states, which are:

Enabled Mouse Over Pressed Disabled Focused Selected Default

However, there are many more states that could be described in a LookAndFeel, and it would be nice to style components differently based on these different states. For example, a progress bar could be "indeterminate". It would be very convenient to allow this to be defined as a "state".

This class, State, is intended to be used for such situations. Simply implement the abstract #isInState method. It returns true if the given JComponent is "in this state", false otherwise. This method will be called many times in performance sensitive loops. It must execute very quickly.

For example, the following might be an implementation of a custom "Indeterminate" state for JProgressBars:

public final class IndeterminateState extends State<JProgressBar> {
    public IndeterminateState() {
        super("Indeterminate");
    }

    @Override
    protected boolean isInState(JProgressBar c) {
        return c.isIndeterminate();
    }
}
Represents a built in, or custom, state in Nimbus.

Synth provides several built in states, which are:

 Enabled
 Mouse Over
 Pressed
 Disabled
 Focused
 Selected
 Default


However, there are many more states that could be described in a LookAndFeel, and it
would be nice to style components differently based on these different states.
For example, a progress bar could be "indeterminate". It would be very convenient
to allow this to be defined as a "state".

This class, State, is intended to be used for such situations.
Simply implement the abstract #isInState method. It returns true if the given
JComponent is "in this state", false otherwise. This method will be called
many times in performance sensitive loops. It must execute
very quickly.

For example, the following might be an implementation of a custom
"Indeterminate" state for JProgressBars:



    public final class IndeterminateState extends State<JProgressBar> {
        public IndeterminateState() {
            super("Indeterminate");
        }

        @Override
        protected boolean isInState(JProgressBar c) {
            return c.isIndeterminate();
        }
    }
raw docstring

javax.swing.plaf.OptionPaneUI

Pluggable look and feel interface for JOptionPane.

Pluggable look and feel interface for JOptionPane.
raw docstring

javax.swing.plaf.PanelUI

Pluggable look and feel interface for Panel.

Pluggable look and feel interface for Panel.
raw docstring

javax.swing.plaf.PopupMenuUI

Pluggable look and feel interface for JPopupMenu.

Pluggable look and feel interface for JPopupMenu.
raw docstring

javax.swing.plaf.ProgressBarUI

Pluggable look and feel interface for JProgressBar.

Pluggable look and feel interface for JProgressBar.
raw docstring

javax.swing.plaf.RootPaneUI

Pluggable look and feel interface for JRootPane.

Pluggable look and feel interface for JRootPane.
raw docstring

javax.swing.plaf.ScrollBarUI

Pluggable look and feel interface for JScrollBar.

Pluggable look and feel interface for JScrollBar.
raw docstring

javax.swing.plaf.ScrollPaneUI

Pluggable look and feel interface for JScrollPane.

Pluggable look and feel interface for JScrollPane.
raw docstring

javax.swing.plaf.SeparatorUI

Pluggable look and feel interface for JSeparator.

Pluggable look and feel interface for JSeparator.
raw docstring

javax.swing.plaf.SliderUI

Pluggable look and feel interface for JSlider.

Pluggable look and feel interface for JSlider.
raw docstring

javax.swing.plaf.SpinnerUI

Pluggable look and feel interface for JSpinner

Pluggable look and feel interface for JSpinner
raw docstring

javax.swing.plaf.synth.ColorType

A typesafe enumeration of colors that can be fetched from a style.

Each SynthStyle has a set of ColorTypes that are accessed by way of the SynthStyle.getColor(SynthContext, ColorType) method. SynthStyle's installDefaults will install the FOREGROUND color as the foreground of the Component, and the BACKGROUND color to the background of the component (assuming that you have not explicitly specified a foreground and background color). Some components support more color based properties, for example JList has the property selectionForeground which will be mapped to FOREGROUND with a component state of SynthConstants.SELECTED.

The following example shows a custom SynthStyle that returns a red Color for the DISABLED state, otherwise a black color.

class MyStyle extends SynthStyle { private Color disabledColor = new ColorUIResource(Color.RED); private Color color = new ColorUIResource(Color.BLACK); protected Color getColorForState(SynthContext context, ColorType type){ if (context.getComponentState() == SynthConstants.DISABLED) { return disabledColor; } return color; } }

A typesafe enumeration of colors that can be fetched from a style.

Each SynthStyle has a set of ColorTypes that
are accessed by way of the
SynthStyle.getColor(SynthContext, ColorType) method.
SynthStyle's installDefaults will install
the FOREGROUND color
as the foreground of
the Component, and the BACKGROUND color to the background of
the component (assuming that you have not explicitly specified a
foreground and background color). Some components
support more color based properties, for
example JList has the property
selectionForeground which will be mapped to
FOREGROUND with a component state of
SynthConstants.SELECTED.

The following example shows a custom SynthStyle that returns
a red Color for the DISABLED state, otherwise a black color.


class MyStyle extends SynthStyle {
    private Color disabledColor = new ColorUIResource(Color.RED);
    private Color color = new ColorUIResource(Color.BLACK);
    protected Color getColorForState(SynthContext context, ColorType type){
        if (context.getComponentState() == SynthConstants.DISABLED) {
            return disabledColor;
        }
        return color;
    }
}
raw docstring

javax.swing.plaf.synth.core

No vars found in this namespace.

javax.swing.plaf.synth.Region

A distinct rendering area of a Swing component. A component may support one or more regions. Specific component regions are defined by the typesafe enumeration in this class.

Regions are typically used as a way to identify the Components and areas a particular style is to apply to. Synth's file format allows you to bind styles based on the name of a Region. The name is derived from the field name of the constant:

Map all characters to lowercase. Map the first character to uppercase. Map the first character after underscores to uppercase. Remove all underscores.

For example, to identify the SPLIT_PANE Region you would use SplitPane. The following shows a custom SynthStyleFactory that returns a specific style for split panes:

public SynthStyle getStyle(JComponent c, Region id) { if (id == Region.SPLIT_PANE) { return splitPaneStyle; } ... } The following xml accomplishes the same thing:

<style id="splitPaneStyle"> ... </style>

<bind style="splitPaneStyle" type="region" key="SplitPane"/>

A distinct rendering area of a Swing component.  A component may
support one or more regions.  Specific component regions are defined
by the typesafe enumeration in this class.

Regions are typically used as a way to identify the Components
and areas a particular style is to apply to. Synth's file format allows you
to bind styles based on the name of a Region.
The name is derived from the field name of the constant:

 Map all characters to lowercase.
 Map the first character to uppercase.
 Map the first character after underscores to uppercase.
 Remove all underscores.

For example, to identify the SPLIT_PANE
Region you would use SplitPane.
The following shows a custom SynthStyleFactory
that returns a specific style for split panes:


   public SynthStyle getStyle(JComponent c, Region id) {
       if (id == Region.SPLIT_PANE) {
           return splitPaneStyle;
       }
       ...
   }
The following xml
accomplishes the same thing:


<style id="splitPaneStyle">
  ...
</style>
<bind style="splitPaneStyle" type="region" key="SplitPane"/>
raw docstring

javax.swing.plaf.synth.SynthCheckBoxMenuItemUI

Provides the Synth L&F UI delegate for JCheckBoxMenuItem.

Provides the Synth L&F UI delegate for
JCheckBoxMenuItem.
raw docstring

javax.swing.plaf.synth.SynthCheckBoxUI

Provides the Synth L&F UI delegate for JCheckBox.

Provides the Synth L&F UI delegate for
JCheckBox.
raw docstring

javax.swing.plaf.synth.SynthColorChooserUI

Provides the Synth L&F UI delegate for JColorChooser.

Provides the Synth L&F UI delegate for
JColorChooser.
raw docstring

javax.swing.plaf.synth.SynthConstants

Constants used by Synth. Not all Components support all states. A Component will at least be in one of the primary states. That is, the return value from SynthContext.getComponentState() will at least be one of ENABLED, MOUSE_OVER, PRESSED or DISABLED, and may also contain FOCUSED, SELECTED or DEFAULT.

Constants used by Synth. Not all Components support all states. A
Component will at least be in one of the primary states. That is, the
return value from SynthContext.getComponentState() will at
least be one of ENABLED, MOUSE_OVER,
PRESSED or DISABLED, and may also contain
FOCUSED, SELECTED or DEFAULT.
raw docstring

No vars found in this namespace.

javax.swing.plaf.synth.SynthContext

An immutable transient object containing contextual information about a Region. A SynthContext should only be considered valid for the duration of the method it is passed to. In other words you should not cache a SynthContext that is passed to you and expect it to remain valid.

An immutable transient object containing contextual information about
a Region. A SynthContext should only be
considered valid for the duration
of the method it is passed to. In other words you should not cache
a SynthContext that is passed to you and expect it to
remain valid.
raw docstring

javax.swing.plaf.synth.SynthDesktopIconUI

Provides the Synth L&F UI delegate for a minimized internal frame on a desktop.

Provides the Synth L&F UI delegate for a minimized internal frame on a desktop.
raw docstring

javax.swing.plaf.synth.SynthDesktopPaneUI

Provides the Synth L&F UI delegate for JDesktopPane.

Provides the Synth L&F UI delegate for
JDesktopPane.
raw docstring

javax.swing.plaf.synth.SynthEditorPaneUI

Provides the Synth L&F UI delegate for JEditorPane.

Provides the Synth L&F UI delegate for
JEditorPane.
raw docstring

javax.swing.plaf.synth.SynthFormattedTextFieldUI

Provides the Synth L&F UI delegate for JFormattedTextField.

Provides the Synth L&F UI delegate for
JFormattedTextField.
raw docstring

javax.swing.plaf.synth.SynthInternalFrameUI

Provides the Synth L&F UI delegate for JInternalFrame.

Provides the Synth L&F UI delegate for
JInternalFrame.
raw docstring

javax.swing.plaf.synth.SynthListUI

Provides the Synth L&F UI delegate for JList.

Provides the Synth L&F UI delegate for
JList.
raw docstring

javax.swing.plaf.synth.SynthLookAndFeel

SynthLookAndFeel provides the basis for creating a customized look and feel. SynthLookAndFeel does not directly provide a look, all painting is delegated. You need to either provide a configuration file, by way of the load(java.io.InputStream, java.lang.Class<?>) method, or provide your own SynthStyleFactory to setStyleFactory(javax.swing.plaf.synth.SynthStyleFactory). Refer to the package summary for an example of loading a file, and SynthStyleFactory for an example of providing your own SynthStyleFactory to setStyleFactory.

Warning: This class implements Serializable as a side effect of it extending BasicLookAndFeel. It is not intended to be serialized. An attempt to serialize it will result in NotSerializableException.

SynthLookAndFeel provides the basis for creating a customized look and
feel. SynthLookAndFeel does not directly provide a look, all painting is
delegated.
You need to either provide a configuration file, by way of the
load(java.io.InputStream, java.lang.Class<?>) method, or provide your own SynthStyleFactory
to setStyleFactory(javax.swing.plaf.synth.SynthStyleFactory). Refer to the
package summary for an example of
loading a file, and SynthStyleFactory for
an example of providing your own SynthStyleFactory to
setStyleFactory.

Warning:
This class implements Serializable as a side effect of it
extending BasicLookAndFeel. It is not intended to be serialized.
An attempt to serialize it will
result in NotSerializableException.
raw docstring

javax.swing.plaf.synth.SynthMenuBarUI

Provides the Synth L&F UI delegate for JMenuBar.

Provides the Synth L&F UI delegate for
JMenuBar.
raw docstring

javax.swing.plaf.synth.SynthMenuItemUI

Provides the Synth L&F UI delegate for JMenuItem.

Provides the Synth L&F UI delegate for
JMenuItem.
raw docstring

javax.swing.plaf.synth.SynthMenuUI

Provides the Synth L&F UI delegate for JMenu.

Provides the Synth L&F UI delegate for
JMenu.
raw docstring

javax.swing.plaf.synth.SynthOptionPaneUI

Provides the Synth L&F UI delegate for JOptionPane.

Provides the Synth L&F UI delegate for
JOptionPane.
raw docstring

javax.swing.plaf.synth.SynthPainter

SynthPainter is used for painting portions of JComponents. At a minimum each JComponent has two paint methods: one for the border and one for the background. Some JComponents have more than one Region, and as a consequence more paint methods.

Instances of SynthPainter are obtained from the SynthStyle.getPainter(javax.swing.plaf.synth.SynthContext) method.

You typically supply a SynthPainter by way of Synth's file format. The following example registers a painter for all JButtons that will render the image myImage.png:

<style id="buttonStyle"> <imagePainter path="myImage.png" sourceInsets="2 2 2 2" paintCenter="true" stretch="true"/> <insets top="2" bottom="2" left="2" right="2"/> </style>

<bind style="buttonStyle" type="REGION" key="button"/>

SynthPainter is abstract in so far as it does no painting, all the methods are empty. While none of these methods are typed to throw an exception, subclasses can assume that valid arguments are passed in, and if not they can throw a NullPointerException or IllegalArgumentException in response to invalid arguments.

SynthPainter is used for painting portions of
JComponents. At a minimum each JComponent
has two paint methods: one for the border and one for the background. Some
JComponents have more than one Region, and as
a consequence more paint methods.

Instances of SynthPainter are obtained from the
SynthStyle.getPainter(javax.swing.plaf.synth.SynthContext) method.

You typically supply a SynthPainter by way of Synth's
file format. The following
example registers a painter for all JButtons that will
render the image myImage.png:


 <style id="buttonStyle">
   <imagePainter path="myImage.png" sourceInsets="2 2 2 2"
                 paintCenter="true" stretch="true"/>
   <insets top="2" bottom="2" left="2" right="2"/>
 </style>
 <bind style="buttonStyle" type="REGION" key="button"/>

SynthPainter is abstract in so far as it does no painting,
all the methods
are empty. While none of these methods are typed to throw an exception,
subclasses can assume that valid arguments are passed in, and if not
they can throw a NullPointerException or
IllegalArgumentException in response to invalid arguments.
raw docstring

javax.swing.plaf.synth.SynthPasswordFieldUI

Provides the Synth L&F UI delegate for JPasswordField.

Provides the Synth L&F UI delegate for
JPasswordField.
raw docstring

javax.swing.plaf.synth.SynthPopupMenuUI

Provides the Synth L&F UI delegate for JPopupMenu.

Provides the Synth L&F UI delegate for
JPopupMenu.
raw docstring

javax.swing.plaf.synth.SynthRadioButtonMenuItemUI

Provides the Synth L&F UI delegate for JRadioButtonMenuItem.

Provides the Synth L&F UI delegate for
JRadioButtonMenuItem.
raw docstring

javax.swing.plaf.synth.SynthRadioButtonUI

Provides the Synth L&F UI delegate for JRadioButton.

Provides the Synth L&F UI delegate for
JRadioButton.
raw docstring

javax.swing.plaf.synth.SynthRootPaneUI

Provides the Synth L&F UI delegate for JRootPane.

Provides the Synth L&F UI delegate for
JRootPane.
raw docstring

javax.swing.plaf.synth.SynthScrollPaneUI

Provides the Synth L&F UI delegate for JScrollPane.

Provides the Synth L&F UI delegate for
JScrollPane.
raw docstring

javax.swing.plaf.synth.SynthSpinnerUI

Provides the Synth L&F UI delegate for JSpinner.

Provides the Synth L&F UI delegate for
JSpinner.
raw docstring

javax.swing.plaf.synth.SynthStyle

SynthStyle is a set of style properties. Each SynthUI references at least one SynthStyle that is obtained using a SynthStyleFactory. You typically don't need to interact with this class directly, rather you will load a Synth File Format file into SynthLookAndFeel that will create a set of SynthStyles.

SynthStyle is a set of style properties.
Each SynthUI references at least one
SynthStyle that is obtained using a
SynthStyleFactory. You typically don't need to interact with
this class directly, rather you will load a
Synth File Format file into
SynthLookAndFeel that will create a set of SynthStyles.
raw docstring

javax.swing.plaf.synth.SynthStyleFactory

Factory used for obtaining SynthStyles. Each of the Synth ComponentUIs will call into the current SynthStyleFactory to obtain a SynthStyle for each of the distinct regions they have.

The following example creates a custom SynthStyleFactory that returns a different style based on the Region:

class MyStyleFactory extends SynthStyleFactory { public SynthStyle getStyle(JComponent c, Region id) { if (id == Region.BUTTON) { return buttonStyle; } else if (id == Region.TREE) { return treeStyle; } return defaultStyle; } } SynthLookAndFeel laf = new SynthLookAndFeel(); UIManager.setLookAndFeel(laf); SynthLookAndFeel.setStyleFactory(new MyStyleFactory());

Factory used for obtaining SynthStyles.  Each of the
Synth ComponentUIs will call into the current
SynthStyleFactory to obtain a SynthStyle
for each of the distinct regions they have.

The following example creates a custom SynthStyleFactory
that returns a different style based on the Region:


class MyStyleFactory extends SynthStyleFactory {
    public SynthStyle getStyle(JComponent c, Region id) {
        if (id == Region.BUTTON) {
            return buttonStyle;
        }
        else if (id == Region.TREE) {
            return treeStyle;
        }
        return defaultStyle;
    }
}
SynthLookAndFeel laf = new SynthLookAndFeel();
UIManager.setLookAndFeel(laf);
SynthLookAndFeel.setStyleFactory(new MyStyleFactory());
raw docstring

javax.swing.plaf.synth.SynthTabbedPaneUI

Provides the Synth L&F UI delegate for JTabbedPane.

Looks up the selectedTabPadInsets property from the Style, which represents additional insets for the selected tab.

Provides the Synth L&F UI delegate for
JTabbedPane.

Looks up the selectedTabPadInsets property from the Style,
which represents additional insets for the selected tab.
raw docstring

javax.swing.plaf.synth.SynthTableHeaderUI

Provides the Synth L&F UI delegate for JTableHeader.

Provides the Synth L&F UI delegate for
JTableHeader.
raw docstring

javax.swing.plaf.synth.SynthTableUI

Provides the Synth L&F UI delegate for JTable.

Provides the Synth L&F UI delegate for
JTable.
raw docstring

javax.swing.plaf.synth.SynthTextAreaUI

Provides the look and feel for a plain text editor in the Synth look and feel. In this implementation the default UI is extended to act as a simple view factory.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Provides the look and feel for a plain text editor in the
Synth look and feel. In this implementation the default UI
is extended to act as a simple view factory.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.synth.SynthTextFieldUI

Provides the Synth L&F UI delegate for JTextField.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Provides the Synth L&F UI delegate for JTextField.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.synth.SynthTextPaneUI

Provides the look and feel for a styled text editor in the Synth look and feel.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Provides the look and feel for a styled text editor in the
Synth look and feel.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.plaf.synth.SynthToggleButtonUI

Provides the Synth L&F UI delegate for JToggleButton.

Provides the Synth L&F UI delegate for
JToggleButton.
raw docstring

javax.swing.plaf.synth.SynthToolBarUI

Provides the Synth L&F UI delegate for JToolBar.

Provides the Synth L&F UI delegate for
JToolBar.
raw docstring

javax.swing.plaf.synth.SynthUI

SynthUI is used to fetch the SynthContext for a particular Component.

SynthUI is used to fetch the SynthContext for a particular Component.
raw docstring

javax.swing.plaf.TabbedPaneUI

Pluggable look and feel interface for JTabbedPane.

Pluggable look and feel interface for JTabbedPane.
raw docstring

javax.swing.plaf.TableHeaderUI

Pluggable look and feel interface for JTableHeader.

Pluggable look and feel interface for JTableHeader.
raw docstring

javax.swing.plaf.TableUI

Pluggable look and feel interface for JTable.

Pluggable look and feel interface for JTable.
raw docstring

javax.swing.plaf.ToolBarUI

Pluggable look and feel interface for JToolBar.

Pluggable look and feel interface for JToolBar.
raw docstring

javax.swing.plaf.ToolTipUI

Pluggable look and feel interface for JToolTip.

Pluggable look and feel interface for JToolTip.
raw docstring

javax.swing.plaf.UIResource

This interface is used to mark objects created by ComponentUI delegates. The ComponentUI.installUI() and ComponentUI.uninstallUI() methods can use this interface to decide if a properties value has been overridden. For example, the JList cellRenderer property is initialized by BasicListUI.installUI(), only if it's initial value is null:

if (list.getCellRenderer() == null) { list.setCellRenderer((ListCellRenderer)(UIManager.get("List.cellRenderer"))); } At uninstallUI() time we reset the property to null if its value is an instance of UIResource:

if (list.getCellRenderer() instanceof UIResource) { list.setCellRenderer(null); } This pattern applies to all properties except the java.awt.Component properties font, foreground, and background. If one of these properties isn't initialized, or is explicitly set to null, its container provides the value. For this reason the "== null" is unreliable when installUI() is called to dynamically change a components look and feel. So at installUI() time we check to see if the current value is a UIResource:

if (!(list.getFont() instanceof UIResource)) { list.setFont(UIManager.getFont("List.font")); }

This interface is used to mark objects created by ComponentUI delegates.
The ComponentUI.installUI() and
ComponentUI.uninstallUI() methods can use this interface
to decide if a properties value has been overridden.  For example, the
JList cellRenderer property is initialized by BasicListUI.installUI(),
only if it's initial value is null:


if (list.getCellRenderer() == null) {
    list.setCellRenderer((ListCellRenderer)(UIManager.get("List.cellRenderer")));
}
At uninstallUI() time we reset the property to null if its value
is an instance of UIResource:


if (list.getCellRenderer() instanceof UIResource) {
    list.setCellRenderer(null);
}
This pattern applies to all properties except the java.awt.Component
properties font, foreground, and background.  If one of these
properties isn't initialized, or is explicitly set to null,
its container provides the value.  For this reason the
"== null" is unreliable when installUI() is called
to dynamically change a components look and feel.  So at installUI()
time we check to see if the current value is a UIResource:


if (!(list.getFont() instanceof UIResource)) {
    list.setFont(UIManager.getFont("List.font"));
}
raw docstring

No vars found in this namespace.

javax.swing.plaf.ViewportUI

Pluggable look and feel interface for JViewport.

Pluggable look and feel interface for JViewport.
raw docstring

javax.swing.Popup

Popups are used to display a Component to the user, typically on top of all the other Components in a particular containment hierarchy. Popups have a very small life cycle. Once you have obtained a Popup, and hidden it (invoked the hide method), you should no longer invoke any methods on it. This allows the PopupFactory to cache Popups for later use.

The general contract is that if you need to change the size of the Component, or location of the Popup, you should obtain a new Popup.

Popup does not descend from Component, rather implementations of Popup are responsible for creating and maintaining their own Components to render the requested Component to the user.

You typically do not explicitly create an instance of Popup, instead obtain one from a PopupFactory.

Popups are used to display a Component to the user, typically
on top of all the other Components in a particular containment
hierarchy. Popups have a very small life cycle. Once you
have obtained a Popup, and hidden it (invoked the
hide method), you should no longer
invoke any methods on it. This allows the PopupFactory to cache
Popups for later use.

The general contract is that if you need to change the size of the
Component, or location of the Popup, you should
obtain a new Popup.

Popup does not descend from Component, rather
implementations of Popup are responsible for creating
and maintaining their own Components to render the
requested Component to the user.

You typically do not explicitly create an instance of Popup,
instead obtain one from a PopupFactory.
raw docstring

javax.swing.PopupFactory

PopupFactory, as the name implies, is used to obtain instances of Popups. Popups are used to display a Component above all other Components in a particular containment hierarchy. The general contract is that once you have obtained a Popup from a PopupFactory, you must invoke hide on the Popup. The typical usage is:

PopupFactory factory = PopupFactory.getSharedInstance(); Popup popup = factory.getPopup(owner, contents, x, y); popup.show(); ... popup.hide();

PopupFactory, as the name implies, is used to obtain
instances of Popups. Popups are used to
display a Component above all other Components
in a particular containment hierarchy. The general contract is that
once you have obtained a Popup from a
PopupFactory, you must invoke hide on the
Popup. The typical usage is:


  PopupFactory factory = PopupFactory.getSharedInstance();
  Popup popup = factory.getPopup(owner, contents, x, y);
  popup.show();
  ...
  popup.hide();
raw docstring

javax.swing.ProgressMonitor

A class to monitor the progress of some operation. If it looks like the operation will take a while, a progress dialog will be popped up. When the ProgressMonitor is created it is given a numeric range and a descriptive string. As the operation progresses, call the setProgress method to indicate how far along the [min,max] range the operation is. Initially, there is no ProgressDialog. After the first millisToDecideToPopup milliseconds (default 500) the progress monitor will predict how long the operation will take. If it is longer than millisToPopup (default 2000, 2 seconds) a ProgressDialog will be popped up.

From time to time, when the Dialog box is visible, the progress bar will be updated when setProgress is called. setProgress won't always update the progress bar, it will only be done if the amount of progress is visibly significant.

For further documentation and examples see How to Monitor Progress, a section in The Java Tutorial.

A class to monitor the progress of some operation. If it looks
like the operation will take a while, a progress dialog will be popped up.
When the ProgressMonitor is created it is given a numeric range and a
descriptive string. As the operation progresses, call the setProgress method
to indicate how far along the [min,max] range the operation is.
Initially, there is no ProgressDialog. After the first millisToDecideToPopup
milliseconds (default 500) the progress monitor will predict how long
the operation will take.  If it is longer than millisToPopup (default 2000,
2 seconds) a ProgressDialog will be popped up.

From time to time, when the Dialog box is visible, the progress bar will
be updated when setProgress is called.  setProgress won't always update
the progress bar, it will only be done if the amount of progress is
visibly significant.



For further documentation and examples see
How to Monitor Progress,
a section in The Java Tutorial.
raw docstring

javax.swing.ProgressMonitorInputStream

Monitors the progress of reading from some InputStream. This ProgressMonitor is normally invoked in roughly this form:

InputStream in = new BufferedInputStream( new ProgressMonitorInputStream( parentComponent, "Reading " fileName, new FileInputStream(fileName))); This creates a progress monitor to monitor the progress of reading the input stream. If it's taking a while, a ProgressDialog will be popped up to inform the user. If the user hits the Cancel button an InterruptedIOException will be thrown on the next read. All the right cleanup is done when the stream is closed.

For further documentation and examples see How to Monitor Progress, a section in The Java Tutorial.

Monitors the progress of reading from some InputStream. This ProgressMonitor
is normally invoked in roughly this form:


InputStream in = new BufferedInputStream(
                         new ProgressMonitorInputStream(
                                 parentComponent,
                                 "Reading "  fileName,
                                 new FileInputStream(fileName)));
This creates a progress monitor to monitor the progress of reading
the input stream.  If it's taking a while, a ProgressDialog will
be popped up to inform the user.  If the user hits the Cancel button
an InterruptedIOException will be thrown on the next read.
All the right cleanup is done when the stream is closed.




For further documentation and examples see
How to Monitor Progress,
a section in The Java Tutorial.
raw docstring

javax.swing.Renderer

Defines the requirements for an object responsible for "rendering" (displaying) a value.

Defines the requirements for an object responsible for
"rendering" (displaying) a value.
raw docstring

javax.swing.RepaintManager

This class manages repaint requests, allowing the number of repaints to be minimized, for example by collapsing multiple requests into a single repaint for members of a component tree.

As of 1.6 RepaintManager handles repaint requests for Swing's top level components (JApplet, JWindow, JFrame and JDialog). Any calls to repaint on one of these will call into the appropriate addDirtyRegion method.

This class manages repaint requests, allowing the number
of repaints to be minimized, for example by collapsing multiple
requests into a single repaint for members of a component tree.

As of 1.6 RepaintManager handles repaint requests
for Swing's top level components (JApplet,
JWindow, JFrame and JDialog).
Any calls to repaint on one of these will call into the
appropriate addDirtyRegion method.
raw docstring

javax.swing.RootPaneContainer

This interface is implemented by components that have a single JRootPane child: JDialog, JFrame, JWindow, JApplet, JInternalFrame. The methods in this interface are just covers for the JRootPane properties, e.g. getContentPane() is generally implemented like this:

public Container getContentPane() {
    return getRootPane().getContentPane();
}

This interface serves as a marker for Swing GUI builders that need to treat components like JFrame, that contain a single JRootPane, specially. For example in a GUI builder, dropping a component on a RootPaneContainer would be interpreted as frame.getContentPane().add(child).

As a convenience, the standard classes that implement this interface (such as JFrame, JDialog, JWindow, JApplet, and JInternalFrame) have their add, remove, and setLayout methods overridden, so that they delegate calls to the corresponding methods of the ContentPane. For example, you can add a child component to a frame as follows:

  frame.add(child);

instead of:

  frame.getContentPane().add(child);

The behavior of the add and setLayout methods for JFrame, JDialog, JWindow, JApplet and JInternalFrame is controlled by the rootPaneCheckingEnabled property. If this property is true (the default), then calls to these methods are forwarded to the contentPane; if false, these methods operate directly on the RootPaneContainer. This property is only intended for subclasses, and is therefore protected.

This interface is implemented by components that have a single
JRootPane child: JDialog, JFrame, JWindow, JApplet, JInternalFrame.
The methods in  this interface are just covers for the JRootPane
properties, e.g. getContentPane() is generally implemented
like this:

    public Container getContentPane() {
        return getRootPane().getContentPane();
    }
This interface serves as a marker for Swing GUI builders
that need to treat components like JFrame, that contain a
single JRootPane, specially.  For example in a GUI builder,
dropping a component on a RootPaneContainer would be interpreted
as frame.getContentPane().add(child).

As a convenience, the standard classes that implement this interface
(such as JFrame, JDialog, JWindow, JApplet,
and JInternalFrame) have their add, remove,
and setLayout methods overridden, so that they delegate calls
to the corresponding methods of the ContentPane.
For example, you can add a child component to a frame as follows:


      frame.add(child);
instead of:


      frame.getContentPane().add(child);

The behavior of the add and
setLayout methods for
JFrame, JDialog, JWindow,
JApplet and JInternalFrame is controlled by
the rootPaneCheckingEnabled property. If this property is
true (the default), then calls to these methods are
forwarded to the contentPane; if false, these
methods operate directly on the RootPaneContainer. This
property is only intended for subclasses, and is therefore protected.
raw docstring

javax.swing.RowFilter

RowFilter is used to filter out entries from the model so that they are not shown in the view. For example, a RowFilter associated with a JTable might only allow rows that contain a column with a specific string. The meaning of entry depends on the component type. For example, when a filter is associated with a JTable, an entry corresponds to a row; when associated with a JTree, an entry corresponds to a node.

Subclasses must override the include method to indicate whether the entry should be shown in the view. The Entry argument can be used to obtain the values in each of the columns in that entry. The following example shows an include method that allows only entries containing one or more values starting with the string "a":

RowFilter<Object,Object> startsWithAFilter = new RowFilter<Object,Object>() { public boolean include(Entry<? extends Object, ? extends Object> entry) { for (int i = entry.getValueCount() - 1; i >= 0; i--) { if (entry.getStringValue(i).startsWith("a")) { // The value starts with "a", include it return true; } } // None of the columns start with "a"; return false so that this // entry is not shown return false; } }; RowFilter has two formal type parameters that allow you to create a RowFilter for a specific model. For example, the following assumes a specific model that is wrapping objects of type Person. Only Persons with an age over 20 will be shown:

RowFilter<PersonModel,Integer> ageFilter = new RowFilter<PersonModel,Integer>() { public boolean include(Entry<? extends PersonModel, ? extends Integer> entry) { PersonModel personModel = entry.getModel(); Person person = personModel.getPerson(entry.getIdentifier()); if (person.getAge() > 20) { // Returning true indicates this row should be shown. return true; } // Age is <= 20, don't show it. return false; } }; PersonModel model = createPersonModel(); TableRowSorter<PersonModel> sorter = new TableRowSorter<PersonModel>(model); sorter.setRowFilter(ageFilter);

RowFilter is used to filter out entries from the
model so that they are not shown in the view.  For example, a
RowFilter associated with a JTable might
only allow rows that contain a column with a specific string. The
meaning of entry depends on the component type.
For example, when a filter is
associated with a JTable, an entry corresponds to a
row; when associated with a JTree, an entry corresponds
to a node.

Subclasses must override the include method to
indicate whether the entry should be shown in the
view.  The Entry argument can be used to obtain the values in
each of the columns in that entry.  The following example shows an
include method that allows only entries containing one or
more values starting with the string "a":


RowFilter<Object,Object> startsWithAFilter = new RowFilter<Object,Object>() {
  public boolean include(Entry<? extends Object, ? extends Object> entry) {
    for (int i = entry.getValueCount() - 1; i >= 0; i--) {
      if (entry.getStringValue(i).startsWith("a")) {
        // The value starts with "a", include it
        return true;
      }
    }
    // None of the columns start with "a"; return false so that this
    // entry is not shown
    return false;
  }
};
RowFilter has two formal type parameters that allow
you to create a RowFilter for a specific model. For
example, the following assumes a specific model that is wrapping
objects of type Person.  Only Persons
with an age over 20 will be shown:


RowFilter<PersonModel,Integer> ageFilter = new RowFilter<PersonModel,Integer>() {
  public boolean include(Entry<? extends PersonModel, ? extends Integer> entry) {
    PersonModel personModel = entry.getModel();
    Person person = personModel.getPerson(entry.getIdentifier());
    if (person.getAge() > 20) {
      // Returning true indicates this row should be shown.
      return true;
    }
    // Age is <= 20, don't show it.
    return false;
  }
};
PersonModel model = createPersonModel();
TableRowSorter<PersonModel> sorter = new TableRowSorter<PersonModel>(model);
sorter.setRowFilter(ageFilter);
raw docstring

javax.swing.RowFilter$Entry

An Entry object is passed to instances of RowFilter, allowing the filter to get the value of the entry's data, and thus to determine whether the entry should be shown. An Entry object contains information about the model as well as methods for getting the underlying values from the model.

An Entry object is passed to instances of
RowFilter, allowing the filter to get the value of the
entry's data, and thus to determine whether the entry should be shown.
An Entry object contains information about the model
as well as methods for getting the underlying values from the model.
raw docstring

javax.swing.RowSorter

RowSorter provides the basis for sorting and filtering. Beyond creating and installing a RowSorter, you very rarely need to interact with one directly. Refer to TableRowSorter for a concrete implementation of RowSorter for JTable.

RowSorter's primary role is to provide a mapping between two coordinate systems: that of the view (for example a JTable) and that of the underlying data source, typically a model.

The view invokes the following methods on the RowSorter:

toggleSortOrder — The view invokes this when the appropriate user gesture has occurred to trigger a sort. For example, the user clicked a column header in a table. One of the model change methods — The view invokes a model change method when the underlying model has changed. There may be order dependencies in how the events are delivered, so a RowSorter should not update its mapping until one of these methods is invoked.

Because the view makes extensive use of the convertRowIndexToModel, convertRowIndexToView and getViewRowCount methods, these methods need to be fast.

RowSorter provides notification of changes by way of RowSorterListener. Two types of notification are sent:

RowSorterEvent.Type.SORT_ORDER_CHANGED — notifies listeners that the sort order has changed. This is typically followed by a notification that the sort has changed. RowSorterEvent.Type.SORTED — notifies listeners that the mapping maintained by the RowSorter has changed in some way.

RowSorter implementations typically don't have a one-to-one mapping with the underlying model, but they can. For example, if a database does the sorting, toggleSortOrder might call through to the database (on a background thread), and override the mapping methods to return the argument that is passed in.

Concrete implementations of RowSorter need to reference a model such as TableModel or ListModel. The view classes, such as JTable and JList, will also have a reference to the model. To avoid ordering dependencies, RowSorter implementations should not install a listener on the model. Instead the view class will call into the RowSorter when the model changes. For example, if a row is updated in a TableModel JTable invokes rowsUpdated. When the model changes, the view may call into any of the following methods: modelStructureChanged, allRowsChanged, rowsInserted, rowsDeleted and rowsUpdated.

RowSorter provides the basis for sorting and filtering.
Beyond creating and installing a RowSorter, you very rarely
need to interact with one directly.  Refer to
TableRowSorter for a concrete
implementation of RowSorter for JTable.

RowSorter's primary role is to provide a mapping between
two coordinate systems: that of the view (for example a
JTable) and that of the underlying data source, typically a
model.

The view invokes the following methods on the RowSorter:

toggleSortOrder — The view invokes this when the
    appropriate user gesture has occurred to trigger a sort.  For example,
    the user clicked a column header in a table.
One of the model change methods — The view invokes a model
    change method when the underlying model
    has changed.  There may be order dependencies in how the events are
    delivered, so a RowSorter should not update its mapping
    until one of these methods is invoked.

Because the view makes extensive use of  the
convertRowIndexToModel,
convertRowIndexToView and getViewRowCount methods,
these methods need to be fast.

RowSorter provides notification of changes by way of
RowSorterListener.  Two types of notification are sent:

RowSorterEvent.Type.SORT_ORDER_CHANGED — notifies
    listeners that the sort order has changed.  This is typically followed
    by a notification that the sort has changed.
RowSorterEvent.Type.SORTED — notifies listeners that
    the mapping maintained by the RowSorter has changed in
    some way.

RowSorter implementations typically don't have a one-to-one
mapping with the underlying model, but they can.
For example, if a database does the sorting,
toggleSortOrder might call through to the database
(on a background thread), and override the mapping methods to return the
argument that is passed in.

Concrete implementations of RowSorter
need to reference a model such as TableModel or
ListModel.  The view classes, such as
JTable and JList, will also have a
reference to the model.  To avoid ordering dependencies,
RowSorter implementations should not install a
listener on the model.  Instead the view class will call into the
RowSorter when the model changes.  For
example, if a row is updated in a TableModel
JTable invokes rowsUpdated.
When the model changes, the view may call into any of the following methods:
modelStructureChanged, allRowsChanged,
rowsInserted, rowsDeleted and
rowsUpdated.
raw docstring

javax.swing.RowSorter$SortKey

SortKey describes the sort order for a particular column. The column index is in terms of the underlying model, which may differ from that of the view.

SortKey describes the sort order for a particular column.  The
column index is in terms of the underlying model, which may differ
from that of the view.
raw docstring

javax.swing.Scrollable

An interface that provides information to a scrolling container like JScrollPane. A complex component that's likely to be used as a viewing a JScrollPane viewport (or other scrolling container) should implement this interface.

An interface that provides information to a scrolling container
like JScrollPane.  A complex component that's likely to be used
as a viewing a JScrollPane viewport (or other scrolling container)
should implement this interface.
raw docstring

javax.swing.ScrollPaneConstants

Constants used with the JScrollPane component.

Constants used with the JScrollPane component.
raw docstring

No vars found in this namespace.

javax.swing.ScrollPaneLayout

The layout manager used by JScrollPane. JScrollPaneLayout is responsible for nine components: a viewport, two scrollbars, a row header, a column header, and four "corner" components.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The layout manager used by JScrollPane.
JScrollPaneLayout is
responsible for nine components: a viewport, two scrollbars,
a row header, a column header, and four "corner" components.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.ScrollPaneLayout$UIResource

The UI resource version of ScrollPaneLayout.

The UI resource version of ScrollPaneLayout.
raw docstring

javax.swing.SingleSelectionModel

A model that supports at most one indexed selection.

A model that supports at most one indexed selection.
raw docstring

javax.swing.SizeRequirements

For the convenience of layout managers, calculates information about the size and position of components. All size and position calculation methods are class methods that take arrays of SizeRequirements as arguments. The SizeRequirements class supports two types of layout:

tiled The components are placed end-to-end, starting either at coordinate 0 (the leftmost or topmost position) or at the coordinate representing the end of the allocated span (the rightmost or bottommost position).

aligned The components are aligned as specified by each component's X or Y alignment value.

Each SizeRequirements object contains information about either the width (and X alignment) or height (and Y alignment) of a single component or a group of components:

minimum The smallest reasonable width/height of the component or component group, in pixels.

preferred The natural width/height of the component or component group, in pixels.

maximum The largest reasonable width/height of the component or component group, in pixels.

alignment The X/Y alignment of the component or component group.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

For the convenience of layout managers,
calculates information about the size and position of components.
All size and position calculation methods are class methods
that take arrays of SizeRequirements as arguments.
The SizeRequirements class supports two types of layout:



 tiled
 The components are placed end-to-end,
     starting either at coordinate 0 (the leftmost or topmost position)
     or at the coordinate representing the end of the allocated span
     (the rightmost or bottommost position).

 aligned
 The components are aligned as specified
     by each component's X or Y alignment value.





Each SizeRequirements object contains information
about either the width (and X alignment)
or height (and Y alignment)
of a single component or a group of components:



 minimum
 The smallest reasonable width/height of the component
     or component group, in pixels.

 preferred
 The natural width/height of the component
     or component group, in pixels.

 maximum
 The largest reasonable width/height of the component
     or component group, in pixels.

 alignment
 The X/Y alignment of the component
     or component group.



Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.SizeSequence

A SizeSequence object efficiently maintains an ordered list of sizes and corresponding positions. One situation for which SizeSequence might be appropriate is in a component that displays multiple rows of unequal size. In this case, a single SizeSequence object could be used to track the heights and Y positions of all rows.

Another example would be a multi-column component, such as a JTable, in which the column sizes are not all equal. The JTable might use a single SizeSequence object to store the widths and X positions of all the columns. The JTable could then use the SizeSequence object to find the column corresponding to a certain position. The JTable could update the SizeSequence object whenever one or more column sizes changed.

The following figure shows the relationship between size and position data for a multi-column component.

In the figure, the first index (0) corresponds to the first column, the second index (1) to the second column, and so on. The first column's position starts at 0, and the column occupies size0 pixels, where size0 is the value returned by getSize(0). Thus, the first column ends at size0 - 1. The second column then begins at the position size0 and occupies size1 (getSize(1)) pixels.

Note that a SizeSequence object simply represents intervals along an axis. In our examples, the intervals represent height or width in pixels. However, any other unit of measure (for example, time in days) could be just as valid.

Implementation Notes

Normally when storing the size and position of entries, one would choose between storing the sizes or storing their positions instead. The two common operations that are needed during rendering are: getIndex(position) and setSize(index, size). Whichever choice of internal format is made one of these operations is costly when the number of entries becomes large. If sizes are stored, finding the index of the entry that encloses a particular position is linear in the number of entries. If positions are stored instead, setting the size of an entry at a particular index requires updating the positions of the affected entries, which is also a linear calculation.

Like the above techniques this class holds an array of N integers internally but uses a hybrid encoding, which is halfway between the size-based and positional-based approaches. The result is a data structure that takes the same space to store the information but can perform most operations in Log(N) time instead of O(N), where N is the number of entries in the list.

Two operations that remain O(N) in the number of entries are the insertEntries and removeEntries methods, both of which are implemented by converting the internal array to a set of integer sizes, copying it into the new array, and then reforming the hybrid representation in place.

A SizeSequence object
efficiently maintains an ordered list
of sizes and corresponding positions.
One situation for which SizeSequence
might be appropriate is in a component
that displays multiple rows of unequal size.
In this case, a single SizeSequence
object could be used to track the heights
and Y positions of all rows.

Another example would be a multi-column component,
such as a JTable,
in which the column sizes are not all equal.
The JTable might use a single
SizeSequence object
to store the widths and X positions of all the columns.
The JTable could then use the
SizeSequence object
to find the column corresponding to a certain position.
The JTable could update the
SizeSequence object
whenever one or more column sizes changed.


The following figure shows the relationship between size and position data
for a multi-column component.





In the figure, the first index (0) corresponds to the first column,
the second index (1) to the second column, and so on.
The first column's position starts at 0,
and the column occupies size0 pixels,
where size0 is the value returned by
getSize(0).
Thus, the first column ends at size0 - 1.
The second column then begins at
the position size0
and occupies size1 (getSize(1)) pixels.

Note that a SizeSequence object simply represents intervals
along an axis.
In our examples, the intervals represent height or width in pixels.
However, any other unit of measure (for example, time in days)
could be just as valid.


Implementation Notes

Normally when storing the size and position of entries,
one would choose between
storing the sizes or storing their positions
instead. The two common operations that are needed during
rendering are: getIndex(position)
and setSize(index, size).
Whichever choice of internal format is made one of these
operations is costly when the number of entries becomes large.
If sizes are stored, finding the index of the entry
that encloses a particular position is linear in the
number of entries. If positions are stored instead, setting
the size of an entry at a particular index requires updating
the positions of the affected entries, which is also a linear
calculation.

Like the above techniques this class holds an array of N integers
internally but uses a hybrid encoding, which is halfway
between the size-based and positional-based approaches.
The result is a data structure that takes the same space to store
the information but can perform most operations in Log(N) time
instead of O(N), where N is the number of entries in the list.

Two operations that remain O(N) in the number of entries are
the insertEntries
and removeEntries methods, both
of which are implemented by converting the internal array to
a set of integer sizes, copying it into the new array, and then
reforming the hybrid representation in place.
raw docstring

javax.swing.SortingFocusTraversalPolicy

A FocusTraversalPolicy that determines traversal order by sorting the Components of a focus traversal cycle based on a given Comparator. Portions of the Component hierarchy that are not visible and displayable will not be included.

By default, SortingFocusTraversalPolicy implicitly transfers focus down- cycle. That is, during normal focus traversal, the Component traversed after a focus cycle root will be the focus-cycle-root's default Component to focus. This behavior can be disabled using the setImplicitDownCycleTraversal method.

By default, methods of this class with return a Component only if it is visible, displayable, enabled, and focusable. Subclasses can modify this behavior by overriding the accept method.

This policy takes into account focus traversal policy providers. When searching for first/last/next/previous Component, if a focus traversal policy provider is encountered, its focus traversal policy is used to perform the search operation.

A FocusTraversalPolicy that determines traversal order by sorting the
Components of a focus traversal cycle based on a given Comparator. Portions
of the Component hierarchy that are not visible and displayable will not be
included.

By default, SortingFocusTraversalPolicy implicitly transfers focus down-
cycle. That is, during normal focus traversal, the Component
traversed after a focus cycle root will be the focus-cycle-root's default
Component to focus. This behavior can be disabled using the
setImplicitDownCycleTraversal method.

By default, methods of this class with return a Component only if it is
visible, displayable, enabled, and focusable. Subclasses can modify this
behavior by overriding the accept method.

This policy takes into account focus traversal
policy providers.  When searching for first/last/next/previous Component,
if a focus traversal policy provider is encountered, its focus traversal
policy is used to perform the search operation.
raw docstring

javax.swing.SpinnerDateModel

A SpinnerModel for sequences of Dates. The upper and lower bounds of the sequence are defined by properties called start and end and the size of the increase or decrease computed by the nextValue and previousValue methods is defined by a property called calendarField. The start and end properties can be null to indicate that the sequence has no lower or upper limit.

The value of the calendarField property must be one of the java.util.Calendar constants that specify a field within a Calendar. The getNextValue and getPreviousValue methods change the date forward or backwards by this amount. For example, if calendarField is Calendar.DAY_OF_WEEK, then nextValue produces a Date that's 24 hours after the current value, and previousValue produces a Date that's 24 hours earlier.

The legal values for calendarField are:

Calendar.ERA Calendar.YEAR Calendar.MONTH Calendar.WEEK_OF_YEAR Calendar.WEEK_OF_MONTH Calendar.DAY_OF_MONTH Calendar.DAY_OF_YEAR Calendar.DAY_OF_WEEK Calendar.DAY_OF_WEEK_IN_MONTH Calendar.AM_PM Calendar.HOUR Calendar.HOUR_OF_DAY Calendar.MINUTE Calendar.SECOND Calendar.MILLISECOND

However some UIs may set the calendarField before committing the edit to spin the field under the cursor. If you only want one field to spin you can subclass and ignore the setCalendarField calls.

This model inherits a ChangeListener. The ChangeListeners are notified whenever the models value, calendarField, start, or end properties changes.

A SpinnerModel for sequences of Dates.
The upper and lower bounds of the sequence are defined by properties called
start and end and the size
of the increase or decrease computed by the nextValue
and previousValue methods is defined by a property
called calendarField.  The start
and end properties can be null to
indicate that the sequence has no lower or upper limit.

The value of the calendarField property must be one of the
java.util.Calendar constants that specify a field
within a Calendar.  The getNextValue
and getPreviousValue
methods change the date forward or backwards by this amount.
For example, if calendarField is Calendar.DAY_OF_WEEK,
then nextValue produces a Date that's 24
hours after the current value, and previousValue
produces a Date that's 24 hours earlier.

The legal values for calendarField are:

  Calendar.ERA
  Calendar.YEAR
  Calendar.MONTH
  Calendar.WEEK_OF_YEAR
  Calendar.WEEK_OF_MONTH
  Calendar.DAY_OF_MONTH
  Calendar.DAY_OF_YEAR
  Calendar.DAY_OF_WEEK
  Calendar.DAY_OF_WEEK_IN_MONTH
  Calendar.AM_PM
  Calendar.HOUR
  Calendar.HOUR_OF_DAY
  Calendar.MINUTE
  Calendar.SECOND
  Calendar.MILLISECOND

However some UIs may set the calendarField before committing the edit
to spin the field under the cursor. If you only want one field to
spin you can subclass and ignore the setCalendarField calls.

This model inherits a ChangeListener.  The
ChangeListeners are notified whenever the models
value, calendarField,
start, or end properties changes.
raw docstring

javax.swing.SpinnerListModel

A simple implementation of SpinnerModel whose values are defined by an array or a List. For example to create a model defined by an array of the names of the days of the week:

String[] days = new DateFormatSymbols().getWeekdays(); SpinnerModel model = new SpinnerListModel(Arrays.asList(days).subList(1, 8)); This class only stores a reference to the array or List so if an element of the underlying sequence changes, it's up to the application to notify the ChangeListeners by calling fireStateChanged.

This model inherits a ChangeListener. The ChangeListeners are notified whenever the model's value or list properties changes.

A simple implementation of SpinnerModel whose
values are defined by an array or a List.
For example to create a model defined by
an array of the names of the days of the week:


String[] days = new DateFormatSymbols().getWeekdays();
SpinnerModel model = new SpinnerListModel(Arrays.asList(days).subList(1, 8));
This class only stores a reference to the array or List
so if an element of the underlying sequence changes, it's up
to the application to notify the ChangeListeners by calling
fireStateChanged.

This model inherits a ChangeListener.
The ChangeListeners are notified whenever the
model's value or list properties changes.
raw docstring

javax.swing.SpinnerModel

A model for a potentially unbounded sequence of object values. This model is similar to ListModel however there are some important differences:

The number of sequence elements isn't necessarily bounded. The model doesn't support indexed random access to sequence elements. Only three sequence values are accessible at a time: current, next and previous. The current sequence element, can be set.

A SpinnerModel has three properties, only the first is read/write.

value The current element of the sequence.

nextValue The following element or null if value is the last element of the sequence.

previousValue The preceding element or null if value is the first element of the sequence.

When the the value property changes, ChangeListeners are notified. SpinnerModel may choose to notify the ChangeListeners under other circumstances.

A model for a potentially unbounded sequence of object values.  This model
is similar to ListModel however there are some important differences:

 The number of sequence elements isn't necessarily bounded.
 The model doesn't support indexed random access to sequence elements.
     Only three sequence values are accessible at a time: current, next and
     previous.
 The current sequence element, can be set.


A SpinnerModel has three properties, only the first is read/write.

  value
  The current element of the sequence.

  nextValue
  The following element or null if value is the
    last element of the sequence.

  previousValue
  The preceding element or null if value is the
    first element of the sequence.

When the the value property changes,
ChangeListeners are notified.  SpinnerModel may
choose to notify the ChangeListeners under other circumstances.
raw docstring

javax.swing.SpinnerNumberModel

A SpinnerModel for sequences of numbers. The upper and lower bounds of the sequence are defined by properties called minimum and maximum. The size of the increase or decrease computed by the nextValue and previousValue methods is defined by a property called stepSize. The minimum and maximum properties can be null to indicate that the sequence has no lower or upper limit. All of the properties in this class are defined in terms of two generic types: Number and Comparable, so that all Java numeric types may be accommodated. Internally, there's only support for values whose type is one of the primitive Number types: Double, Float, Long, Integer, Short, or Byte.

To create a SpinnerNumberModel for the integer range zero to one hundred, with fifty as the initial value, one could write:

Integer value = new Integer(50); Integer min = new Integer(0); Integer max = new Integer(100); Integer step = new Integer(1); SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step); int fifty = model.getNumber().intValue();

Spinners for integers and doubles are common, so special constructors for these cases are provided. For example to create the model in the previous example, one could also write:

SpinnerNumberModel model = new SpinnerNumberModel(50, 0, 100, 1);

This model inherits a ChangeListener. The ChangeListeners are notified whenever the model's value, stepSize, minimum, or maximum properties changes.

A SpinnerModel for sequences of numbers.
The upper and lower bounds of the sequence are defined
by properties called minimum and
maximum. The size of the increase or decrease
computed by the nextValue and
previousValue methods is defined by a property called
stepSize.  The minimum and
maximum properties can be null
to indicate that the sequence has no lower or upper limit.
All of the properties in this class are defined in terms of two
generic types: Number and
Comparable, so that all Java numeric types
may be accommodated.  Internally, there's only support for
values whose type is one of the primitive Number types:
Double, Float, Long,
Integer, Short, or Byte.

To create a SpinnerNumberModel for the integer
range zero to one hundred, with
fifty as the initial value, one could write:


Integer value = new Integer(50);
Integer min = new Integer(0);
Integer max = new Integer(100);
Integer step = new Integer(1);
SpinnerNumberModel model = new SpinnerNumberModel(value, min, max, step);
int fifty = model.getNumber().intValue();

Spinners for integers and doubles are common, so special constructors
for these cases are provided.  For example to create the model in
the previous example, one could also write:


SpinnerNumberModel model = new SpinnerNumberModel(50, 0, 100, 1);

This model inherits a ChangeListener.
The ChangeListeners are notified
whenever the model's value, stepSize,
minimum, or maximum properties changes.
raw docstring

javax.swing.Spring

An instance of the Spring class holds three properties that characterize its behavior: the minimum, preferred, and maximum values. Each of these properties may be involved in defining its fourth, value, property based on a series of rules.

An instance of the Spring class can be visualized as a mechanical spring that provides a corrective force as the spring is compressed or stretched away from its preferred value. This force is modelled as linear function of the distance from the preferred value, but with two different constants -- one for the compressional force and one for the tensional one. Those constants are specified by the minimum and maximum values of the spring such that a spring at its minimum value produces an equal and opposite force to that which is created when it is at its maximum value. The difference between the preferred and minimum values, therefore, represents the ease with which the spring can be compressed and the difference between its maximum and preferred values, indicates the ease with which the Spring can be extended. See the sum(javax.swing.Spring, javax.swing.Spring) method for details.

By defining simple arithmetic operations on Springs, the behavior of a collection of Springs can be reduced to that of an ordinary (non-compound) Spring. We define the "+", "-", max, and min operators on Springs so that, in each case, the result is a Spring whose characteristics bear a useful mathematical relationship to its constituent springs.

A Spring can be treated as a pair of intervals with a single common point: the preferred value. The following rules define some of the arithmetic operators that can be applied to intervals ([a, b] refers to the interval from a to b, where a <= b).

     [a1, b1]  [a2, b2] = [a1  a2, b1  b2]

                 -[a, b] = [-b, -a]

 max([a1, b1], [a2, b2]) = [max(a1, a2), max(b1, b2)]

If we denote Springs as [a, b, c], where a <= b <= c, we can define the same arithmetic operators on Springs:

     [a1, b1, c1]  [a2, b2, c2] = [a1  a2, b1  b2, c1  c2]

                      -[a, b, c] = [-c, -b, -a]

 max([a1, b1, c1], [a2, b2, c2]) = [max(a1, a2), max(b1, b2), max(c1, c2)]

With both intervals and Springs we can define "-" and min in terms of negation:

 X - Y = X  (-Y)

 min(X, Y) = -max(-X, -Y)

For the static methods in this class that embody the arithmetic operators, we do not actually perform the operation in question as that would snapshot the values of the properties of the method's arguments at the time the static method is called. Instead, the static methods create a new Spring instance containing references to the method's arguments so that the characteristics of the new spring track the potentially changing characteristics of the springs from which it was made. This is a little like the idea of a lazy value in a functional language.

If you are implementing a SpringLayout you can find further information and examples in How to Use SpringLayout, 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An instance of the Spring class holds three properties that
 characterize its behavior: the minimum, preferred, and
 maximum values. Each of these properties may be involved in
 defining its fourth, value, property based on a series of rules.

 An instance of the Spring class can be visualized as a
 mechanical spring that provides a corrective force as the spring is compressed
 or stretched away from its preferred value. This force is modelled
 as linear function of the distance from the preferred value, but with
 two different constants -- one for the compressional force and one for the
 tensional one. Those constants are specified by the minimum and maximum
 values of the spring such that a spring at its minimum value produces an
 equal and opposite force to that which is created when it is at its
 maximum value. The difference between the preferred and
 minimum values, therefore, represents the ease with which the
 spring can be compressed and the difference between its maximum
 and preferred values, indicates the ease with which the
 Spring can be extended.
 See the sum(javax.swing.Spring, javax.swing.Spring) method for details.


 By defining simple arithmetic operations on Springs,
 the behavior of a collection of Springs
 can be reduced to that of an ordinary (non-compound) Spring. We define
 the "+", "-", max, and min operators on
 Springs so that, in each case, the result is a Spring
 whose characteristics bear a useful mathematical relationship to its constituent
 springs.


 A Spring can be treated as a pair of intervals
 with a single common point: the preferred value.
 The following rules define some of the
 arithmetic operators that can be applied to intervals
 ([a, b] refers to the interval
 from a
 to b,
 where a <= b).



         [a1, b1]  [a2, b2] = [a1  a2, b1  b2]

                     -[a, b] = [-b, -a]

     max([a1, b1], [a2, b2]) = [max(a1, a2), max(b1, b2)]


 If we denote Springs as [a, b, c],
 where a <= b <= c, we can define the same
 arithmetic operators on Springs:



         [a1, b1, c1]  [a2, b2, c2] = [a1  a2, b1  b2, c1  c2]

                          -[a, b, c] = [-c, -b, -a]

     max([a1, b1, c1], [a2, b2, c2]) = [max(a1, a2), max(b1, b2), max(c1, c2)]

 With both intervals and Springs we can define "-" and min
 in terms of negation:



     X - Y = X  (-Y)

     min(X, Y) = -max(-X, -Y)

 For the static methods in this class that embody the arithmetic
 operators, we do not actually perform the operation in question as
 that would snapshot the values of the properties of the method's arguments
 at the time the static method is called. Instead, the static methods
 create a new Spring instance containing references to
 the method's arguments so that the characteristics of the new spring track the
 potentially changing characteristics of the springs from which it
 was made. This is a little like the idea of a lazy value
 in a functional language.

If you are implementing a SpringLayout you
can find further information and examples in
How to Use SpringLayout,
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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.SpringLayout

A SpringLayout lays out the children of its associated container according to a set of constraints. See How to Use SpringLayout in The Java Tutorial for examples of using SpringLayout.

Each constraint, represented by a Spring object, controls the vertical or horizontal distance between two component edges. The edges can belong to any child of the container, or to the container itself. For example, the allowable width of a component can be expressed using a constraint that controls the distance between the west (left) and east (right) edges of the component. The allowable y coordinates for a component can be expressed by constraining the distance between the north (top) edge of the component and the north edge of its container.

Every child of a SpringLayout-controlled container, as well as the container itself, has exactly one set of constraints associated with it. These constraints are represented by a SpringLayout.Constraints object. By default, SpringLayout creates constraints that make their associated component have the minimum, preferred, and maximum sizes returned by the component's Component.getMinimumSize(), Component.getPreferredSize(), and Component.getMaximumSize() methods. The x and y positions are initially not constrained, so that until you constrain them the Component will be positioned at 0,0 relative to the Insets of the parent Container.

You can change a component's constraints in several ways. You can use one of the putConstraint methods to establish a spring linking the edges of two components within the same container. Or you can get the appropriate SpringLayout.Constraints object using getConstraints and then modify one or more of its springs. Or you can get the spring for a particular edge of a component using getConstraint, and modify it. You can also associate your own SpringLayout.Constraints object with a component by specifying the constraints object when you add the component to its container (using Container.add(Component, Object)).

The Spring object representing each constraint has a minimum, preferred, maximum, and current value. The current value of the spring is somewhere between the minimum and maximum values, according to the formula given in the Spring.sum(javax.swing.Spring, javax.swing.Spring) method description. When the minimum, preferred, and maximum values are the same, the current value is always equal to them; this inflexible spring is called a strut. You can create struts using the factory method Spring.constant(int). The Spring class also provides factory methods for creating other kinds of springs, including springs that depend on other springs.

In a SpringLayout, the position of each edge is dependent on the position of just one other edge. If a constraint is subsequently added to create a new binding for an edge, the previous binding is discarded and the edge remains dependent on a single edge. Springs should only be attached between edges of the container and its immediate children; the behavior of the SpringLayout when presented with constraints linking the edges of components from different containers (either internal or external) is undefined.

SpringLayout vs. Other Layout Managers

Note: Unlike many layout managers, SpringLayout doesn't automatically set the location of the components it manages. If you hand-code a GUI that uses SpringLayout, remember to initialize component locations by constraining the west/east and north/south locations.

Depending on the constraints you use, you may also need to set the size of the container explicitly.

Despite the simplicity of SpringLayout, it can emulate the behavior of most other layout managers. For some features, such as the line breaking provided by FlowLayout, you'll need to create a special-purpose subclass of the Spring class.

SpringLayout also provides a way to solve many of the difficult layout problems that cannot be solved by nesting combinations of Boxes. That said, SpringLayout honors the LayoutManager2 contract correctly and so can be nested with other layout managers -- a technique that can be preferable to creating the constraints implied by the other layout managers.

The asymptotic complexity of the layout operation of a SpringLayout is linear in the number of constraints (and/or components).

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A SpringLayout lays out the children of its associated container
according to a set of constraints.
See How to Use SpringLayout
in The Java Tutorial for examples of using
SpringLayout.


Each constraint,
represented by a Spring object,
controls the vertical or horizontal distance
between two component edges.
The edges can belong to
any child of the container,
or to the container itself.
For example,
the allowable width of a component
can be expressed using a constraint
that controls the distance between the west (left) and east (right)
edges of the component.
The allowable y coordinates for a component
can be expressed by constraining the distance between
the north (top) edge of the component
and the north edge of its container.


Every child of a SpringLayout-controlled container,
as well as the container itself,
has exactly one set of constraints
associated with it.
These constraints are represented by
a SpringLayout.Constraints object.
By default,
SpringLayout creates constraints
that make their associated component
have the minimum, preferred, and maximum sizes
returned by the component's
Component.getMinimumSize(),
Component.getPreferredSize(), and
Component.getMaximumSize()
methods. The x and y positions are initially not
constrained, so that until you constrain them the Component
will be positioned at 0,0 relative to the Insets of the
parent Container.


You can change
a component's constraints in several ways.
You can
use one of the
putConstraint
methods
to establish a spring
linking the edges of two components within the same container.
Or you can get the appropriate SpringLayout.Constraints
object using
getConstraints
and then modify one or more of its springs.
Or you can get the spring for a particular edge of a component
using getConstraint,
and modify it.
You can also associate
your own SpringLayout.Constraints object
with a component by specifying the constraints object
when you add the component to its container
(using
Container.add(Component, Object)).


The Spring object representing each constraint
has a minimum, preferred, maximum, and current value.
The current value of the spring
is somewhere between the minimum and maximum values,
according to the formula given in the
Spring.sum(javax.swing.Spring, javax.swing.Spring) method description.
When the minimum, preferred, and maximum values are the same,
the current value is always equal to them;
this inflexible spring is called a strut.
You can create struts using the factory method
Spring.constant(int).
The Spring class also provides factory methods
for creating other kinds of springs,
including springs that depend on other springs.


In a SpringLayout, the position of each edge is dependent on
the position of just one other edge. If a constraint is subsequently added
to create a new binding for an edge, the previous binding is discarded
and the edge remains dependent on a single edge.
Springs should only be attached
between edges of the container and its immediate children; the behavior
of the SpringLayout when presented with constraints linking
the edges of components from different containers (either internal or
external) is undefined.


SpringLayout vs. Other Layout Managers




Note:
Unlike many layout managers,
SpringLayout doesn't automatically set the location of
the components it manages.
If you hand-code a GUI that uses SpringLayout,
remember to initialize component locations by constraining the west/east
and north/south locations.

Depending on the constraints you use,
you may also need to set the size of the container explicitly.




Despite the simplicity of SpringLayout,
it can emulate the behavior of most other layout managers.
For some features,
such as the line breaking provided by FlowLayout,
you'll need to
create a special-purpose subclass of the Spring class.


SpringLayout also provides a way to solve
many of the difficult layout
problems that cannot be solved by nesting combinations
of Boxes. That said, SpringLayout honors the
LayoutManager2 contract correctly and so can be nested with
other layout managers -- a technique that can be preferable to
creating the constraints implied by the other layout managers.

The asymptotic complexity of the layout operation of a SpringLayout
is linear in the number of constraints (and/or components).

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.SpringLayout$Constraints

A Constraints object holds the constraints that govern the way a component's size and position change in a container controlled by a SpringLayout. A Constraints object is like a Rectangle, in that it has x, y, width, and height properties. In the Constraints object, however, these properties have Spring values instead of integers. In addition, a Constraints object can be manipulated as four edges -- north, south, east, and west -- using the constraint property.

The following formulas are always true for a Constraints object (here WEST and x are synonyms, as are and NORTH and y):

          EAST = WEST  WIDTH
         SOUTH = NORTH  HEIGHT

HORIZONTAL_CENTER = WEST WIDTH/2 VERTICAL_CENTER = NORTH HEIGHT/2 ABSOLUTE_BASELINE = NORTH RELATIVE_BASELINE*

For example, if you have specified the WIDTH and WEST (X) location the EAST is calculated as WEST WIDTH. If you instead specified the WIDTH and EAST locations the WEST (X) location is then calculated as EAST - WIDTH.

[RELATIVE_BASELINE is a private constraint that is set automatically when the SpringLayout.Constraints(Component) constructor is called or when a constraints object is registered with a SpringLayout object.]

Note: In this document, operators represent methods in the Spring class. For example, "a b" is equal to Spring.sum(a, b), and "a - b" is equal to Spring.sum(a, Spring.minus(b)). See the Spring API documentation for further details of spring arithmetic.

Because a Constraints object's properties -- representing its edges, size, and location -- can all be set independently and yet are interrelated, a Constraints object can become over-constrained. For example, if the WEST, WIDTH and EAST edges are all set, steps must be taken to ensure that the first of the formulas above holds. To do this, the Constraints object throws away the least recently set constraint so as to make the formulas hold.

A Constraints object holds the
constraints that govern the way a component's size and position
change in a container controlled by a SpringLayout.
A Constraints object is
like a Rectangle, in that it
has x, y,
width, and height properties.
In the Constraints object, however,
these properties have
Spring values instead of integers.
In addition,
a Constraints object
can be manipulated as four edges
-- north, south, east, and west --
using the constraint property.


The following formulas are always true
for a Constraints object (here WEST and x are synonyms, as are and NORTH and y):



              EAST = WEST  WIDTH
             SOUTH = NORTH  HEIGHT
 HORIZONTAL_CENTER = WEST  WIDTH/2
   VERTICAL_CENTER = NORTH  HEIGHT/2
 ABSOLUTE_BASELINE = NORTH  RELATIVE_BASELINE*

For example, if you have specified the WIDTH and WEST (X) location
the EAST is calculated as WEST  WIDTH.  If you instead specified
the WIDTH and EAST locations the WEST (X) location is then calculated
as EAST - WIDTH.

[RELATIVE_BASELINE is a private constraint that is set automatically when
the SpringLayout.Constraints(Component) constructor is called or when
a constraints object is registered with a SpringLayout object.]

Note: In this document,
operators represent methods
in the Spring class.
For example, "a  b" is equal to
Spring.sum(a, b),
and "a - b" is equal to
Spring.sum(a, Spring.minus(b)).
See the
Spring API documentation
for further details
of spring arithmetic.



Because a Constraints object's properties --
representing its edges, size, and location -- can all be set
independently and yet are interrelated,
a Constraints object can become over-constrained.
For example, if the WEST, WIDTH and
EAST edges are all set, steps must be taken to ensure that
the first of the formulas above holds.  To do this, the
Constraints
object throws away the least recently set
constraint so as to make the formulas hold.
raw docstring

javax.swing.SwingConstants

A collection of constants generally used for positioning and orienting components on the screen.

A collection of constants generally used for positioning and orienting
components on the screen.
raw docstring

No vars found in this namespace.

javax.swing.SwingWorker

An abstract class to perform lengthy GUI-interaction tasks in a background thread. Several background threads can be used to execute such tasks. However, the exact strategy of choosing a thread for any particular SwingWorker is unspecified and should not be relied on.

When writing a multi-threaded application using Swing, there are two constraints to keep in mind: (refer to

Concurrency in Swing for more details):

Time-consuming tasks should not be run on the Event Dispatch Thread. Otherwise the application becomes unresponsive.

Swing components should be accessed on the Event Dispatch Thread only.

These constraints mean that a GUI application with time intensive computing needs at least two threads: 1) a thread to perform the lengthy task and 2) the Event Dispatch Thread (EDT) for all GUI-related activities. This involves inter-thread communication which can be tricky to implement.

SwingWorker is designed for situations where you need to have a long running task run in a background thread and provide updates to the UI either when done, or while processing. Subclasses of SwingWorker must implement the doInBackground() method to perform the background computation.

Workflow

There are three threads involved in the life cycle of a SwingWorker :

Current thread: The execute() method is called on this thread. It schedules SwingWorker for the execution on a worker thread and returns immediately. One can wait for the SwingWorker to complete using the get methods.

Worker thread: The doInBackground() method is called on this thread. This is where all background activities should happen. To notify PropertyChangeListeners about bound properties changes use the firePropertyChange and getPropertyChangeSupport() methods. By default there are two bound properties available: state and progress.

Event Dispatch Thread: All Swing related activities occur on this thread. SwingWorker invokes the process and done() methods and notifies any PropertyChangeListeners on this thread.

Often, the Current thread is the Event Dispatch Thread.

Before the doInBackground method is invoked on a worker thread, SwingWorker notifies any PropertyChangeListeners about the state property change to StateValue.STARTED. After the doInBackground method is finished the done method is executed. Then SwingWorker notifies any PropertyChangeListeners about the state property change to StateValue.DONE.

SwingWorker is only designed to be executed once. Executing a SwingWorker more than once will not result in invoking the doInBackground method twice.

Sample Usage

The following example illustrates the simplest use case. Some processing is done in the background and when done you update a Swing component.

Say we want to find the "Meaning of Life" and display the result in a JLabel.

final JLabel label; class MeaningOfLifeFinder extends SwingWorker<String, Object> { @Override public String doInBackground() { return findTheMeaningOfLife(); }

   @Override
  protected void done() {
      try {
          label.setText(get());
      } catch (Exception ignore) {
      }
  }

}

(new MeaningOfLifeFinder()).execute();

The next example is useful in situations where you wish to process data as it is ready on the Event Dispatch Thread.

Now we want to find the first N prime numbers and display the results in a JTextArea. While this is computing, we want to update our progress in a JProgressBar. Finally, we also want to print the prime numbers to System.out.

class PrimeNumbersTask extends SwingWorker<List<Integer>, Integer> { PrimeNumbersTask(JTextArea textArea, int numbersToFind) { //initialize }

 @Override
public List<Integer> doInBackground() {
    while (! enough && ! isCancelled()) {
            number = nextPrimeNumber();
            publish(number);
            setProgress(100 * numbers.size() / numbersToFind);
        }
    }
    return numbers;
}

 @Override
protected void process(List<Integer> chunks) {
    for (int number : chunks) {
        textArea.append(number  "\n");
    }
}

}

JTextArea textArea = new JTextArea(); final JProgressBar progressBar = new JProgressBar(0, 100); PrimeNumbersTask task = new PrimeNumbersTask(textArea, N); task.addPropertyChangeListener( new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { progressBar.setValue((Integer)evt.getNewValue()); } } });

task.execute(); System.out.println(task.get()); //prints all prime numbers we have got

Because SwingWorker implements Runnable, a SwingWorker can be submitted to an Executor for execution.

An abstract class to perform lengthy GUI-interaction tasks in a
background thread. Several background threads can be used to execute such
tasks. However, the exact strategy of choosing a thread for any particular
SwingWorker is unspecified and should not be relied on.

When writing a multi-threaded application using Swing, there are
two constraints to keep in mind:
(refer to

  Concurrency in Swing
 for more details):

   Time-consuming tasks should not be run on the Event
       Dispatch Thread. Otherwise the application becomes unresponsive.

   Swing components should be accessed  on the Event
       Dispatch Thread only.





These constraints mean that a GUI application with time intensive
computing needs at least two threads:  1) a thread to perform the lengthy
task and 2) the Event Dispatch Thread (EDT) for all GUI-related
activities.  This involves inter-thread communication which can be
tricky to implement.


SwingWorker is designed for situations where you need to have a long
running task run in a background thread and provide updates to the UI
either when done, or while processing.
Subclasses of SwingWorker must implement
the doInBackground() method to perform the background computation.



Workflow

There are three threads involved in the life cycle of a
SwingWorker :



Current thread: The execute() method is
called on this thread. It schedules SwingWorker for the execution on a
worker
thread and returns immediately. One can wait for the SwingWorker to
complete using the get methods.


Worker thread: The doInBackground()
method is called on this thread.
This is where all background activities should happen. To notify
PropertyChangeListeners about bound properties changes use the
firePropertyChange and
getPropertyChangeSupport() methods. By default there are two bound
properties available: state and progress.


Event Dispatch Thread:  All Swing related activities occur
on this thread. SwingWorker invokes the
process and done() methods and notifies
any PropertyChangeListeners on this thread.



Often, the Current thread is the Event Dispatch
Thread.



Before the doInBackground method is invoked on a worker thread,
SwingWorker notifies any PropertyChangeListeners about the
state property change to StateValue.STARTED.  After the
doInBackground method is finished the done method is
executed.  Then SwingWorker notifies any PropertyChangeListeners
about the state property change to StateValue.DONE.


SwingWorker is only designed to be executed once.  Executing a
SwingWorker more than once will not result in invoking the
doInBackground method twice.


Sample Usage

The following example illustrates the simplest use case.  Some
processing is done in the background and when done you update a Swing
component.


Say we want to find the "Meaning of Life" and display the result in
a JLabel.



  final JLabel label;
  class MeaningOfLifeFinder extends SwingWorker<String, Object> {
       @Override
      public String doInBackground() {
          return findTheMeaningOfLife();
      }

       @Override
      protected void done() {
          try {
              label.setText(get());
          } catch (Exception ignore) {
          }
      }
  }

  (new MeaningOfLifeFinder()).execute();


The next example is useful in situations where you wish to process data
as it is ready on the Event Dispatch Thread.


Now we want to find the first N prime numbers and display the results in a
JTextArea.  While this is computing, we want to update our
progress in a JProgressBar.  Finally, we also want to print
the prime numbers to System.out.


class PrimeNumbersTask extends
        SwingWorker<List<Integer>, Integer> {
    PrimeNumbersTask(JTextArea textArea, int numbersToFind) {
        //initialize
    }

     @Override
    public List<Integer> doInBackground() {
        while (! enough && ! isCancelled()) {
                number = nextPrimeNumber();
                publish(number);
                setProgress(100 * numbers.size() / numbersToFind);
            }
        }
        return numbers;
    }

     @Override
    protected void process(List<Integer> chunks) {
        for (int number : chunks) {
            textArea.append(number  "\n");
        }
    }
}

JTextArea textArea = new JTextArea();
final JProgressBar progressBar = new JProgressBar(0, 100);
PrimeNumbersTask task = new PrimeNumbersTask(textArea, N);
task.addPropertyChangeListener(
    new PropertyChangeListener() {
        public  void propertyChange(PropertyChangeEvent evt) {
            if ("progress".equals(evt.getPropertyName())) {
                progressBar.setValue((Integer)evt.getNewValue());
            }
        }
    });

task.execute();
System.out.println(task.get()); //prints all prime numbers we have got


Because SwingWorker implements Runnable, a
SwingWorker can be submitted to an
Executor for execution.
raw docstring

javax.swing.table.AbstractTableModel

This abstract class provides default implementations for most of the methods in the TableModel interface. It takes care of the management of listeners and provides some conveniences for generating TableModelEvents and dispatching them to the listeners. To create a concrete TableModel as a subclass of AbstractTableModel you need only provide implementations for the following three methods:

public int getRowCount(); public int getColumnCount(); public Object getValueAt(int row, int column);

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

This abstract class provides default implementations for most of
 the methods in the TableModel interface. It takes care of
 the management of listeners and provides some conveniences for generating
 TableModelEvents and dispatching them to the listeners.
 To create a concrete TableModel as a subclass of
 AbstractTableModel you need only provide implementations
 for the following three methods:



 public int getRowCount();
 public int getColumnCount();
 public Object getValueAt(int row, int column);

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.core

No vars found in this namespace.

javax.swing.table.DefaultTableCellRenderer

The standard class for rendering (displaying) individual cells in a JTable.

Implementation Note: This class inherits from JLabel, a standard component class. However JTable employs a unique mechanism for rendering its cells and therefore requires some slightly modified behavior from its cell renderer. The table class defines a single cell renderer and uses it as a as a rubber-stamp for rendering all cells in the table; it renders the first cell, changes the contents of that cell renderer, shifts the origin to the new location, re-draws it, and so on. The standard JLabel component was not designed to be used this way and we want to avoid triggering a revalidate each time the cell is drawn. This would greatly decrease performance because the revalidate message would be passed up the hierarchy of the container to determine whether any other components would be affected. As the renderer is only parented for the lifetime of a painting operation we similarly want to avoid the overhead associated with walking the hierarchy for painting operations. So this class overrides the validate, invalidate, revalidate, repaint, and firePropertyChange methods to be no-ops and override the isOpaque method solely to improve performance. If you write your own renderer, please keep this performance consideration in mind.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The standard class for rendering (displaying) individual cells
in a JTable.


Implementation Note:
This class inherits from JLabel, a standard component class.
However JTable employs a unique mechanism for rendering
its cells and therefore requires some slightly modified behavior
from its cell renderer.
The table class defines a single cell renderer and uses it as a
as a rubber-stamp for rendering all cells in the table;
it renders the first cell,
changes the contents of that cell renderer,
shifts the origin to the new location, re-draws it, and so on.
The standard JLabel component was not
designed to be used this way and we want to avoid
triggering a revalidate each time the
cell is drawn. This would greatly decrease performance because the
revalidate message would be
passed up the hierarchy of the container to determine whether any other
components would be affected.
As the renderer is only parented for the lifetime of a painting operation
we similarly want to avoid the overhead associated with walking the
hierarchy for painting operations.
So this class
overrides the validate, invalidate,
revalidate, repaint, and
firePropertyChange methods to be
no-ops and override the isOpaque method solely to improve
performance.  If you write your own renderer,
please keep this performance consideration in mind.


Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.DefaultTableCellRenderer$UIResource

A subclass of DefaultTableCellRenderer that implements UIResource. DefaultTableCellRenderer doesn't implement UIResource directly so that applications can safely override the cellRenderer property with DefaultTableCellRenderer 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A subclass of DefaultTableCellRenderer that
implements UIResource.
DefaultTableCellRenderer doesn't implement
UIResource
directly so that applications can safely override the
cellRenderer property with
DefaultTableCellRenderer 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.DefaultTableColumnModel

The standard column-handler for a JTable.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The standard column-handler for a JTable.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.DefaultTableModel

This is an implementation of TableModel that uses a Vector of Vectors to store the cell value objects.

Warning: DefaultTableModel returns a column class of Object. When DefaultTableModel is used with a TableRowSorter this will result in extensive use of toString, which for non-String data types is expensive. If you use DefaultTableModel with a TableRowSorter you are strongly encouraged to override getColumnClass to return the appropriate type.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

This is an implementation of TableModel that
uses a Vector of Vectors to store the
cell value objects.

Warning: DefaultTableModel returns a
column class of Object.  When
DefaultTableModel is used with a
TableRowSorter this will result in extensive use of
toString, which for non-String data types
is expensive.  If you use DefaultTableModel with a
TableRowSorter you are strongly encouraged to override
getColumnClass to return the appropriate type.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.JTableHeader

This is the object which manages the header of the JTable.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

This is the object which manages the header of the JTable.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.TableCellEditor

This interface defines the method any object that would like to be an editor of values for components such as JListBox, JComboBox, JTree, or JTable needs to implement.

This interface defines the method any object that would like to be
an editor of values for components such as JListBox,
JComboBox, JTree, or JTable
needs to implement.
raw docstring

javax.swing.table.TableCellRenderer

This interface defines the method required by any object that would like to be a renderer for cells in a JTable.

This interface defines the method required by any object that
would like to be a renderer for cells in a JTable.
raw docstring

javax.swing.table.TableColumn

A TableColumn represents all the attributes of a column in a JTable, such as width, resizability, minimum and maximum width. In addition, the TableColumn provides slots for a renderer and an editor that can be used to display and edit the values in this column.

It is also possible to specify renderers and editors on a per type basis rather than a per column basis - see the setDefaultRenderer method in the JTable class. This default mechanism is only used when the renderer (or editor) in the TableColumn is null.

The TableColumn stores the link between the columns in the JTable and the columns in the TableModel. The modelIndex is the column in the TableModel, which will be queried for the data values for the cells in this column. As the column moves around in the view this modelIndex does not change.

Note: Some implementations may assume that all TableColumnModels are unique, therefore we would recommend that the same TableColumn instance not be added more than once to a TableColumnModel. To show TableColumns with the same column of data from the model, create a new instance with the same modelIndex.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A TableColumn represents all the attributes of a column in a
 JTable, such as width, resizability, minimum and maximum width.
 In addition, the TableColumn provides slots for a renderer and
 an editor that can be used to display and edit the values in this column.

 It is also possible to specify renderers and editors on a per type basis
 rather than a per column basis - see the
 setDefaultRenderer method in the JTable class.
 This default mechanism is only used when the renderer (or
 editor) in the TableColumn is null.

 The TableColumn stores the link between the columns in the
 JTable and the columns in the TableModel.
 The modelIndex is the column in the
 TableModel, which will be queried for the data values for the
 cells in this column. As the column moves around in the view this
 modelIndex does not change.

Note: Some implementations may assume that all
   TableColumnModels are unique, therefore we would
   recommend that the same TableColumn instance
   not be added more than once to a TableColumnModel.
   To show TableColumns with the same column of
   data from the model, create a new instance with the same
   modelIndex.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.table.TableModel

The TableModel interface specifies the methods the JTable will use to interrogate a tabular data model.

The JTable can be set up to display any data model which implements the TableModel interface with a couple of lines of code:

 TableModel myData = new MyTableModel();
 JTable table = new JTable(myData);

For further documentation, see Creating a Table Model in The Java Tutorial.

The TableModel interface specifies the methods the
 JTable will use to interrogate a tabular data model.

 The JTable can be set up to display any data
 model which implements the
 TableModel interface with a couple of lines of code:


     TableModel myData = new MyTableModel();
     JTable table = new JTable(myData);

For further documentation, see Creating a Table Model
in The Java Tutorial.
raw docstring

javax.swing.table.TableRowSorter

An implementation of RowSorter that provides sorting and filtering using a TableModel. The following example shows adding sorting to a JTable:

TableModel myModel = createMyTableModel(); JTable table = new JTable(myModel); table.setRowSorter(new TableRowSorter(myModel)); This will do all the wiring such that when the user does the appropriate gesture, such as clicking on the column header, the table will visually sort.

JTable's row-based methods and JTable's selection model refer to the view and not the underlying model. Therefore, it is necessary to convert between the two. For example, to get the selection in terms of myModel you need to convert the indices:

int[] selection = table.getSelectedRows(); for (int i = 0; i < selection.length; i++) { selection[i] = table.convertRowIndexToModel(selection[i]); } Similarly to select a row in JTable based on a coordinate from the underlying model do the inverse:

table.setRowSelectionInterval(table.convertRowIndexToView(row), table.convertRowIndexToView(row));

The previous example assumes you have not enabled filtering. If you have enabled filtering convertRowIndexToView will return -1 for locations that are not visible in the view.

TableRowSorter uses Comparators for doing comparisons. The following defines how a Comparator is chosen for a column:

If a Comparator has been specified for the column by the setComparator method, use it. If the column class as returned by getColumnClass is String, use the Comparator returned by Collator.getInstance(). If the column class implements Comparable, use a Comparator that invokes the compareTo method. If a TableStringConverter has been specified, use it to convert the values to Strings and then use the Comparator returned by Collator.getInstance(). Otherwise use the Comparator returned by Collator.getInstance() on the results from calling toString on the objects.

In addition to sorting TableRowSorter provides the ability to filter. A filter is specified using the setFilter method. The following example will only show rows containing the string "foo":

TableModel myModel = createMyTableModel(); TableRowSorter sorter = new TableRowSorter(myModel); sorter.setRowFilter(RowFilter.regexFilter(".foo.")); JTable table = new JTable(myModel); table.setRowSorter(sorter);

If the underlying model structure changes (the modelStructureChanged method is invoked) the following are reset to their default values: Comparators by column, current sort order, and whether each column is sortable. The default sort order is natural (the same as the model), and columns are sortable by default.

TableRowSorter has one formal type parameter: the type of the model. Passing in a type that corresponds exactly to your model allows you to filter based on your model without casting. Refer to the documentation of RowFilter for an example of this.

WARNING: DefaultTableModel returns a column class of Object. As such all comparisons will be done using toString. This may be unnecessarily expensive. If the column only contains one type of value, such as an Integer, you should override getColumnClass and return the appropriate Class. This will dramatically increase the performance of this class.

An implementation of RowSorter that provides sorting
and filtering using a TableModel.
The following example shows adding sorting to a JTable:


  TableModel myModel = createMyTableModel();
  JTable table = new JTable(myModel);
  table.setRowSorter(new TableRowSorter(myModel));
This will do all the wiring such that when the user does the appropriate
gesture, such as clicking on the column header, the table will
visually sort.

JTable's row-based methods and JTable's
selection model refer to the view and not the underlying
model. Therefore, it is necessary to convert between the two.  For
example, to get the selection in terms of myModel
you need to convert the indices:


  int[] selection = table.getSelectedRows();
  for (int i = 0; i < selection.length; i++) {
    selection[i] = table.convertRowIndexToModel(selection[i]);
  }
Similarly to select a row in JTable based on
a coordinate from the underlying model do the inverse:


  table.setRowSelectionInterval(table.convertRowIndexToView(row),
                                table.convertRowIndexToView(row));

The previous example assumes you have not enabled filtering.  If you
have enabled filtering convertRowIndexToView will return
-1 for locations that are not visible in the view.

TableRowSorter uses Comparators for doing
comparisons. The following defines how a Comparator is
chosen for a column:

If a Comparator has been specified for the column by the
    setComparator method, use it.
If the column class as returned by getColumnClass is
    String, use the Comparator returned by
    Collator.getInstance().
If the column class implements Comparable, use a
    Comparator that invokes the compareTo
    method.
If a TableStringConverter has been specified, use it
    to convert the values to Strings and then use the
    Comparator returned by Collator.getInstance().
Otherwise use the Comparator returned by
    Collator.getInstance() on the results from
    calling toString on the objects.


In addition to sorting TableRowSorter provides the ability
to filter.  A filter is specified using the setFilter
method. The following example will only show rows containing the string
"foo":


  TableModel myModel = createMyTableModel();
  TableRowSorter sorter = new TableRowSorter(myModel);
  sorter.setRowFilter(RowFilter.regexFilter(".*foo.*"));
  JTable table = new JTable(myModel);
  table.setRowSorter(sorter);

If the underlying model structure changes (the
modelStructureChanged method is invoked) the following
are reset to their default values: Comparators by
column, current sort order, and whether each column is sortable. The default
sort order is natural (the same as the model), and columns are
sortable by default.

TableRowSorter has one formal type parameter: the type
of the model.  Passing in a type that corresponds exactly to your
model allows you to filter based on your model without casting.
Refer to the documentation of RowFilter for an example
of this.

WARNING: DefaultTableModel returns a column
class of Object.  As such all comparisons will
be done using toString.  This may be unnecessarily
expensive.  If the column only contains one type of value, such as
an Integer, you should override getColumnClass and
return the appropriate Class.  This will dramatically
increase the performance of this class.
raw docstring

javax.swing.table.TableStringConverter

TableStringConverter is used to convert objects from the model into strings. This is useful in filtering and searching when the model returns objects that do not have meaningful toString implementations.

TableStringConverter is used to convert objects from the model into
strings.  This is useful in filtering and searching when the model returns
objects that do not have meaningful toString implementations.
raw docstring

javax.swing.text.AbstractDocument

An implementation of the document interface to serve as a basis for implementing various kinds of documents. At this level there is very little policy, so there is a corresponding increase in difficulty of use.

This class implements a locking mechanism for the document. It allows multiple readers or one writer, and writers must wait until all observers of the document have been notified of a previous change before beginning another mutation to the document. The read lock is acquired and released using the render method. A write lock is acquired by the methods that mutate the document, and are held for the duration of the method call. Notification is done on the thread that produced the mutation, and the thread has full read access to the document for the duration of the notification, but other readers are kept out until the notification has finished. The notification is a beans event notification which does not allow any further mutations until all listeners have been notified.

Any models subclassed from this class and used in conjunction with a text component that has a look and feel implementation that is derived from BasicTextUI may be safely updated asynchronously, because all access to the View hierarchy is serialized by BasicTextUI if the document is of type AbstractDocument. The locking assumes that an independent thread will access the View hierarchy only from the DocumentListener methods, and that there will be only one event thread active at a time.

If concurrency support is desired, there are the following additional implications. The code path for any DocumentListener implementation and any UndoListener implementation must be threadsafe, and not access the component lock if trying to be safe from deadlocks. The repaint and revalidate methods on JComponent are safe.

AbstractDocument models an implied break at the end of the document. Among other things this allows you to position the caret after the last character. As a result of this, getLength returns one less than the length of the Content. If you create your own Content, be sure and initialize it to have an additional character. Refer to StringContent and GapContent for examples of this. Another implication of this is that Elements that model the implied end character will have an endOffset == (getLength() 1). For example, in DefaultStyledDocument getParagraphElement(getLength()).getEndOffset() == getLength() 1 .

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An implementation of the document interface to serve as a
basis for implementing various kinds of documents.  At this
level there is very little policy, so there is a corresponding
increase in difficulty of use.

This class implements a locking mechanism for the document.  It
allows multiple readers or one writer, and writers must wait until
all observers of the document have been notified of a previous
change before beginning another mutation to the document.  The
read lock is acquired and released using the render
method.  A write lock is acquired by the methods that mutate the
document, and are held for the duration of the method call.
Notification is done on the thread that produced the mutation,
and the thread has full read access to the document for the
duration of the notification, but other readers are kept out
until the notification has finished.  The notification is a
beans event notification which does not allow any further
mutations until all listeners have been notified.

Any models subclassed from this class and used in conjunction
with a text component that has a look and feel implementation
that is derived from BasicTextUI may be safely updated
asynchronously, because all access to the View hierarchy
is serialized by BasicTextUI if the document is of type
AbstractDocument.  The locking assumes that an
independent thread will access the View hierarchy only from
the DocumentListener methods, and that there will be only
one event thread active at a time.

If concurrency support is desired, there are the following
additional implications.  The code path for any DocumentListener
implementation and any UndoListener implementation must be threadsafe,
and not access the component lock if trying to be safe from deadlocks.
The repaint and revalidate methods
on JComponent are safe.

AbstractDocument models an implied break at the end of the document.
Among other things this allows you to position the caret after the last
character. As a result of this, getLength returns one less
than the length of the Content. If you create your own Content, be
sure and initialize it to have an additional character. Refer to
StringContent and GapContent for examples of this. Another implication
of this is that Elements that model the implied end character will have
an endOffset == (getLength()  1). For example, in DefaultStyledDocument
getParagraphElement(getLength()).getEndOffset() == getLength()  1
.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.AbstractDocument$AttributeContext

An interface that can be used to allow MutableAttributeSet implementations to use pluggable attribute compression techniques. Each mutation of the attribute set can be used to exchange a previous AttributeSet instance with another, preserving the possibility of the AttributeSet remaining immutable. An implementation is provided by the StyleContext class.

The Element implementations provided by this class use this interface to provide their MutableAttributeSet implementations, so that different AttributeSet compression techniques can be employed. The method getAttributeContext should be implemented to return the object responsible for implementing the desired compression technique.

An interface that can be used to allow MutableAttributeSet
implementations to use pluggable attribute compression
techniques.  Each mutation of the attribute set can be
used to exchange a previous AttributeSet instance with
another, preserving the possibility of the AttributeSet
remaining immutable.  An implementation is provided by
the StyleContext class.

The Element implementations provided by this class use
this interface to provide their MutableAttributeSet
implementations, so that different AttributeSet compression
techniques can be employed.  The method
getAttributeContext should be implemented to
return the object responsible for implementing the desired
compression technique.
raw docstring

javax.swing.text.AbstractDocument$Content

Interface to describe a sequence of character content that can be edited. Implementations may or may not support a history mechanism which will be reflected by whether or not mutations return an UndoableEdit implementation.

Interface to describe a sequence of character content that
can be edited.  Implementations may or may not support a
history mechanism which will be reflected by whether or not
mutations return an UndoableEdit implementation.
raw docstring

javax.swing.text.AbstractDocument$ElementEdit

An implementation of ElementChange that can be added to the document event.

An implementation of ElementChange that can be added to the document
event.
raw docstring

javax.swing.text.AbstractWriter

AbstractWriter is an abstract class that actually does the work of writing out the element tree including the attributes. In terms of how much is written out per line, the writer defaults to 100. But this value can be set by subclasses.

AbstractWriter is an abstract class that actually
does the work of writing out the element tree
including the attributes.  In terms of how much is
written out per line, the writer defaults to 100.
But this value can be set by subclasses.
raw docstring

javax.swing.text.AsyncBoxView

A box that does layout asynchronously. This is useful to keep the GUI event thread moving by not doing any layout on it. The layout is done on a granularity of operations on the child views. After each child view is accessed for some part of layout (a potentially time consuming operation) the remaining tasks can be abandoned or a new higher priority task (i.e. to service a synchronous request or a visible area) can be taken on.

While the child view is being accessed a read lock is acquired on the associated document so that the model is stable while being accessed.

A box that does layout asynchronously.  This
is useful to keep the GUI event thread moving by
not doing any layout on it.  The layout is done
on a granularity of operations on the child views.
After each child view is accessed for some part
of layout (a potentially time consuming operation)
the remaining tasks can be abandoned or a new higher
priority task (i.e. to service a synchronous request
or a visible area) can be taken on.

While the child view is being accessed
a read lock is acquired on the associated document
so that the model is stable while being accessed.
raw docstring

javax.swing.text.AttributeSet

A collection of unique attributes. This is a read-only, immutable interface. An attribute is basically a key and a value assigned to the key. The collection may represent something like a style run, a logical style, etc. These are generally used to describe features that will contribute to some graphical representation such as a font. The set of possible keys is unbounded and can be anything. Typically View implementations will respond to attribute definitions and render something to represent the attributes.

Attributes can potentially resolve in a hierarchy. If a key doesn't resolve locally, and a resolving parent exists, the key will be resolved through the parent.

A collection of unique attributes.  This is a read-only,
immutable interface.  An attribute is basically a key and
a value assigned to the key.  The collection may represent
something like a style run, a logical style, etc.  These
are generally used to describe features that will contribute
to some graphical representation such as a font.  The
set of possible keys is unbounded and can be anything.
Typically View implementations will respond to attribute
definitions and render something to represent the attributes.

Attributes can potentially resolve in a hierarchy.  If a
key doesn't resolve locally, and a resolving parent
exists, the key will be resolved through the parent.
raw docstring

javax.swing.text.AttributeSet$CharacterAttribute

This interface is the type signature that is expected to be present on any attribute key that contributes to character level presentation. This would be any attribute that applies to a so-called run of style.

This interface is the type signature that is expected
to be present on any attribute key that contributes to
character level presentation.  This would be any attribute
that applies to a so-called run of
style.
raw docstring

No vars found in this namespace.

javax.swing.text.AttributeSet$ColorAttribute

This interface is the type signature that is expected to be present on any attribute key that contributes to presentation of color.

This interface is the type signature that is expected
to be present on any attribute key that contributes to
presentation of color.
raw docstring

No vars found in this namespace.

javax.swing.text.AttributeSet$FontAttribute

This interface is the type signature that is expected to be present on any attribute key that contributes to the determination of what font to use to render some text. This is not considered to be a closed set, the definition can change across version of the platform and can be amended by additional user added entries that correspond to logical settings that are specific to some type of content.

This interface is the type signature that is expected
to be present on any attribute key that contributes to
the determination of what font to use to render some
text.  This is not considered to be a closed set, the
definition can change across version of the platform and can
be amended by additional user added entries that
correspond to logical settings that are specific to
some type of content.
raw docstring

No vars found in this namespace.

javax.swing.text.AttributeSet$ParagraphAttribute

This interface is the type signature that is expected to be present on any attribute key that contributes to the paragraph level presentation.

This interface is the type signature that is expected
to be present on any attribute key that contributes to
the paragraph level presentation.
raw docstring

No vars found in this namespace.

javax.swing.text.BadLocationException

This exception is to report bad locations within a document model (that is, attempts to reference a location that doesn't exist).

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

This exception is to report bad locations within a document model
(that is, attempts to reference a location that doesn't exist).

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.BoxView

A view that arranges its children into a box shape by tiling its children along an axis. The box is somewhat like that found in TeX where there is alignment of the children, flexibility of the children is considered, etc. This is a building block that might be useful to represent things like a collection of lines, paragraphs, lists, columns, pages, etc. The axis along which the children are tiled is considered the major axis. The orthogonal axis is the minor axis.

Layout for each axis is handled separately by the methods layoutMajorAxis and layoutMinorAxis. Subclasses can change the layout algorithm by reimplementing these methods. These methods will be called as necessary depending upon whether or not there is cached layout information and the cache is considered valid. These methods are typically called if the given size along the axis changes, or if layoutChanged is called to force an updated layout. The layoutChanged method invalidates cached layout information, if there is any. The requirements published to the parent view are calculated by the methods calculateMajorAxisRequirements and calculateMinorAxisRequirements. If the layout algorithm is changed, these methods will likely need to be reimplemented.

A view that arranges its children into a box shape by tiling
its children along an axis.  The box is somewhat like that
found in TeX where there is alignment of the
children, flexibility of the children is considered, etc.
This is a building block that might be useful to represent
things like a collection of lines, paragraphs,
lists, columns, pages, etc.  The axis along which the children are tiled is
considered the major axis.  The orthogonal axis is the minor axis.

Layout for each axis is handled separately by the methods
layoutMajorAxis and layoutMinorAxis.
Subclasses can change the layout algorithm by
reimplementing these methods.    These methods will be called
as necessary depending upon whether or not there is cached
layout information and the cache is considered
valid.  These methods are typically called if the given size
along the axis changes, or if layoutChanged is
called to force an updated layout.  The layoutChanged
method invalidates cached layout information, if there is any.
The requirements published to the parent view are calculated by
the methods calculateMajorAxisRequirements
and  calculateMinorAxisRequirements.
If the layout algorithm is changed, these methods will
likely need to be reimplemented.
raw docstring

javax.swing.text.Caret

A place within a document view that represents where things can be inserted into the document model. A caret has a position in the document referred to as a dot. The dot is where the caret is currently located in the model. There is a second position maintained by the caret that represents the other end of a selection called mark. If there is no selection the dot and mark will be equal. If a selection exists, the two values will be different.

The dot can be placed by either calling setDot or moveDot. Setting the dot has the effect of removing any selection that may have previously existed. The dot and mark will be equal. Moving the dot has the effect of creating a selection as the mark is left at whatever position it previously had.

A place within a document view that represents where
things can be inserted into the document model.  A caret
has a position in the document referred to as a dot.
The dot is where the caret is currently located in the
model.  There is
a second position maintained by the caret that represents
the other end of a selection called mark.  If there is
no selection the dot and mark will be equal.  If a selection
exists, the two values will be different.

The dot can be placed by either calling
setDot or moveDot.  Setting
the dot has the effect of removing any selection that may
have previously existed.  The dot and mark will be equal.
Moving the dot has the effect of creating a selection as
the mark is left at whatever position it previously had.
raw docstring

javax.swing.text.ChangedCharSetException

ChangedCharSetException as the name indicates is an exception thrown when the charset is changed.

ChangedCharSetException as the name indicates is an exception
thrown when the charset is changed.
raw docstring

javax.swing.text.ComponentView

Component decorator that implements the view interface. The entire element is used to represent the component. This acts as a gateway from the display-only View implementations to interactive lightweight components (ie it allows components to be embedded into the View hierarchy).

The component is placed relative to the text baseline according to the value returned by Component.getAlignmentY. For Swing components this value can be conveniently set using the method JComponent.setAlignmentY. For example, setting a value of 0.75 will cause 75 percent of the component to be above the baseline, and 25 percent of the component to be below the baseline.

This class is implemented to do the extra work necessary to work properly in the presence of multiple threads (i.e. from asynchronous notification of model changes for example) by ensuring that all component access is done on the event thread.

The component used is determined by the return value of the createComponent method. The default implementation of this method is to return the component held as an attribute of the element (by calling StyleConstants.getComponent). A limitation of this behavior is that the component cannot be used by more than one text component (i.e. with a shared model). Subclasses can remove this constraint by implementing the createComponent to actually create a component based upon some kind of specification contained in the attributes. The ObjectView class in the html package is an example of a ComponentView implementation that supports multiple component views of a shared model.

Component decorator that implements the view interface.  The
entire element is used to represent the component.  This acts
as a gateway from the display-only View implementations to
interactive lightweight components (ie it allows components
to be embedded into the View hierarchy).

The component is placed relative to the text baseline
according to the value returned by
Component.getAlignmentY.  For Swing components
this value can be conveniently set using the method
JComponent.setAlignmentY.  For example, setting
a value of 0.75 will cause 75 percent of the
component to be above the baseline, and 25 percent of the
component to be below the baseline.

This class is implemented to do the extra work necessary to
work properly in the presence of multiple threads (i.e. from
asynchronous notification of model changes for example) by
ensuring that all component access is done on the event thread.

The component used is determined by the return value of the
createComponent method.  The default implementation of this
method is to return the component held as an attribute of
the element (by calling StyleConstants.getComponent).  A
limitation of this behavior is that the component cannot
be used by more than one text component (i.e. with a shared
model).  Subclasses can remove this constraint by implementing
the createComponent to actually create a component based upon
some kind of specification contained in the attributes.  The
ObjectView class in the html package is an example of a
ComponentView implementation that supports multiple component
views of a shared model.
raw docstring

javax.swing.text.CompositeView

CompositeView is an abstract View implementation which manages one or more child views. (Note that CompositeView is intended for managing relatively small numbers of child views.) CompositeView is intended to be used as a starting point for View implementations, such as BoxView, that will contain child Views. Subclasses that wish to manage the collection of child Views should use the replace(int, int, javax.swing.text.View[]) method. As View invokes replace during DocumentListener notification, you normally won't need to directly invoke replace.

While CompositeView does not impose a layout policy on its child Views, it does allow for inseting the child Views it will contain. The insets can be set by either setInsets(short, short, short, short) or setParagraphInsets(javax.swing.text.AttributeSet).

In addition to the abstract methods of View, subclasses of CompositeView will need to override:

isBefore(int, int, java.awt.Rectangle) - Used to test if a given View location is before the visual space of the CompositeView. isAfter(int, int, java.awt.Rectangle) - Used to test if a given View location is after the visual space of the CompositeView. getViewAtPoint(int, int, java.awt.Rectangle) - Returns the view at a given visual location. childAllocation(int, java.awt.Rectangle) - Returns the bounds of a particular child View. getChildAllocation will invoke childAllocation after offseting the bounds by the Insets of the CompositeView.

CompositeView is an abstract View
implementation which manages one or more child views.
(Note that CompositeView is intended
for managing relatively small numbers of child views.)
CompositeView is intended to be used as
a starting point for View implementations,
such as BoxView, that will contain child
Views. Subclasses that wish to manage the
collection of child Views should use the
replace(int, int, javax.swing.text.View[]) method.  As View invokes
replace during DocumentListener
notification, you normally won't need to directly
invoke replace.

While CompositeView
does not impose a layout policy on its child Views,
it does allow for inseting the child Views
it will contain.  The insets can be set by either
setInsets(short, short, short, short) or setParagraphInsets(javax.swing.text.AttributeSet).

In addition to the abstract methods of
View,
subclasses of CompositeView will need to
override:

isBefore(int, int, java.awt.Rectangle) - Used to test if a given
    View location is before the visual space
    of the CompositeView.
isAfter(int, int, java.awt.Rectangle) - Used to test if a given
    View location is after the visual space
    of the CompositeView.
getViewAtPoint(int, int, java.awt.Rectangle) - Returns the view at
    a given visual location.
childAllocation(int, java.awt.Rectangle) - Returns the bounds of
    a particular child View.
    getChildAllocation will invoke
    childAllocation after offseting
    the bounds by the Insets of the
    CompositeView.
raw docstring

javax.swing.text.core

No vars found in this namespace.

javax.swing.text.DateFormatter

DateFormatter is an InternationalFormatter that does its formatting by way of an instance of java.text.DateFormat.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

DateFormatter is an InternationalFormatter that does its
formatting by way of an instance of java.text.DateFormat.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultCaret

A default implementation of Caret. The caret is rendered as a vertical line in the color specified by the CaretColor property of the associated JTextComponent. It can blink at the rate specified by the BlinkRate property.

This implementation expects two sources of asynchronous notification. The timer thread fires asynchronously, and causes the caret to simply repaint the most recent bounding box. The caret also tracks change as the document is modified. Typically this will happen on the event dispatch thread as a result of some mouse or keyboard event. The caret behavior on both synchronous and asynchronous documents updates is controlled by UpdatePolicy property. The repaint of the new caret location will occur on the event thread in any case, as calls to modelToView are only safe on the event thread.

The caret acts as a mouse and focus listener on the text component it has been installed in, and defines the caret semantics based upon those events. The listener methods can be reimplemented to change the semantics. By default, the first mouse button will be used to set focus and caret position. Dragging the mouse pointer with the first mouse button will sweep out a selection that is contiguous in the model. If the associated text component is editable, the caret will become visible when focus is gained, and invisible when focus is lost.

The Highlighter bound to the associated text component is used to render the selection by default. Selection appearance can be customized by supplying a painter to use for the highlights. By default a painter is used that will render a solid color as specified in the associated text component in the SelectionColor property. This can easily be changed by reimplementing the getSelectionPainter method.

A customized caret appearance can be achieved by reimplementing the paint method. If the paint method is changed, the damage method should also be reimplemented to cause a repaint for the area needed to render the caret. The caret extends the Rectangle class which is used to hold the bounding box for where the caret was last rendered. This enables the caret to repaint in a thread-safe manner when the caret moves without making a call to modelToView which is unstable between model updates and view repair (i.e. the order of delivery to DocumentListeners is not guaranteed).

The magic caret position is set to null when the caret position changes. A timer is used to determine the new location (after the caret change). When the timer fires, if the magic caret position is still null it is reset to the current caret position. Any actions that change the caret position and want the magic caret position to remain the same, must remember the magic caret position, change the cursor, and then set the magic caret position to its original value. This has the benefit that only actions that want the magic caret position to persist (such as open/down) need to know about 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A default implementation of Caret.  The caret is rendered as
a vertical line in the color specified by the CaretColor property
of the associated JTextComponent.  It can blink at the rate specified
by the BlinkRate property.

This implementation expects two sources of asynchronous notification.
The timer thread fires asynchronously, and causes the caret to simply
repaint the most recent bounding box.  The caret also tracks change
as the document is modified.  Typically this will happen on the
event dispatch thread as a result of some mouse or keyboard event.
The caret behavior on both synchronous and asynchronous documents updates
is controlled by UpdatePolicy property. The repaint of the
new caret location will occur on the event thread in any case, as calls to
modelToView are only safe on the event thread.

The caret acts as a mouse and focus listener on the text component
it has been installed in, and defines the caret semantics based upon
those events.  The listener methods can be reimplemented to change the
semantics.
By default, the first mouse button will be used to set focus and caret
position.  Dragging the mouse pointer with the first mouse button will
sweep out a selection that is contiguous in the model.  If the associated
text component is editable, the caret will become visible when focus
is gained, and invisible when focus is lost.

The Highlighter bound to the associated text component is used to
render the selection by default.
Selection appearance can be customized by supplying a
painter to use for the highlights.  By default a painter is used that
will render a solid color as specified in the associated text component
in the SelectionColor property.  This can easily be changed
by reimplementing the
getSelectionPainter
method.

A customized caret appearance can be achieved by reimplementing
the paint method.  If the paint method is changed, the damage method
should also be reimplemented to cause a repaint for the area needed
to render the caret.  The caret extends the Rectangle class which
is used to hold the bounding box for where the caret was last rendered.
This enables the caret to repaint in a thread-safe manner when the
caret moves without making a call to modelToView which is unstable
between model updates and view repair (i.e. the order of delivery
to DocumentListeners is not guaranteed).

The magic caret position is set to null when the caret position changes.
A timer is used to determine the new location (after the caret change).
When the timer fires, if the magic caret position is still null it is
reset to the current caret position. Any actions that change
the caret position and want the magic caret position to remain the
same, must remember the magic caret position, change the cursor, and
then set the magic caret position to its original value. This has the
benefit that only actions that want the magic caret position to persist
(such as open/down) need to know about 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultEditorKit

This is the set of things needed by a text component to be a reasonably functioning editor for some type of text document. This implementation provides a default implementation which treats text as plain text and provides a minimal set of actions for a simple editor.

Newlines

There are two properties which deal with newlines. The system property, line.separator, is defined to be platform-dependent, either "\n", "\r", or "\r\n". There is also a property defined in DefaultEditorKit, called EndOfLineStringProperty, which is defined automatically when a document is loaded, to be the first occurrence of any of the newline characters. When a document is loaded, EndOfLineStringProperty is set appropriately, and when the document is written back out, the EndOfLineStringProperty is used. But while the document is in memory, the "\n" character is used to define a newline, regardless of how the newline is defined when the document is on disk. Therefore, for searching purposes, "\n" should always be used. When a new document is created, and the EndOfLineStringProperty has not been defined, it will use the System property when writing out the document. Note that EndOfLineStringProperty is set on the Document using the get/putProperty methods. Subclasses may override this behavior.

This is the set of things needed by a text component
to be a reasonably functioning editor for some type
of text document.  This implementation provides a default
implementation which treats text as plain text and
provides a minimal set of actions for a simple editor.


Newlines

There are two properties which deal with newlines.  The
system property, line.separator, is defined to be
platform-dependent, either "\n", "\r", or "\r\n".  There is also
a property defined in DefaultEditorKit, called
EndOfLineStringProperty,
which is defined automatically when a document is loaded, to be
the first occurrence of any of the newline characters.
When a document is loaded, EndOfLineStringProperty
is set appropriately, and when the document is written back out, the
EndOfLineStringProperty is used.  But while the document
is in memory, the "\n" character is used to define a
newline, regardless of how the newline is defined when
the document is on disk.  Therefore, for searching purposes,
"\n" should always be used.  When a new document is created,
and the EndOfLineStringProperty has not been defined,
it will use the System property when writing out the
document.
Note that EndOfLineStringProperty is set
on the Document using the get/putProperty
methods.  Subclasses may override this behavior.
raw docstring

javax.swing.text.DefaultEditorKit$BeepAction

Creates a beep.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Creates a beep.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultEditorKit$CopyAction

Copies the selected region and place its contents into the system clipboard.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Copies the selected region and place its contents
into the system clipboard.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultEditorKit$CutAction

Cuts the selected region and place its contents into the system clipboard.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Cuts the selected region and place its contents
into the system clipboard.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultEditorKit$DefaultKeyTypedAction

The action that is executed by default if a key typed event is received and there is no keymap entry. There is a variation across different VM's in what gets sent as a key typed event, and this action tries to filter out the undesired events. This filters the control characters and those with the ALT modifier. It allows Control-Alt sequences through as these form legitimate unicode characters on some PC keyboards.

If the event doesn't get filtered, it will try to insert content into the text editor. The content is fetched from the command string of the ActionEvent. The text entry is done through the replaceSelection method on the target text component. This is the action that will be fired for most text entry tasks.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The action that is executed by default if
a key typed event is received and there
is no keymap entry.  There is a variation across
different VM's in what gets sent as a key typed
event, and this action tries to filter out the undesired
events.  This filters the control characters and those
with the ALT modifier.  It allows Control-Alt sequences
through as these form legitimate unicode characters on
some PC keyboards.

If the event doesn't get filtered, it will try to insert
content into the text editor.  The content is fetched
from the command string of the ActionEvent.  The text
entry is done through the replaceSelection
method on the target text component.  This is the
action that will be fired for most text entry tasks.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultEditorKit$InsertBreakAction

Places a line/paragraph break into the document. If there is a selection, it is removed before the break is added.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Places a line/paragraph break into the document.
If there is a selection, it is removed before
the break is added.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultEditorKit$InsertContentAction

Places content into the associated document. If there is a selection, it is removed before the new content is added.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Places content into the associated document.
If there is a selection, it is removed before
the new content is added.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultEditorKit$InsertTabAction

Places a tab character into the document. If there is a selection, it is removed before the tab is added.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Places a tab character into the document. If there
is a selection, it is removed before the tab is added.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultEditorKit$PasteAction

Pastes the contents of the system clipboard into the selected region, or before the caret if nothing is selected.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Pastes the contents of the system clipboard into the
selected region, or before the caret if nothing is
selected.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultFormatter

DefaultFormatter formats arbitrary objects. Formatting is done by invoking the toString method. In order to convert the value back to a String, your class must provide a constructor that takes a String argument. If no single argument constructor that takes a String is found, the returned value will be the String passed into stringToValue.

Instances of DefaultFormatter can not be used in multiple instances of JFormattedTextField. To obtain a copy of an already configured DefaultFormatter, use the clone 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

DefaultFormatter formats arbitrary objects. Formatting is done
by invoking the toString method. In order to convert the
value back to a String, your class must provide a constructor that
takes a String argument. If no single argument constructor that takes a
String is found, the returned value will be the String passed into
stringToValue.

Instances of DefaultFormatter can not be used in multiple
instances of JFormattedTextField. To obtain a copy of
an already configured DefaultFormatter, use the
clone 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultFormatterFactory

An implementation of JFormattedTextField.AbstractFormatterFactory. DefaultFormatterFactory allows specifying a number of different JFormattedTextField.AbstractFormatters that are to be used. The most important one is the default one (setDefaultFormatter). The default formatter will be used if a more specific formatter could not be found. The following process is used to determine the appropriate formatter to use.

Is the passed in value null? Use the null formatter. Does the JFormattedTextField have focus? Use the edit formatter. Otherwise, use the display formatter. If a non-null AbstractFormatter has not been found, use the default formatter.

The following code shows how to configure a JFormattedTextField with two JFormattedTextField.AbstractFormatters, one for display and one for editing.

JFormattedTextField.AbstractFormatter editFormatter = ...; JFormattedTextField.AbstractFormatter displayFormatter = ...; DefaultFormatterFactory factory = new DefaultFormatterFactory( displayFormatter, displayFormatter, editFormatter); JFormattedTextField tf = new JFormattedTextField(factory);

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An implementation of
JFormattedTextField.AbstractFormatterFactory.
DefaultFormatterFactory allows specifying a number of
different JFormattedTextField.AbstractFormatters that are to
be used.
The most important one is the default one
(setDefaultFormatter). The default formatter will be used
if a more specific formatter could not be found. The following process
is used to determine the appropriate formatter to use.

  Is the passed in value null? Use the null formatter.
  Does the JFormattedTextField have focus? Use the edit
      formatter.
  Otherwise, use the display formatter.
  If a non-null AbstractFormatter has not been found, use
      the default formatter.


The following code shows how to configure a
JFormattedTextField with two
JFormattedTextField.AbstractFormatters, one for display and
one for editing.


JFormattedTextField.AbstractFormatter editFormatter = ...;
JFormattedTextField.AbstractFormatter displayFormatter = ...;
DefaultFormatterFactory factory = new DefaultFormatterFactory(
                displayFormatter, displayFormatter, editFormatter);
JFormattedTextField tf = new JFormattedTextField(factory);

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultHighlighter

Implements the Highlighter interfaces. Implements a simple highlight painter that renders in a solid color.

Implements the Highlighter interfaces.  Implements a simple highlight
painter that renders in a solid color.
raw docstring

javax.swing.text.DefaultHighlighter$DefaultHighlightPainter

Simple highlight painter that fills a highlighted area with a solid color.

Simple highlight painter that fills a highlighted area with
a solid color.
raw docstring

javax.swing.text.DefaultStyledDocument

A document that can be marked up with character and paragraph styles in a manner similar to the Rich Text Format. The element structure for this document represents style crossings for style runs. These style runs are mapped into a paragraph element structure (which may reside in some other structure). The style runs break at paragraph boundaries since logical styles are assigned to paragraph boundaries.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A document that can be marked up with character and paragraph
styles in a manner similar to the Rich Text Format.  The element
structure for this document represents style crossings for
style runs.  These style runs are mapped into a paragraph element
structure (which may reside in some other structure).  The
style runs break at paragraph boundaries since logical styles are
assigned to paragraph boundaries.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.DefaultStyledDocument$AttributeUndoableEdit

An UndoableEdit used to remember AttributeSet changes to an Element.

An UndoableEdit used to remember AttributeSet changes to an
Element.
raw docstring

javax.swing.text.DefaultStyledDocument$ElementSpec

Specification for building 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Specification for building 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.Document

The Document is a container for text that serves as the model for swing text components. The goal for this interface is to scale from very simple needs (a plain text textfield) to complex needs (an HTML or XML document, for example).

Content

At the simplest level, text can be modeled as a linear sequence of characters. To support internationalization, the Swing text model uses unicode characters. The sequence of characters displayed in a text component is generally referred to as the component's content.

To refer to locations within the sequence, the coordinates used are the location between two characters. As the diagram below shows, a location in a text document can be referred to as a position, or an offset. This position is zero-based.

In the example, if the content of a document is the sequence "The quick brown fox," as shown in the preceding diagram, the location just before the word "The" is 0, and the location after the word "The" and before the whitespace that follows it is 3. The entire sequence of characters in the sequence "The" is called a range. The following methods give access to the character data that makes up the content.

getLength() getText(int, int) getText(int, int, javax.swing.text.Segment)

Structure

Text is rarely represented simply as featureless content. Rather, text typically has some sort of structure associated with it. Exactly what structure is modeled is up to a particular Document implementation. It might be as simple as no structure (i.e. a simple text field), or it might be something like diagram below.

The unit of structure (i.e. a node of the tree) is referred to by the Element interface. Each Element can be tagged with a set of attributes. These attributes (name/value pairs) are defined by the AttributeSet interface. The following methods give access to the document structure.

getDefaultRootElement() getRootElements()

Mutations

All documents need to be able to add and remove simple text. Typically, text is inserted and removed via gestures from a keyboard or a mouse. What effect the insertion or removal has upon the document structure is entirely up to the implementation of the document. The following methods are related to mutation of the document content:

insertString(int, java.lang.String, javax.swing.text.AttributeSet) remove(int, int) createPosition(int)

Notification

Mutations to the Document must be communicated to interested observers. The notification of change follows the event model guidelines that are specified for JavaBeans. In the JavaBeans event model, once an event notification is dispatched, all listeners must be notified before any further mutations occur to the source of the event. Further, order of delivery is not guaranteed.

Notification is provided as two separate events, DocumentEvent, and UndoableEditEvent. If a mutation is made to a Document through its api, a DocumentEvent will be sent to all of the registered DocumentListeners. If the Document implementation supports undo/redo capabilities, an UndoableEditEvent will be sent to all of the registered UndoableEditListeners. If an undoable edit is undone, a DocumentEvent should be fired from the Document to indicate it has changed again. In this case however, there should be no UndoableEditEvent generated since that edit is actually the source of the change rather than a mutation to the Document made through its api.

Referring to the above diagram, suppose that the component shown on the left mutates the document object represented by the blue rectangle. The document responds by dispatching a DocumentEvent to both component views and sends an UndoableEditEvent to the listening logic, which maintains a history buffer.

Now suppose that the component shown on the right mutates the same document. Again, the document dispatches a DocumentEvent to both component views and sends an UndoableEditEvent to the listening logic that is maintaining the history buffer.

If the history buffer is then rolled back (i.e. the last UndoableEdit undone), a DocumentEvent is sent to both views, causing both of them to reflect the undone mutation to the document (that is, the removal of the right component's mutation). If the history buffer again rolls back another change, another DocumentEvent is sent to both views, causing them to reflect the undone mutation to the document -- that is, the removal of the left component's mutation.

The methods related to observing mutations to the document are:

addDocumentListener(DocumentListener) removeDocumentListener(DocumentListener) addUndoableEditListener(UndoableEditListener) removeUndoableEditListener(UndoableEditListener)

Properties

Document implementations will generally have some set of properties associated with them at runtime. Two well known properties are the StreamDescriptionProperty, which can be used to describe where the Document came from, and the TitleProperty, which can be used to name the Document. The methods related to the properties are:

getProperty(java.lang.Object) putProperty(java.lang.Object, java.lang.Object)

For more information on the Document class, see The Swing Connection and most particularly the article,

The Element Interface.

 The Document is a container for text that serves
as the model for swing text components.  The goal for this
interface is to scale from very simple needs (a plain text textfield)
to complex needs (an HTML or XML document, for example).

Content

At the simplest level, text can be
modeled as a linear sequence of characters. To support
internationalization, the Swing text model uses
unicode characters.
The sequence of characters displayed in a text component is
generally referred to as the component's content.

To refer to locations within the sequence, the coordinates
used are the location between two characters.  As the diagram
below shows, a location in a text document can be referred to
as a position, or an offset. This position is zero-based.


In the example, if the content of a document is the
sequence "The quick brown fox," as shown in the preceding diagram,
the location just before the word "The" is 0, and the location after
the word "The" and before the whitespace that follows it is 3.
The entire sequence of characters in the sequence "The" is called a
range.
The following methods give access to the character data
that makes up the content.

getLength()
getText(int, int)
getText(int, int, javax.swing.text.Segment)

Structure

Text is rarely represented simply as featureless content. Rather,
text typically has some sort of structure associated with it.
Exactly what structure is modeled is up to a particular Document
implementation.  It might be as simple as no structure (i.e. a
simple text field), or it might be something like diagram below.


The unit of structure (i.e. a node of the tree) is referred to
by the Element interface.  Each Element
can be tagged with a set of attributes.  These attributes
(name/value pairs) are defined by the
AttributeSet interface.
The following methods give access to the document structure.

getDefaultRootElement()
getRootElements()


Mutations

All documents need to be able to add and remove simple text.
Typically, text is inserted and removed via gestures from
a keyboard or a mouse.  What effect the insertion or removal
has upon the document structure is entirely up to the
implementation of the document.
The following methods are related to mutation of the
document content:

insertString(int, java.lang.String, javax.swing.text.AttributeSet)
remove(int, int)
createPosition(int)


Notification

Mutations to the Document must be communicated to
interested observers.  The notification of change follows the event model
guidelines that are specified for JavaBeans.  In the JavaBeans
event model, once an event notification is dispatched, all listeners
must be notified before any further mutations occur to the source
of the event.  Further, order of delivery is not guaranteed.

Notification is provided as two separate events,
DocumentEvent, and
UndoableEditEvent.
If a mutation is made to a Document through its api,
a DocumentEvent will be sent to all of the registered
DocumentListeners.  If the Document
implementation supports undo/redo capabilities, an
UndoableEditEvent will be sent
to all of the registered UndoableEditListeners.
If an undoable edit is undone, a DocumentEvent should be
fired from the Document to indicate it has changed again.
In this case however, there should be no UndoableEditEvent
generated since that edit is actually the source of the change
rather than a mutation to the Document made through its
api.


Referring to the above diagram, suppose that the component shown
on the left mutates the document object represented by the blue
rectangle. The document responds by dispatching a DocumentEvent to
both component views and sends an UndoableEditEvent to the listening
logic, which maintains a history buffer.

Now suppose that the component shown on the right mutates the same
document.  Again, the document dispatches a DocumentEvent to both
component views and sends an UndoableEditEvent to the listening logic
that is maintaining the history buffer.

If the history buffer is then rolled back (i.e. the last UndoableEdit
undone), a DocumentEvent is sent to both views, causing both of them to
reflect the undone mutation to the document (that is, the
removal of the right component's mutation). If the history buffer again
rolls back another change, another DocumentEvent is sent to both views,
causing them to reflect the undone mutation to the document -- that is,
the removal of the left component's mutation.

The methods related to observing mutations to the document are:

addDocumentListener(DocumentListener)
removeDocumentListener(DocumentListener)
addUndoableEditListener(UndoableEditListener)
removeUndoableEditListener(UndoableEditListener)


Properties

Document implementations will generally have some set of properties
associated with them at runtime.  Two well known properties are the
StreamDescriptionProperty,
which can be used to describe where the Document came from,
and the TitleProperty, which can be used to
name the Document.  The methods related to the properties are:

getProperty(java.lang.Object)
putProperty(java.lang.Object, java.lang.Object)


For more information on the Document class, see
The Swing Connection
and most particularly the article,

The Element Interface.
raw docstring

javax.swing.text.DocumentFilter

DocumentFilter, as the name implies, is a filter for the Document mutation methods. When a Document containing a DocumentFilter is modified (either through insert or remove), it forwards the appropriate method invocation to the DocumentFilter. The default implementation allows the modification to occur. Subclasses can filter the modifications by conditionally invoking methods on the superclass, or invoking the necessary methods on the passed in FilterBypass. Subclasses should NOT call back into the Document for the modification instead call into the superclass or the FilterBypass.

When remove or insertString is invoked on the DocumentFilter, the DocumentFilter may callback into the FilterBypass multiple times, or for different regions, but it should not callback into the FilterBypass after returning from the remove or insertString method.

By default, text related document mutation methods such as insertString, replace and remove in AbstractDocument use DocumentFilter when available, and Element related mutation methods such as create, insert and removeElement in DefaultStyledDocument do not use DocumentFilter. If a method doesn't follow these defaults, this must be explicitly stated in the method documentation.

DocumentFilter, as the name implies, is a filter for the
Document mutation methods. When a Document
containing a DocumentFilter is modified (either through
insert or remove), it forwards the appropriate
method invocation to the DocumentFilter. The
default implementation allows the modification to
occur. Subclasses can filter the modifications by conditionally invoking
methods on the superclass, or invoking the necessary methods on
the passed in FilterBypass. Subclasses should NOT call back
into the Document for the modification
instead call into the superclass or the FilterBypass.

When remove or insertString is invoked
on the DocumentFilter, the DocumentFilter
may callback into the
FilterBypass multiple times, or for different regions, but
it should not callback into the FilterBypass after returning
from the remove or insertString method.

By default, text related document mutation methods such as
insertString, replace and remove
in AbstractDocument use DocumentFilter when
available, and Element related mutation methods such as
create, insert and removeElement in
DefaultStyledDocument do not use DocumentFilter.
If a method doesn't follow these defaults, this must be explicitly stated
in the method documentation.
raw docstring

javax.swing.text.DocumentFilter$FilterBypass

Used as a way to circumvent calling back into the Document to change it. Document implementations that wish to support a DocumentFilter must provide an implementation that will not callback into the DocumentFilter when the following methods are invoked from the DocumentFilter.

Used as a way to circumvent calling back into the Document to
change it. Document implementations that wish to support
a DocumentFilter must provide an implementation that will
not callback into the DocumentFilter when the following methods
are invoked from the DocumentFilter.
raw docstring

javax.swing.text.EditorKit

Establishes the set of things needed by a text component to be a reasonably functioning editor for some type of text content. The EditorKit acts as a factory for some kind of policy. For example, an implementation of html and rtf can be provided that is replaceable with other implementations.

A kit can safely store editing state as an instance of the kit will be dedicated to a text component. New kits will normally be created by cloning a prototype kit. The kit will have it's setComponent method called to establish it's relationship with a JTextComponent.

Establishes the set of things needed by a text component
to be a reasonably functioning editor for some type
of text content.  The EditorKit acts as a factory for some
kind of policy.  For example, an implementation
of html and rtf can be provided that is replaceable
with other implementations.

A kit can safely store editing state as an instance
of the kit will be dedicated to a text component.
New kits will normally be created by cloning a
prototype kit.  The kit will have it's
setComponent method called to establish
it's relationship with a JTextComponent.
raw docstring

javax.swing.text.Element

Interface to describe a structural piece of a document. It is intended to capture the spirit of an SGML element.

Interface to describe a structural piece of a document.  It
is intended to capture the spirit of an SGML element.
raw docstring

javax.swing.text.ElementIterator

ElementIterator, as the name suggests, iterates over the Element tree. The constructor can be invoked with either Document or an Element as an argument. If the constructor is invoked with a Document as an argument then the root of the iteration is the return value of document.getDefaultRootElement().

The iteration happens in a depth-first manner. In terms of how boundary conditions are handled: a) if next() is called before first() or current(), the root will be returned. b) next() returns null to indicate the end of the list. c) previous() returns null when the current element is the root or next() has returned null.

The ElementIterator does no locking of the Element tree. This means that it does not track any changes. It is the responsibility of the user of this class, to ensure that no changes happen during element iteration.

Simple usage example:

public void iterate() { ElementIterator it = new ElementIterator(root); Element elem; while (true) { if ((elem = next()) != null) { // process element System.out.println("elem: " elem.getName()); } else { break; } } }

 ElementIterator, as the name suggests, iterates over the Element
tree.  The constructor can be invoked with either Document or an Element
as an argument.  If the constructor is invoked with a Document as an
argument then the root of the iteration is the return value of
document.getDefaultRootElement().

The iteration happens in a depth-first manner.  In terms of how
boundary conditions are handled:
a) if next() is called before first() or current(), the
   root will be returned.
b) next() returns null to indicate the end of the list.
c) previous() returns null when the current element is the root
   or next() has returned null.

The ElementIterator does no locking of the Element tree. This means
that it does not track any changes.  It is the responsibility of the
user of this class, to ensure that no changes happen during element
iteration.

Simple usage example:

   public void iterate() {
       ElementIterator it = new ElementIterator(root);
       Element elem;
       while (true) {
          if ((elem = next()) != null) {
              // process element
              System.out.println("elem: "  elem.getName());
          } else {
              break;
          }
       }
   }
raw docstring

javax.swing.text.FieldView

Extends the multi-line plain text view to be suitable for a single-line editor view. If the view is allocated extra space, the field must adjust for it. If the hosting component is a JTextField, this view will manage the ranges of the associated BoundedRangeModel and will adjust the horizontal allocation to match the current visibility settings of the JTextField.

Extends the multi-line plain text view to be suitable
for a single-line editor view.  If the view is
allocated extra space, the field must adjust for it.
If the hosting component is a JTextField, this view
will manage the ranges of the associated BoundedRangeModel
and will adjust the horizontal allocation to match the
current visibility settings of the JTextField.
raw docstring

javax.swing.text.FlowView

A View that tries to flow it's children into some partially constrained space. This can be used to build things like paragraphs, pages, etc. The flow is made up of the following pieces of functionality.

A logical set of child views, which as used as a layout pool from which a physical view is formed. A strategy for translating the logical view to a physical (flowed) view. Constraints for the strategy to work against. A physical structure, that represents the flow. The children of this view are where the pieces of of the logical views are placed to create the flow.

A View that tries to flow it's children into some
partially constrained space.  This can be used to
build things like paragraphs, pages, etc.  The
flow is made up of the following pieces of functionality.

A logical set of child views, which as used as a
layout pool from which a physical view is formed.
A strategy for translating the logical view to
a physical (flowed) view.
Constraints for the strategy to work against.
A physical structure, that represents the flow.
The children of this view are where the pieces of
of the logical views are placed to create the flow.
raw docstring

javax.swing.text.FlowView$FlowStrategy

Strategy for maintaining the physical form of the flow. The default implementation is completely stateless, and recalculates the entire flow if the layout is invalid on the given FlowView. Alternative strategies can be implemented by subclassing, and might perform incremental repair to the layout or alternative breaking behavior.

Strategy for maintaining the physical form
of the flow.  The default implementation is
completely stateless, and recalculates the
entire flow if the layout is invalid on the
given FlowView.  Alternative strategies can
be implemented by subclassing, and might
perform incremental repair to the layout
or alternative breaking behavior.
raw docstring

javax.swing.text.GapContent

An implementation of the AbstractDocument.Content interface implemented using a gapped buffer similar to that used by emacs. The underlying storage is a array of unicode characters with a gap somewhere. The gap is moved to the location of changes to take advantage of common behavior where most changes are in the same location. Changes that occur at a gap boundary are generally cheap and moving the gap is generally cheaper than moving the array contents directly to accommodate the change.

The positions tracking change are also generally cheap to maintain. The Position implementations (marks) store the array index and can easily calculate the sequential position from the current gap location. Changes only require update to the the marks between the old and new gap boundaries when the gap is moved, so generally updating the marks is pretty cheap. The marks are stored sorted so they can be located quickly with a binary search. This increases the cost of adding a mark, and decreases the cost of keeping the mark updated.

An implementation of the AbstractDocument.Content interface
implemented using a gapped buffer similar to that used by emacs.
The underlying storage is a array of unicode characters with
a gap somewhere.  The gap is moved to the location of changes
to take advantage of common behavior where most changes are
in the same location.  Changes that occur at a gap boundary are
generally cheap and moving the gap is generally cheaper than
moving the array contents directly to accommodate the change.

The positions tracking change are also generally cheap to
maintain.  The Position implementations (marks) store the array
index and can easily calculate the sequential position from
the current gap location.  Changes only require update to the
the marks between the old and new gap boundaries when the gap
is moved, so generally updating the marks is pretty cheap.
The marks are stored sorted so they can be located quickly
with a binary search.  This increases the cost of adding a
mark, and decreases the cost of keeping the mark updated.
raw docstring

javax.swing.text.GlyphView

A GlyphView is a styled chunk of text that represents a view mapped over an element in the text model. This view is generally responsible for displaying text glyphs using character level attributes in some way. An implementation of the GlyphPainter class is used to do the actual rendering and model/view translations. This separates rendering from layout and management of the association with the model.

The view supports breaking for the purpose of formatting. The fragments produced by breaking share the view that has primary responsibility for the element (i.e. they are nested classes and carry only a small amount of state of their own) so they can share its resources.

Since this view represents text that may have tabs embedded in it, it implements the TabableView interface. Tabs will only be expanded if this view is embedded in a container that does tab expansion. ParagraphView is an example of a container that does tab expansion.

A GlyphView is a styled chunk of text that represents a view
mapped over an element in the text model. This view is generally
responsible for displaying text glyphs using character level
attributes in some way.
An implementation of the GlyphPainter class is used to do the
actual rendering and model/view translations.  This separates
rendering from layout and management of the association with
the model.

The view supports breaking for the purpose of formatting.
The fragments produced by breaking share the view that has
primary responsibility for the element (i.e. they are nested
classes and carry only a small amount of state of their own)
so they can share its resources.

Since this view
represents text that may have tabs embedded in it, it implements the
TabableView interface.  Tabs will only be
expanded if this view is embedded in a container that does
tab expansion.  ParagraphView is an example of a container
that does tab expansion.
raw docstring

javax.swing.text.GlyphView$GlyphPainter

A class to perform rendering of the glyphs. This can be implemented to be stateless, or to hold some information as a cache to facilitate faster rendering and model/view translation. At a minimum, the GlyphPainter allows a View implementation to perform its duties independant of a particular version of JVM and selection of capabilities (i.e. shaping for i18n, etc).

A class to perform rendering of the glyphs.
This can be implemented to be stateless, or
to hold some information as a cache to
facilitate faster rendering and model/view
translation.  At a minimum, the GlyphPainter
allows a View implementation to perform its
duties independant of a particular version
of JVM and selection of capabilities (i.e.
shaping for i18n, etc).
raw docstring

javax.swing.text.Highlighter

An interface for an object that allows one to mark up the background with colored areas.

An interface for an object that allows one to mark up the background
with colored areas.
raw docstring

javax.swing.text.html.BlockView

A view implementation to display a block (as a box) with CSS specifications.

A view implementation to display a block (as a box)
with CSS specifications.
raw docstring

javax.swing.text.html.core

No vars found in this namespace.

javax.swing.text.html.CSS

Defines a set of CSS attributes as a typesafe enumeration. The HTML View implementations use CSS attributes to determine how they will render. This also defines methods to map between CSS/HTML/StyleConstants. Any shorthand properties, such as font, are mapped to the intrinsic properties. The following describes the CSS properties that are supported by the rendering engine: font-family font-style font-size (supports relative units) font-weight font color background-color (with the exception of transparent) background-image background-repeat background-position background text-decoration (with the exception of blink and overline) vertical-align (only sup and super) text-align (justify is treated as center) margin-top margin-right margin-bottom margin-left margin padding-top padding-right padding-bottom padding-left padding border-top-style border-right-style border-bottom-style border-left-style border-style (only supports inset, outset and none) border-top-color border-right-color border-bottom-color border-left-color border-color list-style-image list-style-type list-style-position

The following are modeled, but currently not rendered. font-variant background-attachment (background always treated as scroll) word-spacing letter-spacing text-indent text-transform line-height border-top-width (this is used to indicate if a border should be used) border-right-width border-bottom-width border-left-width border-width border-top border-right border-bottom border-left border width height float clear display white-space list-style

Note: for the time being we do not fully support relative units, unless noted, so that p { margin-top: 10% } will be treated as if no margin-top was specified.

Defines a set of
CSS attributes
as a typesafe enumeration.  The HTML View implementations use
CSS attributes to determine how they will render. This also defines
methods to map between CSS/HTML/StyleConstants. Any shorthand
properties, such as font, are mapped to the intrinsic properties.
The following describes the CSS properties that are supported by the
rendering engine:
font-family
  font-style
  font-size (supports relative units)
  font-weight
  font
  color
  background-color (with the exception of transparent)
  background-image
  background-repeat
  background-position
  background
  text-decoration (with the exception of blink and overline)
  vertical-align (only sup and super)
  text-align (justify is treated as center)
  margin-top
  margin-right
  margin-bottom
  margin-left
  margin
  padding-top
  padding-right
  padding-bottom
  padding-left
  padding
  border-top-style
  border-right-style
  border-bottom-style
  border-left-style
  border-style (only supports inset, outset and none)
  border-top-color
  border-right-color
  border-bottom-color
  border-left-color
  border-color
  list-style-image
  list-style-type
  list-style-position

The following are modeled, but currently not rendered.
font-variant
  background-attachment (background always treated as scroll)
  word-spacing
  letter-spacing
  text-indent
  text-transform
  line-height
  border-top-width (this is used to indicate if a border should be used)
  border-right-width
  border-bottom-width
  border-left-width
  border-width
  border-top
  border-right
  border-bottom
  border-left
  border
  width
  height
  float
  clear
  display
  white-space
  list-style

Note: for the time being we do not fully support relative units,
unless noted, so that
p { margin-top: 10% } will be treated as if no margin-top was specified.
raw docstring

javax.swing.text.html.FormSubmitEvent

FormSubmitEvent is used to notify interested parties that a form was submitted.

FormSubmitEvent is used to notify interested
parties that a form was submitted.
raw docstring

javax.swing.text.html.FormView

Component decorator that implements the view interface for form elements, <input>, <textarea>, and <select>. The model for the component is stored as an attribute of the the element (using StyleConstants.ModelAttribute), and is used to build the component of the view. The type of the model is assumed to of the type that would be set by HTMLDocument.HTMLReader.FormAction. If there are multiple views mapped over the document, they will share the embedded component models.

The following table shows what components get built by this view.

Element Type Component built

input, type button JButton

input, type checkbox JCheckBox

input, type image JButton

input, type password JPasswordField

input, type radio JRadioButton

input, type reset JButton

input, type submit JButton

input, type text JTextField

select, size > 1 or multiple attribute defined JList in a JScrollPane

select, size unspecified or 1 JComboBox

textarea JTextArea in a JScrollPane

input, type file JTextField

Component decorator that implements the view interface
for form elements, <input>, <textarea>,
and <select>.  The model for the component is stored
as an attribute of the the element (using StyleConstants.ModelAttribute),
and is used to build the component of the view.  The type
of the model is assumed to of the type that would be set by
HTMLDocument.HTMLReader.FormAction.  If there are
multiple views mapped over the document, they will share the
embedded component models.

The following table shows what components get built
by this view.


  Element Type
  Component built


  input, type button
  JButton


  input, type checkbox
  JCheckBox


  input, type image
  JButton


  input, type password
  JPasswordField


  input, type radio
  JRadioButton


  input, type reset
  JButton


  input, type submit
  JButton


  input, type text
  JTextField


  select, size > 1 or multiple attribute defined
  JList in a JScrollPane


  select, size unspecified or 1
  JComboBox


  textarea
  JTextArea in a JScrollPane


  input, type file
  JTextField
raw docstring

javax.swing.text.html.HTML

Constants used in the HTMLDocument. These are basically tag and attribute definitions.

Constants used in the HTMLDocument.  These
are basically tag and attribute definitions.
raw docstring

javax.swing.text.html.HTML$Tag

Typesafe enumeration for an HTML tag. Although the set of HTML tags is a closed set, we have left the set open so that people can add their own tag types to their custom parser and still communicate to the reader.

Typesafe enumeration for an HTML tag.  Although the
set of HTML tags is a closed set, we have left the
set open so that people can add their own tag types
to their custom parser and still communicate to the
reader.
raw docstring

javax.swing.text.html.HTMLDocument

A document that models HTML. The purpose of this model is to support both browsing and editing. As a result, the structure described by an HTML document is not exactly replicated by default. The element structure that is modeled by default, is built by the class HTMLDocument.HTMLReader, which implements the HTMLEditorKit.ParserCallback protocol that the parser expects. To change the structure one can subclass HTMLReader, and reimplement the method getReader(int) to return the new reader implementation. The documentation for HTMLReader should be consulted for the details of the default structure created. The intent is that the document be non-lossy (although reproducing the HTML format may result in a different format).

The document models only HTML, and makes no attempt to store view attributes in it. The elements are identified by the StyleContext.NameAttribute attribute, which should always have a value of type HTML.Tag that identifies the kind of element. Some of the elements (such as comments) are synthesized. The HTMLFactory uses this attribute to determine what kind of view to build.

This document supports incremental loading. The TokenThreshold property controls how much of the parse is buffered before trying to update the element structure of the document. This property is set by the EditorKit so that subclasses can disable it.

The Base property determines the URL against which relative URLs are resolved. By default, this will be the Document.StreamDescriptionProperty if the value of the property is a URL. If a <BASE> tag is encountered, the base will become the URL specified by that tag. Because the base URL is a property, it can of course be set directly.

The default content storage mechanism for this document is a gap buffer (GapContent). Alternatives can be supplied by using the constructor that takes a Content implementation.

Modifying HTMLDocument

In addition to the methods provided by Document and StyledDocument for mutating an HTMLDocument, HTMLDocument provides a number of convenience methods. The following methods can be used to insert HTML content into an existing document.

setInnerHTML(Element, String) setOuterHTML(Element, String) insertBeforeStart(Element, String) insertAfterStart(Element, String) insertBeforeEnd(Element, String) insertAfterEnd(Element, String)

The following examples illustrate using these methods. Each example assumes the HTML document is initialized in the following way:

JEditorPane p = new JEditorPane(); p.setContentType("text/html"); p.setText("..."); // Document text is provided below. HTMLDocument d = (HTMLDocument) p.getDocument();

With the following HTML content:

<html> <head> <title>An example HTMLDocument</title> <style type="text/css"> div { background-color: silver; } ul { color: red; } </style> </head> <body> <div id="BOX"> <p>Paragraph 1</p> <p>Paragraph 2</p> </div> </body> </html>

All the methods for modifying an HTML document require an Element. Elements can be obtained from an HTML document by using the method getElement(Element e, Object attribute, Object value). It returns the first descendant element that contains the specified attribute with the given value, in depth-first order. For example, d.getElement(d.getDefaultRootElement(), StyleConstants.NameAttribute, HTML.Tag.P) returns the first paragraph element.

A convenient shortcut for locating elements is the method getElement(String); returns an element whose ID attribute matches the specified value. For example, d.getElement("BOX") returns the DIV element.

The getIterator(HTML.Tag t) method can also be used for finding all occurrences of the specified HTML tag in the document.

Inserting elements

Elements can be inserted before or after the existing children of any non-leaf element by using the methods insertAfterStart and insertBeforeEnd. For example, if e is the DIV element, d.insertAfterStart(e, "<ul><li>List Item</li></ul>") inserts the list before the first paragraph, and d.insertBeforeEnd(e, "<ul><li>List Item</li></ul>") inserts the list after the last paragraph. The DIV block becomes the parent of the newly inserted elements.

Sibling elements can be inserted before or after any element by using the methods insertBeforeStart and insertAfterEnd. For example, if e is the DIV element, d.insertBeforeStart(e, "<ul><li>List Item</li></ul>") inserts the list before the DIV element, and d.insertAfterEnd(e, "<ul><li>List Item</li></ul>") inserts the list after the DIV element. The newly inserted elements become siblings of the DIV element.

Replacing elements

Elements and all their descendants can be replaced by using the methods setInnerHTML and setOuterHTML. For example, if e is the DIV element, d.setInnerHTML(e, "<ul><li>List Item</li></ul>") replaces all children paragraphs with the list, and d.setOuterHTML(e, "<ul><li>List Item</li></ul>") replaces the DIV element itself. In latter case the parent of the list is the BODY element.

Summary

The following table shows the example document and the results of various methods described above.

Example
insertAfterStart
insertBeforeEnd
insertBeforeStart
insertAfterEnd
setInnerHTML
setOuterHTML




    Paragraph 1
    Paragraph 2

insertAfterStart

      List Item

    Paragraph 1
    Paragraph 2

insertBeforeEnd

    Paragraph 1
    Paragraph 2

      List Item

insertBeforeStart

    List Item


    Paragraph 1
    Paragraph 2

insertAfterEnd

    Paragraph 1
    Paragraph 2


    List Item

setInnerHTML

      List Item

setOuterHTML

    List Item

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A document that models HTML.  The purpose of this model is to
support both browsing and editing.  As a result, the structure
described by an HTML document is not exactly replicated by default.
The element structure that is modeled by default, is built by the
class HTMLDocument.HTMLReader, which implements the
HTMLEditorKit.ParserCallback protocol that the parser
expects.  To change the structure one can subclass
HTMLReader, and reimplement the method getReader(int) to return the new reader implementation.  The
documentation for HTMLReader should be consulted for
the details of the default structure created.  The intent is that
the document be non-lossy (although reproducing the HTML format may
result in a different format).

The document models only HTML, and makes no attempt to store
view attributes in it.  The elements are identified by the
StyleContext.NameAttribute attribute, which should
always have a value of type HTML.Tag that identifies
the kind of element.  Some of the elements (such as comments) are
synthesized.  The HTMLFactory uses this attribute to
determine what kind of view to build.

This document supports incremental loading.  The
TokenThreshold property controls how much of the parse
is buffered before trying to update the element structure of the
document.  This property is set by the EditorKit so
that subclasses can disable it.

The Base property determines the URL against which
relative URLs are resolved.  By default, this will be the
Document.StreamDescriptionProperty if the value of the
property is a URL.  If a <BASE> tag is encountered, the base
will become the URL specified by that tag.  Because the base URL is
a property, it can of course be set directly.

The default content storage mechanism for this document is a gap
buffer (GapContent).  Alternatives can be supplied by
using the constructor that takes a Content
implementation.

Modifying HTMLDocument

In addition to the methods provided by Document and
StyledDocument for mutating an HTMLDocument, HTMLDocument provides
a number of convenience methods.  The following methods can be used
to insert HTML content into an existing document.


  setInnerHTML(Element, String)
  setOuterHTML(Element, String)
  insertBeforeStart(Element, String)
  insertAfterStart(Element, String)
  insertBeforeEnd(Element, String)
  insertAfterEnd(Element, String)


The following examples illustrate using these methods.  Each
example assumes the HTML document is initialized in the following
way:



JEditorPane p = new JEditorPane();
p.setContentType("text/html");
p.setText("..."); // Document text is provided below.
HTMLDocument d = (HTMLDocument) p.getDocument();

With the following HTML content:



<html>
  <head>
    <title>An example HTMLDocument</title>
    <style type="text/css">
      div { background-color: silver; }
      ul { color: red; }
    </style>
  </head>
  <body>
    <div id="BOX">
      <p>Paragraph 1</p>
      <p>Paragraph 2</p>
    </div>
  </body>
</html>

All the methods for modifying an HTML document require an Element.  Elements can be obtained from an HTML document by using
the method getElement(Element e, Object attribute, Object
value).  It returns the first descendant element that contains the
specified attribute with the given value, in depth-first order.
For example, d.getElement(d.getDefaultRootElement(),
StyleConstants.NameAttribute, HTML.Tag.P) returns the first
paragraph element.

A convenient shortcut for locating elements is the method getElement(String); returns an element whose ID
attribute matches the specified value.  For example,
d.getElement("BOX") returns the DIV
element.

The getIterator(HTML.Tag t) method can also be used for
finding all occurrences of the specified HTML tag in the
document.

Inserting elements

Elements can be inserted before or after the existing children
of any non-leaf element by using the methods
insertAfterStart and insertBeforeEnd.
For example, if e is the DIV element,
d.insertAfterStart(e, "<ul><li>List
Item</li></ul>") inserts the list before the first
paragraph, and d.insertBeforeEnd(e, "<ul><li>List
Item</li></ul>") inserts the list after the last
paragraph.  The DIV block becomes the parent of the
newly inserted elements.

Sibling elements can be inserted before or after any element by
using the methods insertBeforeStart and
insertAfterEnd.  For example, if e is the
DIV element, d.insertBeforeStart(e,
"<ul><li>List Item</li></ul>") inserts the list
before the DIV element, and d.insertAfterEnd(e,
"<ul><li>List Item</li></ul>") inserts the list
after the DIV element.  The newly inserted elements
become siblings of the DIV element.

Replacing elements

Elements and all their descendants can be replaced by using the
methods setInnerHTML and setOuterHTML.
For example, if e is the DIV element,
d.setInnerHTML(e, "<ul><li>List
Item</li></ul>") replaces all children paragraphs with
the list, and d.setOuterHTML(e, "<ul><li>List
Item</li></ul>") replaces the DIV element
itself.  In latter case the parent of the list is the
BODY element.

Summary

The following table shows the example document and the results
of various methods described above.



    Example
    insertAfterStart
    insertBeforeEnd
    insertBeforeStart
    insertAfterEnd
    setInnerHTML
    setOuterHTML




        Paragraph 1
        Paragraph 2


insertAfterStart



          List Item

        Paragraph 1
        Paragraph 2


insertBeforeEnd


        Paragraph 1
        Paragraph 2

          List Item



insertBeforeStart


        List Item


        Paragraph 1
        Paragraph 2


insertAfterEnd


        Paragraph 1
        Paragraph 2


        List Item


setInnerHTML



          List Item



setOuterHTML


        List Item





Warning: Serialized objects of this class will
not be compatible with future Swing releases. The current
serialization support is appropriate for short term storage or RMI
between applications running the same version of Swing.  As of 1.4,
support for long term storage of all JavaBeans™
has been added to the
java.beans package.  Please see XMLEncoder.
raw docstring

javax.swing.text.html.HTMLDocument$Iterator

An iterator to iterate over a particular type of tag. The iterator is not thread safe. If reliable access to the document is not already ensured by the context under which the iterator is being used, its use should be performed under the protection of Document.render.

An iterator to iterate over a particular type of
tag.  The iterator is not thread safe.  If reliable
access to the document is not already ensured by
the context under which the iterator is being used,
its use should be performed under the protection of
Document.render.
raw docstring

javax.swing.text.html.HTMLEditorKit

The Swing JEditorPane text component supports different kinds of content via a plug-in mechanism called an EditorKit. Because HTML is a very popular format of content, some support is provided by default. The default support is provided by this class, which supports HTML version 3.2 (with some extensions), and is migrating toward version 4.0. The <applet> tag is not supported, but some support is provided for the <object> tag.

There are several goals of the HTML EditorKit provided, that have an effect upon the way that HTML is modeled. These have influenced its design in a substantial way.

Support editing

It might seem fairly obvious that a plug-in for JEditorPane should provide editing support, but that fact has several design considerations. There are a substantial number of HTML documents that don't properly conform to an HTML specification. These must be normalized somewhat into a correct form if one is to edit them. Additionally, users don't like to be presented with an excessive amount of structure editing, so using traditional text editing gestures is preferred over using the HTML structure exactly as defined in the HTML document.

The modeling of HTML is provided by the class HTMLDocument. Its documentation describes the details of how the HTML is modeled. The editing support leverages heavily off of the text package.

Extendable/Scalable

To maximize the usefulness of this kit, a great deal of effort has gone into making it extendable. These are some of the features.

The parser is replaceable. The default parser is the Hot Java parser which is DTD based. A different DTD can be used, or an entirely different parser can be used. To change the parser, reimplement the getParser method. The default parser is dynamically loaded when first asked for, so the class files will never be loaded if an alternative parser is used. The default parser is in a separate package called parser below this package.

The parser drives the ParserCallback, which is provided by HTMLDocument. To change the callback, subclass HTMLDocument and reimplement the createDefaultDocument method to return document that produces a different reader. The reader controls how the document is structured. Although the Document provides HTML support by default, there is nothing preventing support of non-HTML tags that result in alternative element structures.

The default view of the models are provided as a hierarchy of View implementations, so one can easily customize how a particular element is displayed or add capabilities for new kinds of elements by providing new View implementations. The default set of views are provided by the HTMLFactory class. This can be easily changed by subclassing or replacing the HTMLFactory and reimplementing the getViewFactory method to return the alternative factory.

The View implementations work primarily off of CSS attributes, which are kept in the views. This makes it possible to have multiple views mapped over the same model that appear substantially different. This can be especially useful for printing. For most HTML attributes, the HTML attributes are converted to CSS attributes for display. This helps make the View implementations more general purpose

Asynchronous Loading

Larger documents involve a lot of parsing and take some time to load. By default, this kit produces documents that will be loaded asynchronously if loaded using JEditorPane.setPage. This is controlled by a property on the document. The method createDefaultDocument can be overriden to change this. The batching of work is done by the HTMLDocument.HTMLReader class. The actual work is done by the DefaultStyledDocument and AbstractDocument classes in the text package.

Customization from current LAF

HTML provides a well known set of features without exactly specifying the display characteristics. Swing has a theme mechanism for its look-and-feel implementations. It is desirable for the look-and-feel to feed display characteristics into the HTML views. An user with poor vision for example would want high contrast and larger than typical fonts.

The support for this is provided by the StyleSheet class. The presentation of the HTML can be heavily influenced by the setting of the StyleSheet property on the EditorKit.

Not lossy

An EditorKit has the ability to be read and save documents. It is generally the most pleasing to users if there is no loss of data between the two operation. The policy of the HTMLEditorKit will be to store things not recognized or not necessarily visible so they can be subsequently written out. The model of the HTML document should therefore contain all information discovered while reading the document. This is constrained in some ways by the need to support editing (i.e. incorrect documents sometimes must be normalized). The guiding principle is that information shouldn't be lost, but some might be synthesized to produce a more correct model or it might be rearranged.

The Swing JEditorPane text component supports different kinds
of content via a plug-in mechanism called an EditorKit.  Because
HTML is a very popular format of content, some support is provided
by default.  The default support is provided by this class, which
supports HTML version 3.2 (with some extensions), and is migrating
toward version 4.0.
The <applet> tag is not supported, but some support is provided
for the <object> tag.

There are several goals of the HTML EditorKit provided, that have
an effect upon the way that HTML is modeled.  These
have influenced its design in a substantial way.


Support editing

It might seem fairly obvious that a plug-in for JEditorPane
should provide editing support, but that fact has several
design considerations.  There are a substantial number of HTML
documents that don't properly conform to an HTML specification.
These must be normalized somewhat into a correct form if one
is to edit them.  Additionally, users don't like to be presented
with an excessive amount of structure editing, so using traditional
text editing gestures is preferred over using the HTML structure
exactly as defined in the HTML document.

The modeling of HTML is provided by the class HTMLDocument.
Its documentation describes the details of how the HTML is modeled.
The editing support leverages heavily off of the text package.


Extendable/Scalable

To maximize the usefulness of this kit, a great deal of effort
has gone into making it extendable.  These are some of the
features.


  The parser is replaceable.  The default parser is the Hot Java
  parser which is DTD based.  A different DTD can be used, or an
  entirely different parser can be used.  To change the parser,
  reimplement the getParser method.  The default parser is
  dynamically loaded when first asked for, so the class files
  will never be loaded if an alternative parser is used.  The
  default parser is in a separate package called parser below
  this package.

  The parser drives the ParserCallback, which is provided by
  HTMLDocument.  To change the callback, subclass HTMLDocument
  and reimplement the createDefaultDocument method to return
  document that produces a different reader.  The reader controls
  how the document is structured.  Although the Document provides
  HTML support by default, there is nothing preventing support of
  non-HTML tags that result in alternative element structures.

  The default view of the models are provided as a hierarchy of
  View implementations, so one can easily customize how a particular
  element is displayed or add capabilities for new kinds of elements
  by providing new View implementations.  The default set of views
  are provided by the HTMLFactory class.  This can
  be easily changed by subclassing or replacing the HTMLFactory
  and reimplementing the getViewFactory method to return the alternative
  factory.

  The View implementations work primarily off of CSS attributes,
  which are kept in the views.  This makes it possible to have
  multiple views mapped over the same model that appear substantially
  different.  This can be especially useful for printing.  For
  most HTML attributes, the HTML attributes are converted to CSS
  attributes for display.  This helps make the View implementations
  more general purpose



Asynchronous Loading

Larger documents involve a lot of parsing and take some time
to load.  By default, this kit produces documents that will be
loaded asynchronously if loaded using JEditorPane.setPage.
This is controlled by a property on the document.  The method
createDefaultDocument can
be overriden to change this.  The batching of work is done
by the HTMLDocument.HTMLReader class.  The actual
work is done by the DefaultStyledDocument and
AbstractDocument classes in the text package.


Customization from current LAF

HTML provides a well known set of features without exactly
specifying the display characteristics.  Swing has a theme
mechanism for its look-and-feel implementations.  It is desirable
for the look-and-feel to feed display characteristics into the
HTML views.  An user with poor vision for example would want
high contrast and larger than typical fonts.

The support for this is provided by the StyleSheet
class.  The presentation of the HTML can be heavily influenced
by the setting of the StyleSheet property on the EditorKit.


Not lossy

An EditorKit has the ability to be read and save documents.
It is generally the most pleasing to users if there is no loss
of data between the two operation.  The policy of the HTMLEditorKit
will be to store things not recognized or not necessarily visible
so they can be subsequently written out.  The model of the HTML document
should therefore contain all information discovered while reading the
document.  This is constrained in some ways by the need to support
editing (i.e. incorrect documents sometimes must be normalized).
The guiding principle is that information shouldn't be lost, but
some might be synthesized to produce a more correct model or it might
be rearranged.
raw docstring

javax.swing.text.html.HTMLEditorKit$HTMLFactory

A factory to build views for HTML. The following table describes what this factory will build by default.

TagView created

HTML.Tag.CONTENTInlineView

HTML.Tag.IMPLIEDjavax.swing.text.html.ParagraphView

HTML.Tag.Pjavax.swing.text.html.ParagraphView

HTML.Tag.H1javax.swing.text.html.ParagraphView

HTML.Tag.H2javax.swing.text.html.ParagraphView

HTML.Tag.H3javax.swing.text.html.ParagraphView

HTML.Tag.H4javax.swing.text.html.ParagraphView

HTML.Tag.H5javax.swing.text.html.ParagraphView

HTML.Tag.H6javax.swing.text.html.ParagraphView

HTML.Tag.DTjavax.swing.text.html.ParagraphView

HTML.Tag.MENUListView

HTML.Tag.DIRListView

HTML.Tag.ULListView

HTML.Tag.OLListView

HTML.Tag.LIBlockView

HTML.Tag.DLBlockView

HTML.Tag.DDBlockView

HTML.Tag.BODYBlockView

HTML.Tag.HTMLBlockView

HTML.Tag.CENTERBlockView

HTML.Tag.DIVBlockView

HTML.Tag.BLOCKQUOTEBlockView

HTML.Tag.PREBlockView

HTML.Tag.BLOCKQUOTEBlockView

HTML.Tag.PREBlockView

HTML.Tag.IMGImageView

HTML.Tag.HRHRuleView

HTML.Tag.BRBRView

HTML.Tag.TABLEjavax.swing.text.html.TableView

HTML.Tag.INPUTFormView

HTML.Tag.SELECTFormView

HTML.Tag.TEXTAREAFormView

HTML.Tag.OBJECTObjectView

HTML.Tag.FRAMESETFrameSetView

HTML.Tag.FRAMEFrameView

A factory to build views for HTML.  The following
table describes what this factory will build by
default.



TagView created

HTML.Tag.CONTENTInlineView

HTML.Tag.IMPLIEDjavax.swing.text.html.ParagraphView

HTML.Tag.Pjavax.swing.text.html.ParagraphView

HTML.Tag.H1javax.swing.text.html.ParagraphView

HTML.Tag.H2javax.swing.text.html.ParagraphView

HTML.Tag.H3javax.swing.text.html.ParagraphView

HTML.Tag.H4javax.swing.text.html.ParagraphView

HTML.Tag.H5javax.swing.text.html.ParagraphView

HTML.Tag.H6javax.swing.text.html.ParagraphView

HTML.Tag.DTjavax.swing.text.html.ParagraphView

HTML.Tag.MENUListView

HTML.Tag.DIRListView

HTML.Tag.ULListView

HTML.Tag.OLListView

HTML.Tag.LIBlockView

HTML.Tag.DLBlockView

HTML.Tag.DDBlockView

HTML.Tag.BODYBlockView

HTML.Tag.HTMLBlockView

HTML.Tag.CENTERBlockView

HTML.Tag.DIVBlockView

HTML.Tag.BLOCKQUOTEBlockView

HTML.Tag.PREBlockView

HTML.Tag.BLOCKQUOTEBlockView

HTML.Tag.PREBlockView

HTML.Tag.IMGImageView

HTML.Tag.HRHRuleView

HTML.Tag.BRBRView

HTML.Tag.TABLEjavax.swing.text.html.TableView

HTML.Tag.INPUTFormView

HTML.Tag.SELECTFormView

HTML.Tag.TEXTAREAFormView

HTML.Tag.OBJECTObjectView

HTML.Tag.FRAMESETFrameSetView

HTML.Tag.FRAMEFrameView
raw docstring

javax.swing.text.html.HTMLEditorKit$HTMLTextAction

An abstract Action providing some convenience methods that may be useful in inserting HTML into an existing document. NOTE: None of the convenience methods obtain a lock on the document. If you have another thread modifying the text these methods may have inconsistent behavior, or return the wrong thing.

An abstract Action providing some convenience methods that may
be useful in inserting HTML into an existing document.
NOTE: None of the convenience methods obtain a lock on the
document. If you have another thread modifying the text these
methods may have inconsistent behavior, or return the wrong thing.
raw docstring

javax.swing.text.html.HTMLEditorKit$InsertHTMLTextAction

InsertHTMLTextAction can be used to insert an arbitrary string of HTML into an existing HTML document. At least two HTML.Tags need to be supplied. The first Tag, parentTag, identifies the parent in the document to add the elements to. The second tag, addTag, identifies the first tag that should be added to the document as seen in the HTML string. One important thing to remember, is that the parser is going to generate all the appropriate tags, even if they aren't in the HTML string passed in. For example, lets say you wanted to create an action to insert a table into the body. The parentTag would be HTML.Tag.BODY, addTag would be HTML.Tag.TABLE, and the string could be something like <table><tr><td></td></tr></table>. There is also an option to supply an alternate parentTag and addTag. These will be checked for if there is no parentTag at offset.

InsertHTMLTextAction can be used to insert an arbitrary string of HTML
into an existing HTML document. At least two HTML.Tags need to be
supplied. The first Tag, parentTag, identifies the parent in
the document to add the elements to. The second tag, addTag,
identifies the first tag that should be added to the document as
seen in the HTML string. One important thing to remember, is that
the parser is going to generate all the appropriate tags, even if
they aren't in the HTML string passed in.
For example, lets say you wanted to create an action to insert
a table into the body. The parentTag would be HTML.Tag.BODY,
addTag would be HTML.Tag.TABLE, and the string could be something
like <table><tr><td></td></tr></table>.
There is also an option to supply an alternate parentTag and
addTag. These will be checked for if there is no parentTag at
offset.
raw docstring

javax.swing.text.html.HTMLEditorKit$LinkController

Class to watch the associated component and fire hyperlink events on it when appropriate.

Class to watch the associated component and fire
hyperlink events on it when appropriate.
raw docstring

javax.swing.text.html.HTMLEditorKit$Parser

Interface to be supported by the parser. This enables providing a different parser while reusing some of the implementation provided by this editor kit.

Interface to be supported by the parser.  This enables
providing a different parser while reusing some of the
implementation provided by this editor kit.
raw docstring

javax.swing.text.html.HTMLEditorKit$ParserCallback

The result of parsing drives these callback methods. The open and close actions should be balanced. The flush method will be the last method called, to give the receiver a chance to flush any pending data into the document. Refer to DocumentParser, the default parser used, for further information on the contents of the AttributeSets, the positions, and other info.

The result of parsing drives these callback methods.
The open and close actions should be balanced.  The
flush method will be the last method
called, to give the receiver a chance to flush any
pending data into the document.
Refer to DocumentParser, the default parser used, for further
information on the contents of the AttributeSets, the positions, and
other info.
raw docstring

javax.swing.text.html.HTMLFrameHyperlinkEvent

HTMLFrameHyperlinkEvent is used to notify interested parties that link was activated in a frame.

HTMLFrameHyperlinkEvent is used to notify interested
parties that link was activated in a frame.
raw docstring

javax.swing.text.html.HTMLWriter

This is a writer for HTMLDocuments.

This is a writer for HTMLDocuments.
raw docstring

javax.swing.text.html.ImageView

View of an Image, intended to support the HTML <IMG> tag. Supports scaling via the HEIGHT and WIDTH attributes of the tag. If the image is unable to be loaded any text specified via the ALT attribute will be rendered.

While this class has been part of swing for a while now, it is public as of 1.4.

View of an Image, intended to support the HTML <IMG> tag.
Supports scaling via the HEIGHT and WIDTH attributes of the tag.
If the image is unable to be loaded any text specified via the
ALT attribute will be rendered.

While this class has been part of swing for a while now, it is public
as of 1.4.
raw docstring

javax.swing.text.html.InlineView

Displays the inline element styles based upon css attributes.

Displays the inline element styles
based upon css attributes.
raw docstring

javax.swing.text.html.ListView

A view implementation to display an html list

A view implementation to display an html list
raw docstring

javax.swing.text.html.MinimalHTMLWriter

MinimalHTMLWriter is a fallback writer used by the HTMLEditorKit to write out HTML for a document that is a not produced by the EditorKit.

The format for the document is:

<html> <head> <style> <!-- list of named styles p.normal { font-family: SansSerif; margin-height: 0; font-size: 14 } --> </style> </head> <body> <p style=normal> Bold, italic, and underline attributes of the run are emitted as HTML tags. The remaining attributes are emitted as part of the style attribute of a <span> tag. The syntax is similar to inline styles. </p> </body> </html>

MinimalHTMLWriter is a fallback writer used by the
HTMLEditorKit to write out HTML for a document that
is a not produced by the EditorKit.

The format for the document is:


<html>
  <head>
    <style>
       <!-- list of named styles
        p.normal {
           font-family: SansSerif;
           margin-height: 0;
           font-size: 14
        }
       -->
     </style>
  </head>
  <body>
   <p style=normal>
       Bold, italic, and underline attributes
       of the run are emitted as HTML tags.
       The remaining attributes are emitted as
       part of the style attribute of a <span> tag.
       The syntax is similar to inline styles.
   </p>
  </body>
</html>
raw docstring

javax.swing.text.html.ObjectView

Component decorator that implements the view interface for <object> elements.

This view will try to load the class specified by the classid attribute. If possible, the Classloader used to load the associated Document is used. This would typically be the same as the ClassLoader used to load the EditorKit. If the document's ClassLoader is null, Class.forName is used.

If the class can successfully be loaded, an attempt will be made to create an instance of it by calling Class.newInstance. An attempt will be made to narrow the instance to type java.awt.Component to display the object.

This view can also manage a set of parameters with limitations. The parameters to the <object> element are expected to be present on the associated elements attribute set as simple strings. Each bean property will be queried as a key on the AttributeSet, with the expectation that a non-null value (of type String) will be present if there was a parameter specification for the property. Reflection is used to set the parameter. Currently, this is limited to a very simple single parameter of type String.

A simple example HTML invocation is:

 <object classid="javax.swing.JLabel">
 <param name="text" value="sample text">
 </object>
Component decorator that implements the view interface
for <object> elements.

This view will try to load the class specified by the
classid attribute.  If possible, the Classloader
used to load the associated Document is used.
This would typically be the same as the ClassLoader
used to load the EditorKit.  If the document's
ClassLoader is null, Class.forName is used.

If the class can successfully be loaded, an attempt will
be made to create an instance of it by calling
Class.newInstance.  An attempt will be made
to narrow the instance to type java.awt.Component
to display the object.

This view can also manage a set of parameters with limitations.
The parameters to the <object> element are expected to
be present on the associated elements attribute set as simple
strings.  Each bean property will be queried as a key on
the AttributeSet, with the expectation that a non-null value
(of type String) will be present if there was a parameter
specification for the property.  Reflection is used to
set the parameter.  Currently, this is limited to a very
simple single parameter of type String.

A simple example HTML invocation is:


     <object classid="javax.swing.JLabel">
     <param name="text" value="sample text">
     </object>
raw docstring

javax.swing.text.html.Option

Value for the ListModel used to represent

<option> elements. This is the object installed as items of the DefaultComboBoxModel used to represent the <select> element.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Value for the ListModel used to represent
<option> elements.  This is the object
installed as items of the DefaultComboBoxModel
used to represent the <select> element.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.html.ParagraphView

Displays the a paragraph, and uses css attributes for its configuration.

Displays the a paragraph, and uses css attributes for its
configuration.
raw docstring

javax.swing.text.html.parser.AttributeList

This class defines the attributes of an SGML element as described in a DTD using the ATTLIST construct. An AttributeList can be obtained from the Element class using the getAttributes() method.

It is actually an element in a linked list. Use the getNext() method repeatedly to enumerate all the attributes of an element.

This class defines the attributes of an SGML element
as described in a DTD using the ATTLIST construct.
An AttributeList can be obtained from the Element
class using the getAttributes() method.

It is actually an element in a linked list. Use the
getNext() method repeatedly to enumerate all the attributes
of an element.
raw docstring

javax.swing.text.html.parser.ContentModel

A representation of a content model. A content model is basically a restricted BNF expression. It is restricted in the sense that it must be deterministic. This means that you don't have to represent it as a finite state automaton. See Annex H on page 556 of the SGML handbook for more information.

A representation of a content model. A content model is
basically a restricted BNF expression. It is restricted in
the sense that it must be deterministic. This means that you
don't have to represent it as a finite state automaton.
See Annex H on page 556 of the SGML handbook for more information.
raw docstring

javax.swing.text.html.parser.core

No vars found in this namespace.

javax.swing.text.html.parser.DocumentParser

A Parser for HTML Documents (actually, you can specify a DTD, but you should really only use this class with the html dtd in swing). Reads an InputStream of HTML and invokes the appropriate methods in the ParserCallback class. This is the default parser used by HTMLEditorKit to parse HTML url's. This will message the callback for all valid tags, as well as tags that are implied but not explicitly specified. For example, the html string (<p>blah) only has a p tag defined. The callback will see the following methods: handleStartTag(html, ...) handleStartTag(head, ...) handleEndTag(head) handleStartTag(body, ...) handleStartTag(p, ...) handleText(...) handleEndTag(p) handleEndTag(body) handleEndTag(html)

The items in italic are implied, that is, although they were not explicitly specified, to be correct html they should have been present (head isn't necessary, but it is still generated). For tags that are implied, the AttributeSet argument will have a value of Boolean.TRUE for the key HTMLEditorKit.ParserCallback.IMPLIED. HTML.Attributes defines a type safe enumeration of html attributes. If an attribute key of a tag is defined in HTML.Attribute, the HTML.Attribute will be used as the key, otherwise a String will be used. For example <p foo=bar class=neat> has two attributes. foo is not defined in HTML.Attribute, where as class is, therefore the AttributeSet will have two values in it, HTML.Attribute.CLASS with a String value of 'neat' and the String key 'foo' with a String value of 'bar'. The position argument will indicate the start of the tag, comment or text. Similar to arrays, the first character in the stream has a position of 0. For tags that are implied the position will indicate the location of the next encountered tag. In the first example, the implied start body and html tags will have the same position as the p tag, and the implied end p, html and body tags will all have the same position. As html skips whitespace the position for text will be the position of the first valid character, eg in the string '\n\n\nblah' the text 'blah' will have a position of 3, the newlines are skipped.

For attributes that do not have a value, eg in the html string <foo blah> the attribute blah does not have a value, there are two possible values that will be placed in the AttributeSet's value:

If the DTD does not contain an definition for the element, or the definition does not have an explicit value then the value in the AttributeSet will be HTML.NULL_ATTRIBUTE_VALUE. If the DTD contains an explicit value, as in: <!ATTLIST OPTION selected (selected) #IMPLIED> this value from the dtd (in this case selected) will be used.

Once the stream has been parsed, the callback is notified of the most likely end of line string. The end of line string will be one of \n, \r or \r\n, which ever is encountered the most in parsing the stream.

A Parser for HTML Documents (actually, you can specify a DTD, but
you should really only use this class with the html dtd in swing).
Reads an InputStream of HTML and
invokes the appropriate methods in the ParserCallback class. This
is the default parser used by HTMLEditorKit to parse HTML url's.
This will message the callback for all valid tags, as well as
tags that are implied but not explicitly specified. For example, the
html string (<p>blah) only has a p tag defined. The callback
will see the following methods:
handleStartTag(html, ...)
    handleStartTag(head, ...)
    handleEndTag(head)
    handleStartTag(body, ...)
    handleStartTag(p, ...)
    handleText(...)
    handleEndTag(p)
    handleEndTag(body)
    handleEndTag(html)

The items in italic are implied, that is, although they were not
explicitly specified, to be correct html they should have been present
(head isn't necessary, but it is still generated). For tags that
are implied, the AttributeSet argument will have a value of
Boolean.TRUE for the key
HTMLEditorKit.ParserCallback.IMPLIED.
HTML.Attributes defines a type safe enumeration of html attributes.
If an attribute key of a tag is defined in HTML.Attribute, the
HTML.Attribute will be used as the key, otherwise a String will be used.
For example <p foo=bar class=neat> has two attributes. foo is
not defined in HTML.Attribute, where as class is, therefore the
AttributeSet will have two values in it, HTML.Attribute.CLASS with
a String value of 'neat' and the String key 'foo' with a String value of
'bar'.
The position argument will indicate the start of the tag, comment
or text. Similar to arrays, the first character in the stream has a
position of 0. For tags that are
implied the position will indicate
the location of the next encountered tag. In the first example,
the implied start body and html tags will have the same position as the
p tag, and the implied end p, html and body tags will all have the same
position.
As html skips whitespace the position for text will be the position
of the first valid character, eg in the string '\n\n\nblah'
the text 'blah' will have a position of 3, the newlines are skipped.

For attributes that do not have a value, eg in the html
string <foo blah> the attribute blah
does not have a value, there are two possible values that will be
placed in the AttributeSet's value:

If the DTD does not contain an definition for the element, or the
    definition does not have an explicit value then the value in the
    AttributeSet will be HTML.NULL_ATTRIBUTE_VALUE.
If the DTD contains an explicit value, as in:
    <!ATTLIST OPTION selected (selected) #IMPLIED>
    this value from the dtd (in this case selected) will be used.


Once the stream has been parsed, the callback is notified of the most
likely end of line string. The end of line string will be one of
\n, \r or \r\n, which ever is encountered the most in parsing the
stream.
raw docstring

javax.swing.text.html.parser.DTD

The representation of an SGML DTD. DTD describes a document syntax and is used in parsing of HTML documents. It contains a list of elements and their attributes as well as a list of entities defined in the DTD.

The representation of an SGML DTD.  DTD describes a document
syntax and is used in parsing of HTML documents.  It contains
a list of elements and their attributes as well as a list of
entities defined in the DTD.
raw docstring

javax.swing.text.html.parser.DTDConstants

SGML constants used in a DTD. The names of the constants correspond the the equivalent SGML constructs as described in "The SGML Handbook" by Charles F. Goldfarb.

SGML constants used in a DTD. The names of the
constants correspond the the equivalent SGML constructs
as described in "The SGML Handbook" by  Charles F. Goldfarb.
raw docstring

No vars found in this namespace.

javax.swing.text.html.parser.Element

An element as described in a DTD using the ELEMENT construct. This is essential the description of a tag. It describes the type, content model, attributes, attribute types etc. It is used to correctly parse a document by the Parser.

An element as described in a DTD using the ELEMENT construct.
This is essential the description of a tag. It describes the
type, content model, attributes, attribute types etc. It is used
to correctly parse a document by the Parser.
raw docstring

javax.swing.text.html.parser.Entity

An entity is described in a DTD using the ENTITY construct. It defines the type and value of the the entity.

An entity is described in a DTD using the ENTITY construct.
It defines the type and value of the the entity.
raw docstring

javax.swing.text.html.parser.Parser

A simple DTD-driven HTML parser. The parser reads an HTML file from an InputStream and calls various methods (which should be overridden in a subclass) when tags and data are encountered.

Unfortunately there are many badly implemented HTML parsers out there, and as a result there are many badly formatted HTML files. This parser attempts to parse most HTML files. This means that the implementation sometimes deviates from the SGML specification in favor of HTML.

The parser treats \r and \r\n as \n. Newlines after starttags and before end tags are ignored just as specified in the SGML/HTML specification.

The html spec does not specify how spaces are to be coalesced very well. Specifically, the following scenarios are not discussed (note that a space should be used here, but I am using &nbsp to force the space to be displayed):

'<b>blah <i> <strike> foo' which can be treated as: '<b>blah <i><strike>foo' as well as: '<p><a href="xx"> <em>Using</em></a></p>' which appears to be treated as: '<p><a href="xx"><em>Using</em></a></p>'

If strict is false, when a tag that breaks flow, (TagElement.breaksFlows) or trailing whitespace is encountered, all whitespace will be ignored until a non whitespace character is encountered. This appears to give behavior closer to the popular browsers.

A simple DTD-driven HTML parser. The parser reads an
HTML file from an InputStream and calls various methods
(which should be overridden in a subclass) when tags and
data are encountered.

Unfortunately there are many badly implemented HTML parsers
out there, and as a result there are many badly formatted
HTML files. This parser attempts to parse most HTML files.
This means that the implementation sometimes deviates from
the SGML specification in favor of HTML.

The parser treats \r and \r\n as \n. Newlines after starttags
and before end tags are ignored just as specified in the SGML/HTML
specification.

The html spec does not specify how spaces are to be coalesced very well.
Specifically, the following scenarios are not discussed (note that a
space should be used here, but I am using &nbsp to force the space to
be displayed):

'<b>blah <i> <strike> foo' which can be treated as:
'<b>blah <i><strike>foo'
as well as:
'<p><a href="xx"> <em>Using</em></a></p>'
which appears to be treated as:
'<p><a href="xx"><em>Using</em></a></p>'

If strict is false, when a tag that breaks flow,
(TagElement.breaksFlows) or trailing whitespace is
encountered, all whitespace will be ignored until a non whitespace
character is encountered. This appears to give behavior closer to
the popular browsers.
raw docstring

javax.swing.text.html.parser.ParserDelegator

Responsible for starting up a new DocumentParser each time its parse method is invoked. Stores a reference to the dtd.

Responsible for starting up a new DocumentParser
each time its parse method is invoked. Stores a
reference to the dtd.
raw docstring

javax.swing.text.html.parser.TagElement

A generic HTML TagElement class. The methods define how white space is interpreted around the tag.

A generic HTML TagElement class. The methods define how white
space is interpreted around the tag.
raw docstring

javax.swing.text.html.StyleSheet

Support for defining the visual characteristics of HTML views being rendered. The StyleSheet is used to translate the HTML model into visual characteristics. This enables views to be customized by a look-and-feel, multiple views over the same model can be rendered differently, etc. This can be thought of as a CSS rule repository. The key for CSS attributes is an object of type CSS.Attribute. The type of the value is up to the StyleSheet implementation, but the toString method is required to return a string representation of CSS value.

The primary entry point for HTML View implementations to get their attributes is the getViewAttributes method. This should be implemented to establish the desired policy used to associate attributes with the view. Each HTMLEditorKit (i.e. and therefore each associated JEditorPane) can have its own StyleSheet, but by default one sheet will be shared by all of the HTMLEditorKit instances. HTMLDocument instance can also have a StyleSheet, which holds the document-specific CSS specifications.

In order for Views to store less state and therefore be more lightweight, the StyleSheet can act as a factory for painters that handle some of the rendering tasks. This allows implementations to determine what they want to cache and have the sharing potentially at the level that a selector is common to multiple views. Since the StyleSheet may be used by views over multiple documents and typically the HTML attributes don't effect the selector being used, the potential for sharing is significant.

The rules are stored as named styles, and other information is stored to translate the context of an element to a rule quickly. The following code fragment will display the named styles, and therefore the CSS rules contained.

import java.util.; import javax.swing.text.; import javax.swing.text.html.*;

public class ShowStyles {

  public static void main(String[] args) {
    HTMLEditorKit kit = new HTMLEditorKit();
    HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
    StyleSheet styles = doc.getStyleSheet();

    Enumeration rules = styles.getStyleNames();
    while (rules.hasMoreElements()) {
        String name = (String) rules.nextElement();
        Style rule = styles.getStyle(name);
        System.out.println(rule.toString());
    }
    System.exit(0);
  }

}

The semantics for when a CSS style should overide visual attributes defined by an element are not well defined. For example, the html

<body bgcolor=red> makes the body have a red background. But if the html file also contains the CSS rule body { background: blue } it becomes less clear as to what color the background of the body should be. The current implementation gives visual attributes defined in the element the highest precedence, that is they are always checked before any styles. Therefore, in the previous example the background would have a red color as the body element defines the background color to be red.

As already mentioned this supports CSS. We don't support the full CSS spec. Refer to the javadoc of the CSS class to see what properties we support. The two major CSS parsing related concepts we do not currently support are pseudo selectors, such as A:link { color: red }, and the important modifier.

Note: This implementation is currently incomplete. It can be replaced with alternative implementations that are complete. Future versions of this class will provide better CSS support.

Support for defining the visual characteristics of
HTML views being rendered.  The StyleSheet is used to
translate the HTML model into visual characteristics.
This enables views to be customized by a look-and-feel,
multiple views over the same model can be rendered
differently, etc.  This can be thought of as a CSS
rule repository.  The key for CSS attributes is an
object of type CSS.Attribute.  The type of the value
is up to the StyleSheet implementation, but the
toString method is required
to return a string representation of CSS value.

The primary entry point for HTML View implementations
to get their attributes is the
getViewAttributes
method.  This should be implemented to establish the
desired policy used to associate attributes with the view.
Each HTMLEditorKit (i.e. and therefore each associated
JEditorPane) can have its own StyleSheet, but by default one
sheet will be shared by all of the HTMLEditorKit instances.
HTMLDocument instance can also have a StyleSheet, which
holds the document-specific CSS specifications.

In order for Views to store less state and therefore be
more lightweight, the StyleSheet can act as a factory for
painters that handle some of the rendering tasks.  This allows
implementations to determine what they want to cache
and have the sharing potentially at the level that a
selector is common to multiple views.  Since the StyleSheet
may be used by views over multiple documents and typically
the HTML attributes don't effect the selector being used,
the potential for sharing is significant.

The rules are stored as named styles, and other information
is stored to translate the context of an element to a
rule quickly.  The following code fragment will display
the named styles, and therefore the CSS rules contained.


  import java.util.*;
  import javax.swing.text.*;
  import javax.swing.text.html.*;

  public class ShowStyles {

      public static void main(String[] args) {
        HTMLEditorKit kit = new HTMLEditorKit();
        HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
        StyleSheet styles = doc.getStyleSheet();

        Enumeration rules = styles.getStyleNames();
        while (rules.hasMoreElements()) {
            String name = (String) rules.nextElement();
            Style rule = styles.getStyle(name);
            System.out.println(rule.toString());
        }
        System.exit(0);
      }
  }

The semantics for when a CSS style should overide visual attributes
defined by an element are not well defined. For example, the html
<body bgcolor=red> makes the body have a red
background. But if the html file also contains the CSS rule
body { background: blue } it becomes less clear as to
what color the background of the body should be. The current
implementation gives visual attributes defined in the element the
highest precedence, that is they are always checked before any styles.
Therefore, in the previous example the background would have a
red color as the body element defines the background color to be red.

As already mentioned this supports CSS. We don't support the full CSS
spec. Refer to the javadoc of the CSS class to see what properties
we support. The two major CSS parsing related
concepts we do not currently
support are pseudo selectors, such as A:link { color: red },
and the important modifier.

Note: This implementation is currently
incomplete.  It can be replaced with alternative implementations
that are complete.  Future versions of this class will provide
better CSS support.
raw docstring

javax.swing.text.html.StyleSheet$BoxPainter

Class to carry out some of the duties of CSS formatting. Implementations of this class enable views to present the CSS formatting while not knowing anything about how the CSS values are being cached.

As a delegate of Views, this object is responsible for the insets of a View and making sure the background is maintained according to the CSS attributes.

Class to carry out some of the duties of
CSS formatting.  Implementations of this
class enable views to present the CSS formatting
while not knowing anything about how the CSS values
are being cached.

As a delegate of Views, this object is responsible for
the insets of a View and making sure the background
is maintained according to the CSS attributes.
raw docstring

javax.swing.text.html.StyleSheet$ListPainter

Class to carry out some of the duties of CSS list formatting. Implementations of this class enable views to present the CSS formatting while not knowing anything about how the CSS values are being cached.

Class to carry out some of the duties of CSS list
formatting.  Implementations of this
class enable views to present the CSS formatting
while not knowing anything about how the CSS values
are being cached.
raw docstring

javax.swing.text.IconView

Icon decorator that implements the view interface. The entire element is used to represent the icon. This acts as a gateway from the display-only View implementations to interactive lightweight icons (that is, it allows icons to be embedded into the View hierarchy. The parent of the icon is the container that is handed out by the associated view factory.

Icon decorator that implements the view interface.  The
entire element is used to represent the icon.  This acts
as a gateway from the display-only View implementations to
interactive lightweight icons (that is, it allows icons
to be embedded into the View hierarchy.  The parent of the icon
is the container that is handed out by the associated view
factory.
raw docstring

javax.swing.text.InternationalFormatter

InternationalFormatter extends DefaultFormatter, using an instance of java.text.Format to handle the conversion to a String, and the conversion from a String.

If getAllowsInvalid() is false, this will ask the Format to format the current text on every edit.

You can specify a minimum and maximum value by way of the setMinimum and setMaximum methods. In order for this to work the values returned from stringToValue must be comparable to the min/max values by way of the Comparable interface.

Be careful how you configure the Format and the InternationalFormatter, as it is possible to create a situation where certain values can not be input. Consider the date format 'M/d/yy', an InternationalFormatter that is always valid (setAllowsInvalid(false)), is in overwrite mode (setOverwriteMode(true)) and the date 7/1/99. In this case the user will not be able to enter a two digit month or day of month. To avoid this, the format should be 'MM/dd/yy'.

If InternationalFormatter is configured to only allow valid values (setAllowsInvalid(false)), every valid edit will result in the text of the JFormattedTextField being completely reset from the Format. The cursor position will also be adjusted as literal characters are added/removed from the resulting String.

InternationalFormatter's behavior of stringToValue is slightly different than that of DefaultTextFormatter, it does the following:

parseObject is invoked on the Format specified by setFormat If a Class has been set for the values (setValueClass), supers implementation is invoked to convert the value returned from parseObject to the appropriate class. If a ParseException has not been thrown, and the value is outside the min/max a ParseException is thrown. The value is returned.

InternationalFormatter implements stringToValue in this manner so that you can specify an alternate Class than Format may return.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

InternationalFormatter extends DefaultFormatter,
using an instance of java.text.Format to handle the
conversion to a String, and the conversion from a String.

If getAllowsInvalid() is false, this will ask the
Format to format the current text on every edit.

You can specify a minimum and maximum value by way of the
setMinimum and setMaximum methods. In order
for this to work the values returned from stringToValue must be
comparable to the min/max values by way of the Comparable
interface.

Be careful how you configure the Format and the
InternationalFormatter, as it is possible to create a
situation where certain values can not be input. Consider the date
format 'M/d/yy', an InternationalFormatter that is always
valid (setAllowsInvalid(false)), is in overwrite mode
(setOverwriteMode(true)) and the date 7/1/99. In this
case the user will not be able to enter a two digit month or day of
month. To avoid this, the format should be 'MM/dd/yy'.

If InternationalFormatter is configured to only allow valid
values (setAllowsInvalid(false)), every valid edit will result
in the text of the JFormattedTextField being completely reset
from the Format.
The cursor position will also be adjusted as literal characters are
added/removed from the resulting String.

InternationalFormatter's behavior of
stringToValue is  slightly different than that of
DefaultTextFormatter, it does the following:

  parseObject is invoked on the Format
      specified by setFormat
  If a Class has been set for the values (setValueClass),
      supers implementation is invoked to convert the value returned
      from parseObject to the appropriate class.
  If a ParseException has not been thrown, and the value
      is outside the min/max a ParseException is thrown.
  The value is returned.

InternationalFormatter implements stringToValue
in this manner so that you can specify an alternate Class than
Format may return.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.JTextComponent

JTextComponent is the base class for swing text components. It tries to be compatible with the java.awt.TextComponent class where it can reasonably do so. Also provided are other services for additional flexibility (beyond the pluggable UI and bean support). You can find information on how to use the functionality this class provides in General Rules for Using Text Components, a section in The Java Tutorial.

Caret Changes

The caret is a pluggable object in swing text components. Notification of changes to the caret position and the selection are sent to implementations of the CaretListener interface that have been registered with the text component. The UI will install a default caret unless a customized caret has been set. By default the caret tracks all the document changes performed on the Event Dispatching Thread and updates it's position accordingly if an insertion occurs before or at the caret position or a removal occurs before the caret position. DefaultCaret tries to make itself visible which may lead to scrolling of a text component within JScrollPane. The default caret behavior can be changed by the DefaultCaret.setUpdatePolicy(int) method.

Note: Non-editable text components also have a caret though it may not be painted.

Commands

Text components provide a number of commands that can be used to manipulate the component. This is essentially the way that the component expresses its capabilities. These are expressed in terms of the swing Action interface, using the TextAction implementation. The set of commands supported by the text component can be found with the getActions() method. These actions can be bound to key events, fired from buttons, etc.

Text Input

The text components support flexible and internationalized text input, using keymaps and the input method framework, while maintaining compatibility with the AWT listener model.

A Keymap lets an application bind key strokes to actions. In order to allow keymaps to be shared across multiple text components, they can use actions that extend TextAction. TextAction can determine which JTextComponent most recently has or had focus and therefore is the subject of the action (In the case that the ActionEvent sent to the action doesn't contain the target text component as its source).

The input method framework lets text components interact with input methods, separate software components that preprocess events to let users enter thousands of different characters using keyboards with far fewer keys. JTextComponent is an active client of the framework, so it implements the preferred user interface for interacting with input methods. As a consequence, some key events do not reach the text component because they are handled by an input method, and some text input reaches the text component as committed text within an InputMethodEvent instead of as a key event. The complete text input is the combination of the characters in keyTyped key events and committed text in input method events.

The AWT listener model lets applications attach event listeners to components in order to bind events to actions. Swing encourages the use of keymaps instead of listeners, but maintains compatibility with listeners by giving the listeners a chance to steal an event by consuming it.

Keyboard event and input method events are handled in the following stages, with each stage capable of consuming the event:

Stage KeyEvent InputMethodEvent 1. input methods (generated here) 2. focus manager

3.
registered key listeners
registered input method listeners

4.

input method handling in JTextComponent

5.   keymap handling using the current keymap
  1. keyboard handling in JComponent (e.g. accelerators, component navigation, etc.)

To maintain compatibility with applications that listen to key events but are not aware of input method events, the input method handling in stage 4 provides a compatibility mode for components that do not process input method events. For these components, the committed text is converted to keyTyped key events and processed in the key event pipeline starting at stage 3 instead of in the input method event pipeline.

By default the component will create a keymap (named DEFAULT_KEYMAP) that is shared by all JTextComponent instances as the default keymap. Typically a look-and-feel implementation will install a different keymap that resolves to the default keymap for those bindings not found in the different keymap. The minimal bindings include:

inserting content into the editor for the printable keys. removing content with the backspace and del keys. caret movement forward and backward

Model/View Split

The text components have a model-view split. A text component pulls together the objects used to represent the model, view, and controller. The text document model may be shared by other views which act as observers of the model (e.g. a document may be shared by multiple components).

The model is defined by the Document interface. This is intended to provide a flexible text storage mechanism that tracks change during edits and can be extended to more sophisticated models. The model interfaces are meant to capture the capabilities of expression given by SGML, a system used to express a wide variety of content. Each modification to the document causes notification of the details of the change to be sent to all observers in the form of a DocumentEvent which allows the views to stay up to date with the model. This event is sent to observers that have implemented the DocumentListener interface and registered interest with the model being observed.

Location Information

The capability of determining the location of text in the view is provided. There are two methods, modelToView(int) and viewToModel(java.awt.Point) for determining this information.

Undo/Redo support

Support for an edit history mechanism is provided to allow undo/redo operations. The text component does not itself provide the history buffer by default, but does provide the UndoableEdit records that can be used in conjunction with a history buffer to provide the undo/redo support. The support is provided by the Document model, which allows one to attach UndoableEditListener implementations.

Thread Safety

The swing text components provide some support of thread safe operations. Because of the high level of configurability of the text components, it is possible to circumvent the protection provided. The protection primarily comes from the model, so the documentation of AbstractDocument describes the assumptions of the protection provided. The methods that are safe to call asynchronously are marked with comments.

Newlines

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

Printing support

Several print methods are provided for basic document printing. If more advanced printing is needed, use the getPrintable(java.text.MessageFormat, java.text.MessageFormat) 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

JTextComponent is the base class for swing text
components.  It tries to be compatible with the
java.awt.TextComponent class
where it can reasonably do so.  Also provided are other services
for additional flexibility (beyond the pluggable UI and bean
support).
You can find information on how to use the functionality
this class provides in
General Rules for Using Text Components,
a section in The Java Tutorial.


Caret Changes

The caret is a pluggable object in swing text components.
Notification of changes to the caret position and the selection
are sent to implementations of the CaretListener
interface that have been registered with the text component.
The UI will install a default caret unless a customized caret
has been set.
By default the caret tracks all the document changes
performed on the Event Dispatching Thread and updates it's position
accordingly if an insertion occurs before or at the caret position
or a removal occurs before the caret position. DefaultCaret
tries to make itself visible which may lead to scrolling
of a text component within JScrollPane. The default caret
behavior can be changed by the DefaultCaret.setUpdatePolicy(int) method.

Note: Non-editable text components also have a caret though
it may not be painted.

Commands

Text components provide a number of commands that can be used
to manipulate the component.  This is essentially the way that
the component expresses its capabilities.  These are expressed
in terms of the swing Action interface,
using the TextAction implementation.
The set of commands supported by the text component can be
found with the getActions() method.  These actions
can be bound to key events, fired from buttons, etc.

Text Input

The text components support flexible and internationalized text input, using
keymaps and the input method framework, while maintaining compatibility with
the AWT listener model.

A Keymap lets an application bind key
strokes to actions.
In order to allow keymaps to be shared across multiple text components, they
can use actions that extend TextAction.
TextAction can determine which JTextComponent
most recently has or had focus and therefore is the subject of
the action (In the case that the ActionEvent
sent to the action doesn't contain the target text component as its source).

The input method framework
lets text components interact with input methods, separate software
components that preprocess events to let users enter thousands of
different characters using keyboards with far fewer keys.
JTextComponent is an active client of
the framework, so it implements the preferred user interface for interacting
with input methods. As a consequence, some key events do not reach the text
component because they are handled by an input method, and some text input
reaches the text component as committed text within an InputMethodEvent instead of as a key event.
The complete text input is the combination of the characters in
keyTyped key events and committed text in input method events.

The AWT listener model lets applications attach event listeners to
components in order to bind events to actions. Swing encourages the
use of keymaps instead of listeners, but maintains compatibility
with listeners by giving the listeners a chance to steal an event
by consuming it.

Keyboard event and input method events are handled in the following stages,
with each stage capable of consuming the event:



Stage
KeyEvent
InputMethodEvent
1.
    input methods
    (generated here)
2.
    focus manager



    3.
    registered key listeners
    registered input method listeners

    4.

    input method handling in JTextComponent

    5.   keymap handling using the current keymap
6.   keyboard handling in JComponent (e.g. accelerators, component navigation, etc.)




To maintain compatibility with applications that listen to key
events but are not aware of input method events, the input
method handling in stage 4 provides a compatibility mode for
components that do not process input method events. For these
components, the committed text is converted to keyTyped key events
and processed in the key event pipeline starting at stage 3
instead of in the input method event pipeline.

By default the component will create a keymap (named DEFAULT_KEYMAP)
that is shared by all JTextComponent instances as the default keymap.
Typically a look-and-feel implementation will install a different keymap
that resolves to the default keymap for those bindings not found in the
different keymap. The minimal bindings include:

inserting content into the editor for the
 printable keys.
removing content with the backspace and del
 keys.
caret movement forward and backward


Model/View Split

The text components have a model-view split.  A text component pulls
together the objects used to represent the model, view, and controller.
The text document model may be shared by other views which act as observers
of the model (e.g. a document may be shared by multiple components).




The model is defined by the Document interface.
This is intended to provide a flexible text storage mechanism
that tracks change during edits and can be extended to more sophisticated
models.  The model interfaces are meant to capture the capabilities of
expression given by SGML, a system used to express a wide variety of
content.
Each modification to the document causes notification of the
details of the change to be sent to all observers in the form of a
DocumentEvent which allows the views to stay up to date with the model.
This event is sent to observers that have implemented the
DocumentListener
interface and registered interest with the model being observed.

Location Information

The capability of determining the location of text in
the view is provided.  There are two methods, modelToView(int)
and viewToModel(java.awt.Point) for determining this information.

Undo/Redo support

Support for an edit history mechanism is provided to allow
undo/redo operations.  The text component does not itself
provide the history buffer by default, but does provide
the UndoableEdit records that can be used in conjunction
with a history buffer to provide the undo/redo support.
The support is provided by the Document model, which allows
one to attach UndoableEditListener implementations.

Thread Safety

The swing text components provide some support of thread
safe operations.  Because of the high level of configurability
of the text components, it is possible to circumvent the
protection provided.  The protection primarily comes from
the model, so the documentation of AbstractDocument
describes the assumptions of the protection provided.
The methods that are safe to call asynchronously are marked
with comments.

Newlines

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


Printing support

Several print methods are provided for basic
document printing.  If more advanced printing is needed, use the
getPrintable(java.text.MessageFormat, java.text.MessageFormat) 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.JTextComponent$DropLocation

Represents a drop location for JTextComponents.

Represents a drop location for JTextComponents.
raw docstring

javax.swing.text.JTextComponent$KeyBinding

Binding record for creating key bindings.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Binding record for creating key bindings.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.Keymap

A collection of bindings of KeyStrokes to actions. The bindings are basically name-value pairs that potentially resolve in a hierarchy.

A collection of bindings of KeyStrokes to actions.  The
bindings are basically name-value pairs that potentially
resolve in a hierarchy.
raw docstring

javax.swing.text.LabelView

A LabelView is a styled chunk of text that represents a view mapped over an element in the text model. It caches the character level attributes used for rendering.

A LabelView is a styled chunk of text
that represents a view mapped over an element in the
text model.  It caches the character level attributes
used for rendering.
raw docstring

javax.swing.text.MaskFormatter

MaskFormatter is used to format and edit strings. The behavior of a MaskFormatter is controlled by way of a String mask that specifies the valid characters that can be contained at a particular location in the Document model. The following characters can be specified:

Character Description

Any valid number, uses Character.isDigit.

' Escape character, used to escape any of the special formatting characters.

UAny character (Character.isLetter). All lowercase letters are mapped to upper case.

LAny character (Character.isLetter). All upper case letters are mapped to lower case.

AAny character or number (Character.isLetter or Character.isDigit)

?Any character (Character.isLetter).

*Anything. HAny hex character (0-9, a-f or A-F).

Typically characters correspond to one char, but in certain languages this is not the case. The mask is on a per character basis, and will thus adjust to fit as many chars as are needed.

You can further restrict the characters that can be input by the setInvalidCharacters and setValidCharacters methods. setInvalidCharacters allows you to specify which characters are not legal. setValidCharacters allows you to specify which characters are valid. For example, the following code block is equivalent to a mask of '0xHHH' with no invalid/valid characters:

MaskFormatter formatter = new MaskFormatter("0x***"); formatter.setValidCharacters("0123456789abcdefABCDEF");

When initially formatting a value if the length of the string is less than the length of the mask, two things can happen. Either the placeholder string will be used, or the placeholder character will be used. Precedence is given to the placeholder string. For example:

MaskFormatter formatter = new MaskFormatter("###-####"); formatter.setPlaceholderCharacter('_'); formatter.getDisplayValue(tf, "123");

Would result in the string '123-____'. If setPlaceholder("555-1212") was invoked '123-1212' would result. The placeholder String is only used on the initial format, on subsequent formats only the placeholder character will be used.

If a MaskFormatter is configured to only allow valid characters (setAllowsInvalid(false)) literal characters will be skipped as necessary when editing. Consider a MaskFormatter with the mask "###-####" and current value "555-1212". Using the right arrow key to navigate through the field will result in (| indicates the position of the caret):

|555-1212 5|55-1212 55|5-1212 555-|1212 555-1|212 The '-' is a literal (non-editable) character, and is skipped.

Similar behavior will result when editing. Consider inserting the string '123-45' and '12345' into the MaskFormatter in the previous example. Both inserts will result in the same String, '123-45__'. When MaskFormatter is processing the insert at character position 3 (the '-'), two things can happen:

If the inserted character is '-', it is accepted. If the inserted character matches the mask for the next non-literal character, it is accepted at the new location. Anything else results in an invalid edit

By default MaskFormatter will not allow invalid edits, you can change this with the setAllowsInvalid method, and will commit edits on valid edits (use the setCommitsOnValidEdit to change this).

By default, MaskFormatter is in overwrite mode. That is as characters are typed a new character is not inserted, rather the character at the current location is replaced with the newly typed character. You can change this behavior by way of the method setOverwriteMode.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

MaskFormatter is used to format and edit strings. The behavior
of a MaskFormatter is controlled by way of a String mask
that specifies the valid characters that can be contained at a particular
location in the Document model. The following characters can
be specified:



   Character
   Description


   #
   Any valid number, uses Character.isDigit.


   '
   Escape character, used to escape any of the
      special formatting characters.


   UAny character (Character.isLetter). All
       lowercase letters are mapped to upper case.

LAny character (Character.isLetter). All
       upper case letters are mapped to lower case.

AAny character or number (Character.isLetter
      or Character.isDigit)

?Any character
       (Character.isLetter).

*Anything.
HAny hex character (0-9, a-f or A-F).



Typically characters correspond to one char, but in certain languages this
is not the case. The mask is on a per character basis, and will thus
adjust to fit as many chars as are needed.

You can further restrict the characters that can be input by the
setInvalidCharacters and setValidCharacters
methods. setInvalidCharacters allows you to specify
which characters are not legal. setValidCharacters allows
you to specify which characters are valid. For example, the following
code block is equivalent to a mask of '0xHHH' with no invalid/valid
characters:


MaskFormatter formatter = new MaskFormatter("0x***");
formatter.setValidCharacters("0123456789abcdefABCDEF");

When initially formatting a value if the length of the string is
less than the length of the mask, two things can happen. Either
the placeholder string will be used, or the placeholder character will
be used. Precedence is given to the placeholder string. For example:


  MaskFormatter formatter = new MaskFormatter("###-####");
  formatter.setPlaceholderCharacter('_');
  formatter.getDisplayValue(tf, "123");

Would result in the string '123-____'. If
setPlaceholder("555-1212") was invoked '123-1212' would
result. The placeholder String is only used on the initial format,
on subsequent formats only the placeholder character will be used.

If a MaskFormatter is configured to only allow valid characters
(setAllowsInvalid(false)) literal characters will be skipped as
necessary when editing. Consider a MaskFormatter with
the mask "###-####" and current value "555-1212". Using the right
arrow key to navigate through the field will result in (| indicates the
position of the caret):


  |555-1212
  5|55-1212
  55|5-1212
  555-|1212
  555-1|212
The '-' is a literal (non-editable) character, and is skipped.

Similar behavior will result when editing. Consider inserting the string
'123-45' and '12345' into the MaskFormatter in the
previous example. Both inserts will result in the same String,
'123-45__'. When MaskFormatter
is processing the insert at character position 3 (the '-'), two things can
happen:

  If the inserted character is '-', it is accepted.
  If the inserted character matches the mask for the next non-literal
      character, it is accepted at the new location.
  Anything else results in an invalid edit


By default MaskFormatter will not allow invalid edits, you can
change this with the setAllowsInvalid method, and will
commit edits on valid edits (use the setCommitsOnValidEdit to
change this).

By default, MaskFormatter is in overwrite mode. That is as
characters are typed a new character is not inserted, rather the character
at the current location is replaced with the newly typed character. You
can change this behavior by way of the method setOverwriteMode.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.MutableAttributeSet

A generic interface for a mutable collection of unique attributes.

Implementations will probably want to provide a constructor of the form: public XXXAttributeSet(ConstAttributeSet source);

A generic interface for a mutable collection of unique attributes.

Implementations will probably want to provide a constructor of the
form:
public XXXAttributeSet(ConstAttributeSet source);
raw docstring

javax.swing.text.NavigationFilter

NavigationFilter can be used to restrict where the cursor can be positioned. When the default cursor positioning actions attempt to reposition the cursor they will call into the NavigationFilter, assuming the JTextComponent has a non-null NavigationFilter set. In this manner the NavigationFilter can effectively restrict where the cursor can be positioned. Similarly DefaultCaret will call into the NavigationFilter when the user is changing the selection to further restrict where the cursor can be positioned.

Subclasses can conditionally call into supers implementation to restrict where the cursor can be placed, or call directly into the FilterBypass.

NavigationFilter can be used to restrict where the cursor can
be positioned. When the default cursor positioning actions attempt to
reposition the cursor they will call into the
NavigationFilter, assuming
the JTextComponent has a non-null
NavigationFilter set. In this manner
the NavigationFilter can effectively restrict where the
cursor can be positioned. Similarly DefaultCaret will call
into the NavigationFilter when the user is changing the
selection to further restrict where the cursor can be positioned.

Subclasses can conditionally call into supers implementation to restrict
where the cursor can be placed, or call directly into the
FilterBypass.
raw docstring

javax.swing.text.NavigationFilter$FilterBypass

Used as a way to circumvent calling back into the caret to position the cursor. Caret implementations that wish to support a NavigationFilter must provide an implementation that will not callback into the NavigationFilter.

Used as a way to circumvent calling back into the caret to
position the cursor. Caret implementations that wish to support
a NavigationFilter must provide an implementation that will
not callback into the NavigationFilter.
raw docstring

javax.swing.text.NumberFormatter

NumberFormatter subclasses InternationalFormatter adding special behavior for numbers. Among the specializations are (these are only used if the NumberFormatter does not display invalid numbers, for example, setAllowsInvalid(false)):

Pressing /- (- is determined from the DecimalFormatSymbols associated with the DecimalFormat) in any field but the exponent field will attempt to change the sign of the number to positive/negative. Pressing /- (- is determined from the DecimalFormatSymbols associated with the DecimalFormat) in the exponent field will attempt to change the sign of the exponent to positive/negative.

If you are displaying scientific numbers, you may wish to turn on overwrite mode, setOverwriteMode(true). For example:

DecimalFormat decimalFormat = new DecimalFormat("0.000E0"); NumberFormatter textFormatter = new NumberFormatter(decimalFormat); textFormatter.setOverwriteMode(true); textFormatter.setAllowsInvalid(false);

If you are going to allow the user to enter decimal values, you should either force the DecimalFormat to contain at least one decimal (#.0###), or allow the value to be invalid setAllowsInvalid(true). Otherwise users may not be able to input decimal values.

NumberFormatter provides slightly different behavior to stringToValue than that of its superclass. If you have specified a Class for values, DefaultFormatter.setValueClass(java.lang.Class<?>), that is one of of Integer, Long, Float, Double, Byte or Short and the Format's parseObject returns an instance of Number, the corresponding instance of the value class will be created using the constructor appropriate for the primitive type the value class represents. For example: setValueClass(Integer.class) will cause the resulting value to be created via new Integer(((Number)formatter.parseObject(string)).intValue()). This is typically useful if you wish to set a min/max value as the various Number implementations are generally not comparable to each other. This is also useful if for some reason you need a specific Number implementation for your values.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

NumberFormatter subclasses InternationalFormatter
adding special behavior for numbers. Among the specializations are
(these are only used if the NumberFormatter does not display
invalid numbers, for example, setAllowsInvalid(false)):

  Pressing /- (- is determined from the
      DecimalFormatSymbols associated with the
      DecimalFormat) in any field but the exponent
      field will attempt to change the sign of the number to
      positive/negative.
  Pressing /- (- is determined from the
      DecimalFormatSymbols associated with the
      DecimalFormat) in the exponent field will
      attempt to change the sign of the exponent to positive/negative.


If you are displaying scientific numbers, you may wish to turn on
overwrite mode, setOverwriteMode(true). For example:


DecimalFormat decimalFormat = new DecimalFormat("0.000E0");
NumberFormatter textFormatter = new NumberFormatter(decimalFormat);
textFormatter.setOverwriteMode(true);
textFormatter.setAllowsInvalid(false);

If you are going to allow the user to enter decimal
values, you should either force the DecimalFormat to contain at least
one decimal (#.0###), or allow the value to be invalid
setAllowsInvalid(true). Otherwise users may not be able to
input decimal values.

NumberFormatter provides slightly different behavior to
stringToValue than that of its superclass. If you have
specified a Class for values, DefaultFormatter.setValueClass(java.lang.Class<?>), that is one of
of Integer, Long, Float,
Double, Byte or Short and
the Format's parseObject returns an instance of
Number, the corresponding instance of the value class
will be created using the constructor appropriate for the primitive
type the value class represents. For example:
setValueClass(Integer.class) will cause the resulting
value to be created via
new Integer(((Number)formatter.parseObject(string)).intValue()).
This is typically useful if you
wish to set a min/max value as the various Number
implementations are generally not comparable to each other. This is also
useful if for some reason you need a specific Number
implementation for your values.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.ParagraphView

View of a simple line-wrapping paragraph that supports multiple fonts, colors, components, icons, etc. It is basically a vertical box with a margin around it. The contents of the box are a bunch of rows which are special horizontal boxes. This view creates a collection of views that represent the child elements of the paragraph element. Each of these views are placed into a row directly if they will fit, otherwise the breakView method is called to try and carve the view into pieces that fit.

View of a simple line-wrapping paragraph that supports
multiple fonts, colors, components, icons, etc.  It is
basically a vertical box with a margin around it.  The
contents of the box are a bunch of rows which are special
horizontal boxes.  This view creates a collection of
views that represent the child elements of the paragraph
element.  Each of these views are placed into a row
directly if they will fit, otherwise the breakView
method is called to try and carve the view into pieces
that fit.
raw docstring

javax.swing.text.PasswordView

Implements a View suitable for use in JPasswordField UI implementations. This is basically a field ui that renders its contents as the echo character specified in the associated component (if it can narrow the component to a JPasswordField).

Implements a View suitable for use in JPasswordField
UI implementations.  This is basically a field ui that
renders its contents as the echo character specified
in the associated component (if it can narrow the
component to a JPasswordField).
raw docstring

javax.swing.text.PlainDocument

A plain document that maintains no character attributes. The default element structure for this document is a map of the lines in the text. The Element returned by getDefaultRootElement is a map of the lines, and each child element represents a line. This model does not maintain any character level attributes, but each line can be tagged with an arbitrary set of attributes. Line to offset, and offset to line translations can be quickly performed using the default root element. The structure information of the DocumentEvent's fired by edits will indicate the line structure changes.

The default content storage management is performed by a gapped buffer implementation (GapContent). It supports editing reasonably large documents with good efficiency when the edits are contiguous or clustered, as is typical.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A plain document that maintains no character attributes.  The
default element structure for this document is a map of the lines in
the text.  The Element returned by getDefaultRootElement is
a map of the lines, and each child element represents a line.
This model does not maintain any character level attributes,
but each line can be tagged with an arbitrary set of attributes.
Line to offset, and offset to line translations can be quickly
performed using the default root element.  The structure information
of the DocumentEvent's fired by edits will indicate the line
structure changes.

The default content storage management is performed by a
gapped buffer implementation (GapContent).  It supports
editing reasonably large documents with good efficiency when
the edits are contiguous or clustered, as is typical.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.PlainView

Implements View interface for a simple multi-line text view that has text in one font and color. The view represents each child element as a line of text.

Implements View interface for a simple multi-line text view
that has text in one font and color.  The view represents each
child element as a line of text.
raw docstring

javax.swing.text.Position

Represents a location within a document. It is intended to abstract away implementation details of the document and enable specification of positions within the document that are capable of tracking of change as the document is edited.

A Position object points at a location between two characters. As the surrounding content is altered, the Position object adjusts its offset automatically to reflect the changes. If content is inserted or removed before the Position object's location, then the Position increments or decrements its offset, respectively, so as to point to the same location. If a portion of the document is removed that contains a Position's offset, then the Position's offset becomes that of the beginning of the removed region. For example, if a Position has an offset of 5 and the region 2-10 is removed, then the Position's offset becomes 2.

Position with an offset of 0 is a special case. It never changes its offset while document content is altered.

Represents a location within a document.  It is intended to abstract away
implementation details of the document and enable specification of
positions within the document that are capable of tracking of change as
the document is edited.

A Position object points at a location between two characters.
As the surrounding content is altered, the Position object
adjusts its offset automatically to reflect the changes. If content is
inserted or removed before the Position object's location, then the
Position increments or decrements its offset, respectively,
so as to point to the same location. If a portion of the document is removed
that contains a Position's offset, then the Position's
offset becomes that of the beginning of the removed region. For example, if
a Position has an offset of 5 and the region 2-10 is removed, then
the Position's offset becomes 2.

Position with an offset of 0 is a special case. It never changes its
offset while document content is altered.
raw docstring

javax.swing.text.Position$Bias

A typesafe enumeration to indicate bias to a position in the model. A position indicates a location between two characters. The bias can be used to indicate an interest toward one of the two sides of the position in boundary conditions where a simple offset is ambiguous.

A typesafe enumeration to indicate bias to a position
in the model.  A position indicates a location between
two characters.  The bias can be used to indicate an
interest toward one of the two sides of the position
in boundary conditions where a simple offset is
ambiguous.
raw docstring

javax.swing.text.rtf.core

No vars found in this namespace.

javax.swing.text.rtf.RTFEditorKit

This is the default implementation of RTF editing functionality. The RTF support was not written by the Swing team. In the future we hope to improve the support provided.

This is the default implementation of RTF editing
functionality.  The RTF support was not written by the
Swing team.  In the future we hope to improve the support
provided.
raw docstring

javax.swing.text.Segment

A segment of a character array representing a fragment of text. It should be treated as immutable even though the array is directly accessible. This gives fast access to fragments of text without the overhead of copying around characters. This is effectively an unprotected String.

The Segment implements the java.text.CharacterIterator interface to support use with the i18n support without copying text into a string.

A segment of a character array representing a fragment
of text.  It should be treated as immutable even though
the array is directly accessible.  This gives fast access
to fragments of text without the overhead of copying
around characters.  This is effectively an unprotected
String.

The Segment implements the java.text.CharacterIterator
interface to support use with the i18n support without
copying text into a string.
raw docstring

javax.swing.text.SimpleAttributeSet

A straightforward implementation of MutableAttributeSet using a hash table.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A straightforward implementation of MutableAttributeSet using a
hash table.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.StringContent

An implementation of the AbstractDocument.Content interface that is a brute force implementation that is useful for relatively small documents and/or debugging. It manages the character content as a simple character array. It is also quite inefficient.

It is generally recommended that the gap buffer or piece table implementations be used instead. This buffer does not scale up to large sizes.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An implementation of the AbstractDocument.Content interface that is
a brute force implementation that is useful for relatively small
documents and/or debugging.  It manages the character content
as a simple character array.  It is also quite inefficient.

It is generally recommended that the gap buffer or piece table
implementations be used instead.  This buffer does not scale up
to large sizes.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.Style

A collection of attributes to associate with an element in a document. Since these are typically used to associate character and paragraph styles with the element, operations for this are provided. Other customized attributes that get associated with the element will effectively be name-value pairs that live in a hierarchy and if a name (key) is not found locally, the request is forwarded to the parent. Commonly used attributes are separated out to facilitate alternative implementations that are more efficient.

A collection of attributes to associate with an element in a document.
Since these are typically used to associate character and paragraph
styles with the element, operations for this are provided.  Other
customized attributes that get associated with the element will
effectively be name-value pairs that live in a hierarchy and if a name
(key) is not found locally, the request is forwarded to the parent.
Commonly used attributes are separated out to facilitate alternative
implementations that are more efficient.
raw docstring

javax.swing.text.StyleConstants

A collection of well known or common attribute keys and methods to apply to an AttributeSet or MutableAttributeSet to get/set the properties in a typesafe manner.

The paragraph attributes form the definition of a paragraph to be rendered. All sizes are specified in points (such as found in postscript), a device independent measure.

 A collection of well known or common attribute keys
and methods to apply to an AttributeSet or MutableAttributeSet
to get/set the properties in a typesafe manner.

The paragraph attributes form the definition of a paragraph to be rendered.
All sizes are specified in points (such as found in postscript), a
device independent measure.
raw docstring

javax.swing.text.StyleConstants$CharacterConstants

This is a typesafe enumeration of the well-known attributes that contribute to a character style. These are aliased by the outer class for general presentation.

This is a typesafe enumeration of the well-known
attributes that contribute to a character style.  These are
aliased by the outer class for general presentation.
raw docstring

No vars found in this namespace.

javax.swing.text.StyleConstants$ColorConstants

This is a typesafe enumeration of the well-known attributes that contribute to a color. These are aliased by the outer class for general presentation.

This is a typesafe enumeration of the well-known
attributes that contribute to a color.  These are aliased
by the outer class for general presentation.
raw docstring

No vars found in this namespace.

javax.swing.text.StyleConstants$FontConstants

This is a typesafe enumeration of the well-known attributes that contribute to a font. These are aliased by the outer class for general presentation.

This is a typesafe enumeration of the well-known
attributes that contribute to a font.  These are aliased
by the outer class for general presentation.
raw docstring

No vars found in this namespace.

javax.swing.text.StyleConstants$ParagraphConstants

This is a typesafe enumeration of the well-known attributes that contribute to a paragraph style. These are aliased by the outer class for general presentation.

This is a typesafe enumeration of the well-known
attributes that contribute to a paragraph style.  These are
aliased by the outer class for general presentation.
raw docstring

No vars found in this namespace.

javax.swing.text.StyleContext

A pool of styles and their associated resources. This class determines the lifetime of a group of resources by being a container that holds caches for various resources such as font and color that get reused by the various style definitions. This can be shared by multiple documents if desired to maximize the sharing of related resources.

This class also provides efficient support for small sets of attributes and compresses them by sharing across uses and taking advantage of their immutable nature. Since many styles are replicated, the potential for sharing is significant, and copies can be extremely cheap. Larger sets reduce the possibility of sharing, and therefore revert automatically to a less space-efficient 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A pool of styles and their associated resources.  This class determines
the lifetime of a group of resources by being a container that holds
caches for various resources such as font and color that get reused
by the various style definitions.  This can be shared by multiple
documents if desired to maximize the sharing of related resources.

This class also provides efficient support for small sets of attributes
and compresses them by sharing across uses and taking advantage of
their immutable nature.  Since many styles are replicated, the potential
for sharing is significant, and copies can be extremely cheap.
Larger sets reduce the possibility of sharing, and therefore revert
automatically to a less space-efficient 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.StyledEditorKit

This is the set of things needed by a text component to be a reasonably functioning editor for some type of text document. This implementation provides a default implementation which treats text as styled text and provides a minimal set of actions for editing styled text.

This is the set of things needed by a text component
to be a reasonably functioning editor for some type
of text document.  This implementation provides a default
implementation which treats text as styled text and
provides a minimal set of actions for editing styled text.
raw docstring

javax.swing.text.StyledEditorKit$AlignmentAction

An action to set paragraph alignment. This sets the StyleConstants.Alignment attribute for the currently selected range of the target JEditorPane. This is done by calling StyledDocument.setParagraphAttributes on the styled document associated with the target JEditorPane.

If the target text component is specified as the source of the ActionEvent and there is a command string, the command string will be interpreted as an integer that should be one of the legal values for the StyleConstants.Alignment attribute.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An action to set paragraph alignment.  This sets the
StyleConstants.Alignment attribute for the
currently selected range of the target JEditorPane.
This is done by calling
StyledDocument.setParagraphAttributes
on the styled document associated with the target
JEditorPane.

If the target text component is specified as the
source of the ActionEvent and there is a command string,
the command string will be interpreted as an integer
that should be one of the legal values for the
StyleConstants.Alignment attribute.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.StyledEditorKit$BoldAction

An action to toggle the bold attribute.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An action to toggle the bold attribute.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.StyledEditorKit$FontFamilyAction

An action to set the font family in the associated JEditorPane. This will use the family specified as the command string on the ActionEvent if there is one, otherwise the family that was initialized with will be 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An action to set the font family in the associated
JEditorPane.  This will use the family specified as
the command string on the ActionEvent if there is one,
otherwise the family that was initialized with will be 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.StyledEditorKit$FontSizeAction

An action to set the font size in the associated JEditorPane. This will use the size specified as the command string on the ActionEvent if there is one, otherwise the size that was initialized with will be 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An action to set the font size in the associated
JEditorPane.  This will use the size specified as
the command string on the ActionEvent if there is one,
otherwise the size that was initialized with will be 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.StyledEditorKit$ForegroundAction

An action to set foreground color. This sets the StyleConstants.Foreground attribute for the currently selected range of the target JEditorPane. This is done by calling StyledDocument.setCharacterAttributes on the styled document associated with the target JEditorPane.

If the target text component is specified as the source of the ActionEvent and there is a command string, the command string will be interpreted as the foreground color. It will be interpreted by called Color.decode, and should therefore be legal input for that 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An action to set foreground color.  This sets the
StyleConstants.Foreground attribute for the
currently selected range of the target JEditorPane.
This is done by calling
StyledDocument.setCharacterAttributes
on the styled document associated with the target
JEditorPane.

If the target text component is specified as the
source of the ActionEvent and there is a command string,
the command string will be interpreted as the foreground
color.  It will be interpreted by called
Color.decode, and should therefore be
legal input for that 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.StyledEditorKit$ItalicAction

An action to toggle the italic attribute.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An action to toggle the italic attribute.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.StyledEditorKit$StyledTextAction

An action that assumes it's being fired on a JEditorPane with a StyledEditorKit (or subclass) installed. This has some convenience methods for causing character or paragraph level attribute changes. The convenience methods will throw an IllegalArgumentException if the assumption of a StyledDocument, a JEditorPane, or a StyledEditorKit fail to be true.

The component that gets acted upon by the action will be the source of the ActionEvent if the source can be narrowed to a JEditorPane type. If the source can't be narrowed, the most recently focused text component is changed. If neither of these are the case, the action cannot be performed.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An action that assumes it's being fired on a JEditorPane
with a StyledEditorKit (or subclass) installed.  This has
some convenience methods for causing character or paragraph
level attribute changes.  The convenience methods will
throw an IllegalArgumentException if the assumption of
a StyledDocument, a JEditorPane, or a StyledEditorKit
fail to be true.

The component that gets acted upon by the action
will be the source of the ActionEvent if the source
can be narrowed to a JEditorPane type.  If the source
can't be narrowed, the most recently focused text
component is changed.  If neither of these are the
case, the action cannot be performed.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.StyledEditorKit$UnderlineAction

An action to toggle the underline attribute.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An action to toggle the underline attribute.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.TabableView

Interface for Views that have size dependent upon tabs.

Interface for Views that have size dependent upon tabs.
raw docstring

javax.swing.text.TabExpander

Simple interface to allow for different types of implementations of tab expansion.

Simple interface to allow for different types of
implementations of tab expansion.
raw docstring

javax.swing.text.TableView

Implements View interface for a table, that is composed of an element structure where the child elements of the element this view is responsible for represent rows and the child elements of the row elements are cells. The cell elements can have an arbitrary element structure under them, which will be built with the ViewFactory returned by the getViewFactory method.

TABLE ROW CELL CELL ROW CELL CELL

This is implemented as a hierarchy of boxes, the table itself is a vertical box, the rows are horizontal boxes, and the cells are vertical boxes. The cells are allowed to span multiple columns and rows. By default, the table can be thought of as being formed over a grid (i.e. somewhat like one would find in gridbag layout), where table cells can request to span more than one grid cell. The default horizontal span of table cells will be based upon this grid, but can be changed by reimplementing the requested span of the cell (i.e. table cells can have independant spans if desired).

 Implements View interface for a table, that is composed of an
element structure where the child elements of the element
this view is responsible for represent rows and the child
elements of the row elements are cells.  The cell elements can
have an arbitrary element structure under them, which will
be built with the ViewFactory returned by the getViewFactory
method.


   TABLE
     ROW
       CELL
       CELL
     ROW
       CELL
       CELL

This is implemented as a hierarchy of boxes, the table itself
is a vertical box, the rows are horizontal boxes, and the cells
are vertical boxes.  The cells are allowed to span multiple
columns and rows.  By default, the table can be thought of as
being formed over a grid (i.e. somewhat like one would find in
gridbag layout), where table cells can request to span more
than one grid cell.  The default horizontal span of table cells
will be based upon this grid, but can be changed by reimplementing
the requested span of the cell (i.e. table cells can have independant
spans if desired).
raw docstring

javax.swing.text.TabSet

A TabSet is comprised of many TabStops. It offers methods for locating the closest TabStop to a given position and finding all the potential TabStops. It is also immutable.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A TabSet is comprised of many TabStops. It offers methods for locating the
closest TabStop to a given position and finding all the potential TabStops.
It is also immutable.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.TabStop

This class encapsulates a single tab stop (basically as tab stops are thought of by RTF). A tab stop is at a specified distance from the left margin, aligns text in a specified way, and has a specified leader. TabStops are immutable, and usually contained in TabSets.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

This class encapsulates a single tab stop (basically as tab stops
are thought of by RTF). A tab stop is at a specified distance from the
left margin, aligns text in a specified way, and has a specified leader.
TabStops are immutable, and usually contained in TabSets.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.TextAction

An Action implementation useful for key bindings that are shared across a number of different text components. Because the action is shared, it must have a way of getting it's target to act upon. This class provides support to try and find a text component to operate on. The preferred way of getting the component to act upon is through the ActionEvent that is received. If the Object returned by getSource can be narrowed to a text component, it will be used. If the action event is null or can't be narrowed, the last focused text component is tried. This is determined by being used in conjunction with a JTextController which arranges to share that information with a TextAction.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An Action implementation useful for key bindings that are
shared across a number of different text components.  Because
the action is shared, it must have a way of getting it's
target to act upon.  This class provides support to try and
find a text component to operate on.  The preferred way of
getting the component to act upon is through the ActionEvent
that is received.  If the Object returned by getSource can
be narrowed to a text component, it will be used.  If the
action event is null or can't be narrowed, the last focused
text component is tried.  This is determined by being
used in conjunction with a JTextController which
arranges to share that information with a TextAction.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.text.View

A very important part of the text package is the View class. As the name suggests it represents a view of the text model, or a piece of the text model. It is this class that is responsible for the look of the text component. The view is not intended to be some completely new thing that one must learn, but rather is much like a lightweight component.

By default, a view is very light. It contains a reference to the parent view from which it can fetch many things without holding state, and it contains a reference to a portion of the model (Element). A view does not have to exactly represent an element in the model, that is simply a typical and therefore convenient mapping. A view can alternatively maintain a couple of Position objects to maintain its location in the model (i.e. represent a fragment of an element). This is typically the result of formatting where views have been broken down into pieces. The convenience of a substantial relationship to the element makes it easier to build factories to produce the views, and makes it easier to keep track of the view pieces as the model is changed and the view must be changed to reflect the model. Simple views therefore represent an Element directly and complex views do not.

A view has the following responsibilities:

Participate in layout.

The view has a setSize method which is like
doLayout and setSize in Component combined.
The view has a preferenceChanged method which is
like invalidate in Component except that one can
invalidate just one axis
and the child requesting the change is identified.
A View expresses the size that it would like to be in terms of three
values, a minimum, a preferred, and a maximum span.  Layout in a view is
can be done independently upon each axis.  For a properly functioning View
implementation, the minimum span will be <= the preferred span which in turn
will be <= the maximum span.


The minimum set of methods for layout are:

getMinimumSpan
getPreferredSpan
getMaximumSpan
getAlignment
preferenceChanged
setSize

The setSize method should be prepared to be called a number of times (i.e. It may be called even if the size didn't change). The setSize method is generally called to make sure the View layout is complete prior to trying to perform an operation on it that requires an up-to-date layout. A view's size should always be set to a value within the minimum and maximum span specified by that view. Additionally, the view must always call the preferenceChanged method on the parent if it has changed the values for the layout it would like, and expects the parent to honor. The parent View is not required to recognize a change until the preferenceChanged has been sent. This allows parent View implementations to cache the child requirements if desired. The calling sequence looks something like the following:

The exact calling sequence is up to the layout functionality of
the parent view (if the view has any children).  The view may collect
the preferences of the children prior to determining what it will give
each child, or it might iteratively update the children one at a time.


Render a portion of the model.

This is done in the paint method, which is pretty much like a component
paint method.  Views are expected to potentially populate a fairly large
tree.  A View has the following semantics for rendering:


The view gets its allocation from the parent at paint time, so it
must be prepared to redo layout if the allocated area is different from
what it is prepared to deal with.
The coordinate system is the same as the hosting Component
(i.e. the Component returned by the
getContainer method).
This means a child view lives in the same coordinate system as the parent
view unless the parent has explicitly changed the coordinate system.
To schedule itself to be repainted a view can call repaint on the hosting
Component.
The default is to not clip the children.  It is more efficient
to allow a view to clip only if it really feels it needs clipping.
The Graphics object given is not initialized in any way.
A view should set any settings needed.
A View is inherently transparent.  While a view may render into its
entire allocation, typically a view does not.  Rendering is performed by
traversing down the tree of View implementations.
Each View is responsible
for rendering its children.  This behavior is depended upon for thread
safety.  While view implementations do not necessarily have to be implemented
with thread safety in mind, other view implementations that do make use of
concurrency can depend upon a tree traversal to guarantee thread safety.
The order of views relative to the model is up to the implementation.
Although child views will typically be arranged in the same order that they
occur in the model, they may be visually arranged in an entirely different
order.  View implementations may have Z-Order associated with them if the
children are overlapping.

The methods for rendering are:

paint


Translate between the model and view coordinate systems.

Because the view objects are produced from a factory and therefore cannot
necessarily be counted upon to be in a particular pattern, one must be able
to perform translation to properly locate spatial representation of the model.
The methods for doing this are:

modelToView
viewToModel
getDocument
getElement
getStartOffset
getEndOffset

The layout must be valid prior to attempting to make the translation.
The translation is not valid, and must not be attempted while changes
are being broadcasted from the model via a DocumentEvent.


Respond to changes from the model.

If the overall view is represented by many pieces (which is the best situation
if one want to be able to change the view and write the least amount of new code),
it would be impractical to have a huge number of DocumentListeners.
If each
view listened to the model, only a few would actually be interested in the
changes broadcasted at any given time.   Since the model has no knowledge of
views, it has no way to filter the broadcast of change information.  The view
hierarchy itself is instead responsible for propagating the change information.
At any level in the view hierarchy, that view knows enough about its children to
best distribute the change information further.   Changes are therefore broadcasted
starting from the root of the view hierarchy.
The methods for doing this are:

insertUpdate
removeUpdate
changedUpdate
 A very important part of the text package is the View class.
 As the name suggests it represents a view of the text model,
 or a piece of the text model.
 It is this class that is responsible for the look of the text component.
 The view is not intended to be some completely new thing that one must
 learn, but rather is much like a lightweight component.

By default, a view is very light.  It contains a reference to the parent
view from which it can fetch many things without holding state, and it
contains a reference to a portion of the model (Element).
A view does not
have to exactly represent an element in the model, that is simply a typical
and therefore convenient mapping.  A view can alternatively maintain a couple
of Position objects to maintain its location in the model (i.e. represent
a fragment of an element).  This is typically the result of formatting where
views have been broken down into pieces.  The convenience of a substantial
relationship to the element makes it easier to build factories to produce the
views, and makes it easier  to keep track of the view pieces as the model is
changed and the view must be changed to reflect the model.  Simple views
therefore represent an Element directly and complex views do not.

A view has the following responsibilities:


    Participate in layout.

    The view has a setSize method which is like
    doLayout and setSize in Component combined.
    The view has a preferenceChanged method which is
    like invalidate in Component except that one can
    invalidate just one axis
    and the child requesting the change is identified.
    A View expresses the size that it would like to be in terms of three
    values, a minimum, a preferred, and a maximum span.  Layout in a view is
    can be done independently upon each axis.  For a properly functioning View
    implementation, the minimum span will be <= the preferred span which in turn
    will be <= the maximum span.


    The minimum set of methods for layout are:

    getMinimumSpan
    getPreferredSpan
    getMaximumSpan
    getAlignment
    preferenceChanged
    setSize


  The setSize method should be prepared to be called a number of times
    (i.e. It may be called even if the size didn't change).
    The setSize method
    is generally called to make sure the View layout is complete prior to trying
    to perform an operation on it that requires an up-to-date layout.  A view's
    size should always be set to a value within the minimum and maximum
    span specified by that view.  Additionally, the view must always call the
    preferenceChanged method on the parent if it has changed the
    values for the
    layout it would like, and expects the parent to honor.  The parent View is
    not required to recognize a change until the preferenceChanged
    has been sent.
    This allows parent View implementations to cache the child requirements if
    desired.  The calling sequence looks something like the following:



    The exact calling sequence is up to the layout functionality of
    the parent view (if the view has any children).  The view may collect
    the preferences of the children prior to determining what it will give
    each child, or it might iteratively update the children one at a time.


    Render a portion of the model.

    This is done in the paint method, which is pretty much like a component
    paint method.  Views are expected to potentially populate a fairly large
    tree.  A View has the following semantics for rendering:


    The view gets its allocation from the parent at paint time, so it
    must be prepared to redo layout if the allocated area is different from
    what it is prepared to deal with.
    The coordinate system is the same as the hosting Component
    (i.e. the Component returned by the
    getContainer method).
    This means a child view lives in the same coordinate system as the parent
    view unless the parent has explicitly changed the coordinate system.
    To schedule itself to be repainted a view can call repaint on the hosting
    Component.
    The default is to not clip the children.  It is more efficient
    to allow a view to clip only if it really feels it needs clipping.
    The Graphics object given is not initialized in any way.
    A view should set any settings needed.
    A View is inherently transparent.  While a view may render into its
    entire allocation, typically a view does not.  Rendering is performed by
    traversing down the tree of View implementations.
    Each View is responsible
    for rendering its children.  This behavior is depended upon for thread
    safety.  While view implementations do not necessarily have to be implemented
    with thread safety in mind, other view implementations that do make use of
    concurrency can depend upon a tree traversal to guarantee thread safety.
    The order of views relative to the model is up to the implementation.
    Although child views will typically be arranged in the same order that they
    occur in the model, they may be visually arranged in an entirely different
    order.  View implementations may have Z-Order associated with them if the
    children are overlapping.

    The methods for rendering are:

    paint


    Translate between the model and view coordinate systems.

    Because the view objects are produced from a factory and therefore cannot
    necessarily be counted upon to be in a particular pattern, one must be able
    to perform translation to properly locate spatial representation of the model.
    The methods for doing this are:

    modelToView
    viewToModel
    getDocument
    getElement
    getStartOffset
    getEndOffset

    The layout must be valid prior to attempting to make the translation.
    The translation is not valid, and must not be attempted while changes
    are being broadcasted from the model via a DocumentEvent.


    Respond to changes from the model.

    If the overall view is represented by many pieces (which is the best situation
    if one want to be able to change the view and write the least amount of new code),
    it would be impractical to have a huge number of DocumentListeners.
    If each
    view listened to the model, only a few would actually be interested in the
    changes broadcasted at any given time.   Since the model has no knowledge of
    views, it has no way to filter the broadcast of change information.  The view
    hierarchy itself is instead responsible for propagating the change information.
    At any level in the view hierarchy, that view knows enough about its children to
    best distribute the change information further.   Changes are therefore broadcasted
    starting from the root of the view hierarchy.
    The methods for doing this are:

    insertUpdate
    removeUpdate
    changedUpdate
raw docstring

javax.swing.text.ViewFactory

A factory to create a view of some portion of document subject. This is intended to enable customization of how views get mapped over a document model.

A factory to create a view of some portion of document subject.
This is intended to enable customization of how views get
mapped over a document model.
raw docstring

javax.swing.text.WrappedPlainView

View of plain text (text with only one font and color) that does line-wrapping. This view expects that its associated element has child elements that represent the lines it should be wrapping. It is implemented as a vertical box that contains logical line views. The logical line views are nested classes that render the logical line as multiple physical line if the logical line is too wide to fit within the allocation. The line views draw upon the outer class for its state to reduce their memory requirements.

The line views do all of their rendering through the drawLine method which in turn does all of its rendering through the drawSelectedText and drawUnselectedText methods. This enables subclasses to easily specialize the rendering without concern for the layout aspects.

View of plain text (text with only one font and color)
that does line-wrapping.  This view expects that its
associated element has child elements that represent
the lines it should be wrapping.  It is implemented
as a vertical box that contains logical line views.
The logical line views are nested classes that render
the logical line as multiple physical line if the logical
line is too wide to fit within the allocation.  The
line views draw upon the outer class for its state
to reduce their memory requirements.

The line views do all of their rendering through the
drawLine method which in turn does all of
its rendering through the drawSelectedText
and drawUnselectedText methods.  This
enables subclasses to easily specialize the rendering
without concern for the layout aspects.
raw docstring

javax.swing.text.ZoneView

ZoneView is a View implementation that creates zones for which the child views are not created or stored until they are needed for display or model/view translations. This enables a substantial reduction in memory consumption for situations where the model being represented is very large, by building view objects only for the region being actively viewed/edited. The size of the children can be estimated in some way, or calculated asynchronously with only the result being saved.

ZoneView extends BoxView to provide a box that implements zones for its children. The zones are special View implementations (the children of an instance of this class) that represent only a portion of the model that an instance of ZoneView is responsible for. The zones don't create child views until an attempt is made to display them. A box shaped view is well suited to this because:

Boxes are a heavily used view, and having a box that provides this behavior gives substantial opportunity to plug the behavior into a view hierarchy from the view factory.

Boxes are tiled in one direction, so it is easy to divide them into zones in a reliable way.

Boxes typically have a simple relationship to the model (i.e. they create child views that directly represent the child elements).

Boxes are easier to estimate the size of than some other shapes.

The default behavior is controlled by two properties, maxZoneSize and maxZonesLoaded. Setting maxZoneSize to Integer.MAX_VALUE would have the effect of causing only one zone to be created. This would effectively turn the view into an implementation of the decorator pattern. Setting maxZonesLoaded to a value of Integer.MAX_VALUE would cause zones to never be unloaded. For simplicity, zones are created on boundaries represented by the child elements of the element the view is responsible for. The zones can be any View implementation, but the default implementation is based upon AsyncBoxView which supports fairly large zones efficiently.

ZoneView is a View implementation that creates zones for which
the child views are not created or stored until they are needed
for display or model/view translations.  This enables a substantial
reduction in memory consumption for situations where the model
being represented is very large, by building view objects only for
the region being actively viewed/edited.  The size of the children
can be estimated in some way, or calculated asynchronously with
only the result being saved.

ZoneView extends BoxView to provide a box that implements
zones for its children.  The zones are special View implementations
(the children of an instance of this class) that represent only a
portion of the model that an instance of ZoneView is responsible
for.  The zones don't create child views until an attempt is made
to display them. A box shaped view is well suited to this because:


  Boxes are a heavily used view, and having a box that
  provides this behavior gives substantial opportunity
  to plug the behavior into a view hierarchy from the
  view factory.

  Boxes are tiled in one direction, so it is easy to
  divide them into zones in a reliable way.

  Boxes typically have a simple relationship to the model (i.e. they
  create child views that directly represent the child elements).

  Boxes are easier to estimate the size of than some other shapes.


The default behavior is controlled by two properties, maxZoneSize
and maxZonesLoaded.  Setting maxZoneSize to Integer.MAX_VALUE would
have the effect of causing only one zone to be created.  This would
effectively turn the view into an implementation of the decorator
pattern.  Setting maxZonesLoaded to a value of Integer.MAX_VALUE would
cause zones to never be unloaded.  For simplicity, zones are created on
boundaries represented by the child elements of the element the view is
responsible for.  The zones can be any View implementation, but the
default implementation is based upon AsyncBoxView which supports fairly
large zones efficiently.
raw docstring

javax.swing.Timer

Fires one or more ActionEvents at specified intervals. An example use is an animation object that uses a Timer as the trigger for drawing its frames.

Setting up a timer involves creating a Timer object, registering one or more action listeners on it, and starting the timer using the start method. For example, the following code creates and starts a timer that fires an action event once per second (as specified by the first argument to the Timer constructor). The second argument to the Timer constructor specifies a listener to receive the timer's action events.

int delay = 1000; //milliseconds ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { //...Perform a task... } }; new Timer(delay, taskPerformer).start();

Timers are constructed by specifying both a delay parameter and an ActionListener. The delay parameter is used to set both the initial delay and the delay between event firing, in milliseconds. Once the timer has been started, it waits for the initial delay before firing its first ActionEvent to registered listeners. After this first event, it continues to fire events every time the between-event delay has elapsed, until it is stopped.

After construction, the initial delay and the between-event delay can be changed independently, and additional ActionListeners may be added.

If you want the timer to fire only the first time and then stop, invoke setRepeats(false) on the timer.

Although all Timers perform their waiting using a single, shared thread (created by the first Timer object that executes), the action event handlers for Timers execute on another thread -- the event-dispatching thread. This means that the action handlers for Timers can safely perform operations on Swing components. However, it also means that the handlers must execute quickly to keep the GUI responsive.

In v 1.3, another Timer class was added to the Java platform: java.util.Timer. Both it and javax.swing.Timer provide the same basic functionality, but java.util.Timer is more general and has more features. The javax.swing.Timer has two features that can make it a little easier to use with GUIs. First, its event handling metaphor is familiar to GUI programmers and can make dealing with the event-dispatching thread a bit simpler. Second, its automatic thread sharing means that you don't have to take special steps to avoid spawning too many threads. Instead, your timer uses the same thread used to make cursors blink, tool tips appear, and so on.

You can find further documentation and several examples of using timers by visiting How to Use Timers, a section in The Java Tutorial. For more examples and help in choosing between this Timer class and java.util.Timer, see Using Timers in Swing Applications, an article in The Swing Connection.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Fires one or more ActionEvents at specified
intervals. An example use is an animation object that uses a
Timer as the trigger for drawing its frames.

Setting up a timer
involves creating a Timer object,
registering one or more action listeners on it,
and starting the timer using
the start method.
For example,
the following code creates and starts a timer
that fires an action event once per second
(as specified by the first argument to the Timer constructor).
The second argument to the Timer constructor
specifies a listener to receive the timer's action events.



 int delay = 1000; //milliseconds
 ActionListener taskPerformer = new ActionListener() {
     public void actionPerformed(ActionEvent evt) {
         //...Perform a task...
     }
 };
 new Timer(delay, taskPerformer).start();


Timers are constructed by specifying both a delay parameter
and an ActionListener. The delay parameter is used
to set both the initial delay and the delay between event
firing, in milliseconds. Once the timer has been started,
it waits for the initial delay before firing its
first ActionEvent to registered listeners.
After this first event, it continues to fire events
every time the between-event delay has elapsed, until it
is stopped.

After construction, the initial delay and the between-event
delay can be changed independently, and additional
ActionListeners may be added.

If you want the timer to fire only the first time and then stop,
invoke setRepeats(false) on the timer.

Although all Timers perform their waiting
using a single, shared thread
(created by the first Timer object that executes),
the action event handlers for Timers
execute on another thread -- the event-dispatching thread.
This means that the action handlers for Timers
can safely perform operations on Swing components.
However, it also means that the handlers must execute quickly
to keep the GUI responsive.


In v 1.3, another Timer class was added
to the Java platform: java.util.Timer.
Both it and javax.swing.Timer
provide the same basic functionality,
but java.util.Timer
is more general and has more features.
The javax.swing.Timer has two features
that can make it a little easier to use with GUIs.
First, its event handling metaphor is familiar to GUI programmers
and can make dealing with the event-dispatching thread
a bit simpler.
Second, its
automatic thread sharing means that you don't have to
take special steps to avoid spawning
too many threads.
Instead, your timer uses the same thread
used to make cursors blink,
tool tips appear,
and so on.


You can find further documentation
and several examples of using timers by visiting
How to Use Timers,
a section in The Java Tutorial.
For more examples and help in choosing between
this Timer class and
java.util.Timer,
see
Using Timers in Swing Applications,
an article in The Swing Connection.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.ToolTipManager

Manages all the ToolTips in the system.

ToolTipManager contains numerous properties for configuring how long it will take for the tooltips to become visible, and how long till they hide. Consider a component that has a different tooltip based on where the mouse is, such as JTree. When the mouse moves into the JTree and over a region that has a valid tooltip, the tooltip will become visible after initialDelay milliseconds. After dismissDelay milliseconds the tooltip will be hidden. If the mouse is over a region that has a valid tooltip, and the tooltip is currently visible, when the mouse moves to a region that doesn't have a valid tooltip the tooltip will be hidden. If the mouse then moves back into a region that has a valid tooltip within reshowDelay milliseconds, the tooltip will immediately be shown, otherwise the tooltip will be shown again after initialDelay milliseconds.

Manages all the ToolTips in the system.

ToolTipManager contains numerous properties for configuring how long it
will take for the tooltips to become visible, and how long till they
hide. Consider a component that has a different tooltip based on where
the mouse is, such as JTree. When the mouse moves into the JTree and
over a region that has a valid tooltip, the tooltip will become
visible after initialDelay milliseconds. After
dismissDelay milliseconds the tooltip will be hidden. If
the mouse is over a region that has a valid tooltip, and the tooltip
is currently visible, when the mouse moves to a region that doesn't have
a valid tooltip the tooltip will be hidden. If the mouse then moves back
into a region that has a valid tooltip within reshowDelay
milliseconds, the tooltip will immediately be shown, otherwise the
tooltip will be shown again after initialDelay milliseconds.
raw docstring

javax.swing.TransferHandler

This class is used to handle the transfer of a Transferable to and from Swing components. The Transferable is used to represent data that is exchanged via a cut, copy, or paste to/from a clipboard. It is also used in drag-and-drop operations to represent a drag from a component, and a drop to a component. Swing provides functionality that automatically supports cut, copy, and paste keyboard bindings that use the functionality provided by an implementation of this class. Swing also provides functionality that automatically supports drag and drop that uses the functionality provided by an implementation of this class. The Swing developer can concentrate on specifying the semantics of a transfer primarily by setting the transferHandler property on a Swing component.

This class is implemented to provide a default behavior of transferring a component property simply by specifying the name of the property in the constructor. For example, to transfer the foreground color from one component to another either via the clipboard or a drag and drop operation a TransferHandler can be constructed with the string "foreground". The built in support will use the color returned by getForeground as the source of the transfer, and setForeground for the target of a transfer.

Please see

How to Use Drag and Drop and Data Transfer, a section in The Java Tutorial, for more information.

This class is used to handle the transfer of a Transferable
to and from Swing components.  The Transferable is used to
represent data that is exchanged via a cut, copy, or paste
to/from a clipboard.  It is also used in drag-and-drop operations
to represent a drag from a component, and a drop to a component.
Swing provides functionality that automatically supports cut, copy,
and paste keyboard bindings that use the functionality provided by
an implementation of this class.  Swing also provides functionality
that automatically supports drag and drop that uses the functionality
provided by an implementation of this class.  The Swing developer can
concentrate on specifying the semantics of a transfer primarily by setting
the transferHandler property on a Swing component.

This class is implemented to provide a default behavior of transferring
a component property simply by specifying the name of the property in
the constructor.  For example, to transfer the foreground color from
one component to another either via the clipboard or a drag and drop operation
a TransferHandler can be constructed with the string "foreground".  The
built in support will use the color returned by getForeground as the source
of the transfer, and setForeground for the target of a transfer.

Please see

How to Use Drag and Drop and Data Transfer,
a section in The Java Tutorial, for more information.
raw docstring

javax.swing.TransferHandler$DropLocation

Represents a location where dropped data should be inserted. This is a base class that only encapsulates a point. Components supporting drop may provide subclasses of this containing more information.

Developers typically shouldn't create instances of, or extend, this class. Instead, these are something provided by the DnD implementation by TransferSupport instances and by components with a getDropLocation() method.

Represents a location where dropped data should be inserted.
This is a base class that only encapsulates a point.
Components supporting drop may provide subclasses of this
containing more information.

Developers typically shouldn't create instances of, or extend, this
class. Instead, these are something provided by the DnD
implementation by TransferSupport instances and by
components with a getDropLocation() method.
raw docstring

javax.swing.TransferHandler$TransferSupport

This class encapsulates all relevant details of a clipboard or drag and drop transfer, and also allows for customizing aspects of the drag and drop experience.

The main purpose of this class is to provide the information needed by a developer to determine the suitability of a transfer or to import the data contained within. But it also doubles as a controller for customizing properties during drag and drop, such as whether or not to show the drop location, and which drop action to use.

Developers typically need not create instances of this class. Instead, they are something provided by the DnD implementation to certain methods in TransferHandler.

This class encapsulates all relevant details of a clipboard
or drag and drop transfer, and also allows for customizing
aspects of the drag and drop experience.

The main purpose of this class is to provide the information
needed by a developer to determine the suitability of a
transfer or to import the data contained within. But it also
doubles as a controller for customizing properties during drag
and drop, such as whether or not to show the drop location,
and which drop action to use.

Developers typically need not create instances of this
class. Instead, they are something provided by the DnD
implementation to certain methods in TransferHandler.
raw docstring

javax.swing.tree.AbstractLayoutCache

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.tree.AbstractLayoutCache$NodeDimensions

Used by AbstractLayoutCache to determine the size and x origin of a particular node.

Used by AbstractLayoutCache to determine the size
and x origin of a particular node.
raw docstring

javax.swing.tree.core

No vars found in this namespace.

javax.swing.tree.DefaultMutableTreeNode

A DefaultMutableTreeNode is a general-purpose node in a tree data structure. For examples of using default mutable tree nodes, see How to Use Trees in The Java Tutorial.

A tree node may have at most one parent and 0 or more children. DefaultMutableTreeNode provides operations for examining and modifying a node's parent and children and also operations for examining the tree that the node is a part of. A node's tree is the set of all nodes that can be reached by starting at the node and following all the possible links to parents and children. A node with no parent is the root of its tree; a node with no children is a leaf. A tree may consist of many subtrees, each node acting as the root for its own subtree.

This class provides enumerations for efficiently traversing a tree or subtree in various orders or for following the path between two nodes. A DefaultMutableTreeNode may also hold a reference to a user object, the use of which is left to the user. Asking a DefaultMutableTreeNode for its string representation with toString() returns the string representation of its user object.

This is not a thread safe class.If you intend to use a DefaultMutableTreeNode (or a tree of TreeNodes) in more than one thread, you need to do your own synchronizing. A good convention to adopt is synchronizing on the root node of a tree.

While DefaultMutableTreeNode implements the MutableTreeNode interface and will allow you to add in any implementation of MutableTreeNode not all of the methods in DefaultMutableTreeNode will be applicable to all MutableTreeNodes implementations. Especially with some of the enumerations that are provided, using some of these methods assumes the DefaultMutableTreeNode contains only DefaultMutableNode instances. All of the TreeNode/MutableTreeNode methods will behave as defined no matter what implementations are added.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A DefaultMutableTreeNode is a general-purpose node in a tree data
structure.
For examples of using default mutable tree nodes, see
How to Use Trees
in The Java Tutorial.



A tree node may have at most one parent and 0 or more children.
DefaultMutableTreeNode provides operations for examining and modifying a
node's parent and children and also operations for examining the tree that
the node is a part of.  A node's tree is the set of all nodes that can be
reached by starting at the node and following all the possible links to
parents and children.  A node with no parent is the root of its tree; a
node with no children is a leaf.  A tree may consist of many subtrees,
each node acting as the root for its own subtree.

This class provides enumerations for efficiently traversing a tree or
subtree in various orders or for following the path between two nodes.
A DefaultMutableTreeNode may also hold a reference to a user object, the
use of which is left to the user.  Asking a DefaultMutableTreeNode for its
string representation with toString() returns the string
representation of its user object.

This is not a thread safe class.If you intend to use
a DefaultMutableTreeNode (or a tree of TreeNodes) in more than one thread, you
need to do your own synchronizing. A good convention to adopt is
synchronizing on the root node of a tree.

While DefaultMutableTreeNode implements the MutableTreeNode interface and
will allow you to add in any implementation of MutableTreeNode not all
of the methods in DefaultMutableTreeNode will be applicable to all
MutableTreeNodes implementations. Especially with some of the enumerations
that are provided, using some of these methods assumes the
DefaultMutableTreeNode contains only DefaultMutableNode instances. All
of the TreeNode/MutableTreeNode methods will behave as defined no
matter what implementations are added.


Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.tree.DefaultTreeCellEditor

A TreeCellEditor. You need to supply an instance of DefaultTreeCellRenderer so that the icons can be obtained. You can optionally supply a TreeCellEditor that will be layed out according to the icon in the DefaultTreeCellRenderer. If you do not supply a TreeCellEditor, a TextField will be used. Editing is started on a triple mouse click, or after a click, pause, click and a delay of 1200 milliseconds.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A TreeCellEditor. You need to supply an
instance of DefaultTreeCellRenderer
so that the icons can be obtained. You can optionally supply
a TreeCellEditor that will be layed out according
to the icon in the DefaultTreeCellRenderer.
If you do not supply a TreeCellEditor,
a TextField will be used. Editing is started
on a triple mouse click, or after a click, pause, click and
a delay of 1200 milliseconds.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.tree.DefaultTreeCellRenderer

Displays an entry in a tree. DefaultTreeCellRenderer is not opaque and unless you subclass paint you should not change this. See How to Use Trees in The Java Tutorial for examples of customizing node display using this class.

The set of icons and colors used by DefaultTreeCellRenderer can be configured using the various setter methods. The value for each property is initialized from the defaults table. When the look and feel changes (updateUI is invoked), any properties that have a value of type UIResource are refreshed from the defaults table. The following table lists the mapping between DefaultTreeCellRenderer property and defaults table key:

Property:
Key:

"leafIcon""Tree.leafIcon" "closedIcon""Tree.closedIcon" "openIcon""Tree.openIcon" "textSelectionColor""Tree.selectionForeground" "textNonSelectionColor""Tree.textForeground" "backgroundSelectionColor""Tree.selectionBackground" "backgroundNonSelectionColor""Tree.textBackground" "borderSelectionColor""Tree.selectionBorderColor"

Implementation Note: This class overrides invalidate, 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 tree 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Displays an entry in a tree.
DefaultTreeCellRenderer is not opaque and
unless you subclass paint you should not change this.
See How to Use Trees
in The Java Tutorial
for examples of customizing node display using this class.

The set of icons and colors used by DefaultTreeCellRenderer
can be configured using the various setter methods. The value for
each property is initialized from the defaults table. When the
look and feel changes (updateUI is invoked), any properties
that have a value of type UIResource are refreshed from the
defaults table. The following table lists the mapping between
DefaultTreeCellRenderer property and defaults table key:


    Property:
    Key:
  "leafIcon""Tree.leafIcon"
  "closedIcon""Tree.closedIcon"
  "openIcon""Tree.openIcon"
  "textSelectionColor""Tree.selectionForeground"
  "textNonSelectionColor""Tree.textForeground"
  "backgroundSelectionColor""Tree.selectionBackground"
  "backgroundNonSelectionColor""Tree.textBackground"
  "borderSelectionColor""Tree.selectionBorderColor"


Implementation Note:
This class overrides
invalidate,
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 tree 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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.tree.DefaultTreeModel

A simple tree data model that uses TreeNodes. For further information and examples that use DefaultTreeModel, see How to Use Trees 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A simple tree data model that uses TreeNodes.
For further information and examples that use DefaultTreeModel,
see How to Use Trees
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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.tree.DefaultTreeSelectionModel

Default implementation of TreeSelectionModel. Listeners are notified whenever the paths in the selection change, not the rows. In order to be able to track row changes you may wish to become a listener for expansion events on the tree and test for changes from there. resetRowSelection is called from any of the methods that update the selected paths. If you subclass any of these methods to filter what is allowed to be selected, be sure and message resetRowSelection if you do not message super.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Default implementation of TreeSelectionModel.  Listeners are notified
whenever
the paths in the selection change, not the rows. In order
to be able to track row changes you may wish to become a listener
for expansion events on the tree and test for changes from there.
resetRowSelection is called from any of the methods that update
the selected paths. If you subclass any of these methods to
filter what is allowed to be selected, be sure and message
resetRowSelection if you do not message super.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.tree.ExpandVetoException

Exception used to stop and expand/collapse from happening. See How to Write a Tree-Will-Expand Listener in The Java Tutorial for further information and examples.

Exception used to stop and expand/collapse from happening.
See How to Write a Tree-Will-Expand Listener
in The Java Tutorial
for further information and examples.
raw docstring

javax.swing.tree.FixedHeightLayoutCache

NOTE: This will become more open in a future release.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

NOTE: This will become more open in a future release.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.tree.MutableTreeNode

Defines the requirements for a tree node object that can change -- by adding or removing child nodes, or by changing the contents of a user object stored in the node.

Defines the requirements for a tree node object that can change --
by adding or removing child nodes, or by changing the contents
of a user object stored in the node.
raw docstring

javax.swing.tree.RowMapper

Defines the requirements for an object that translates paths in the tree into display rows.

Defines the requirements for an object that translates paths in
the tree into display rows.
raw docstring

javax.swing.tree.TreeCellEditor

Adds to CellEditor the extensions necessary to configure an editor in a tree.

Adds to CellEditor the extensions necessary to configure an editor
in a tree.
raw docstring

javax.swing.tree.TreeCellRenderer

Defines the requirements for an object that displays a tree node. See How to Use Trees in The Java Tutorial for an example of implementing a tree cell renderer that displays custom icons.

Defines the requirements for an object that displays a tree node.
See How to Use Trees
in The Java Tutorial
for an example of implementing a tree cell renderer
that displays custom icons.
raw docstring

javax.swing.tree.TreeModel

The model used by JTree.

JTree and its related classes make extensive use of TreePaths for identifying nodes in the TreeModel. If a TreeModel returns the same object, as compared by equals, at two different indices under the same parent than the resulting TreePath objects will be considered equal as well. Some implementations may assume that if two TreePaths are equal, they identify the same node. If this condition is not met, painting problems and other oddities may result. In other words, if getChild for a given parent returns the same Object (as determined by equals) problems may result, and it is recommended you avoid doing this.

Similarly JTree and its related classes place TreePaths in Maps. As such if a node is requested twice, the return values must be equal (using the equals method) and have the same hashCode.

For further information on tree models, including an example of a custom implementation, see How to Use Trees in The Java Tutorial.

The model used by JTree.

JTree and its related classes make extensive use of
TreePaths for identifying nodes in the TreeModel.
If a TreeModel returns the same object, as compared by
equals, at two different indices under the same parent
than the resulting TreePath objects will be considered equal
as well. Some implementations may assume that if two
TreePaths are equal, they identify the same node. If this
condition is not met, painting problems and other oddities may result.
In other words, if getChild for a given parent returns
the same Object (as determined by equals) problems may
result, and it is recommended you avoid doing this.

Similarly JTree and its related classes place
TreePaths in Maps.  As such if
a node is requested twice, the return values must be equal
(using the equals method) and have the same
hashCode.

For further information on tree models,
including an example of a custom implementation,
see How to Use Trees
in The Java Tutorial.
raw docstring

javax.swing.tree.TreeNode

Defines the requirements for an object that can be used as a tree node in a JTree.

Implementations of TreeNode that override equals will typically need to override hashCode as well. Refer to TreeModel for more information.

For further information and examples of using tree nodes, see How to Use Tree Nodes in The Java Tutorial.

Defines the requirements for an object that can be used as a
tree node in a JTree.

Implementations of TreeNode that override equals
will typically need to override hashCode as well.  Refer
to TreeModel for more information.

For further information and examples of using tree nodes,
see How to Use Tree Nodes
in The Java Tutorial.
raw docstring

javax.swing.tree.TreePath

TreePath represents an array of objects that uniquely identify the path to a node in a tree. The elements of the array are ordered with the root as the first element of the array. For example, a file on the file system is uniquely identified based on the array of parent directories and the name of the file. The path /tmp/foo/bar could be represented by a TreePath as new TreePath(new Object[] {"tmp", "foo", "bar"}).

TreePath is used extensively by JTree and related classes. For example, JTree represents the selection as an array of TreePaths. When used with JTree, the elements of the path are the objects returned from the TreeModel. When JTree is paired with DefaultTreeModel, the elements of the path are TreeNodes. The following example illustrates extracting the user object from the selection of a JTree:

DefaultMutableTreeNode root = ...; DefaultTreeModel model = new DefaultTreeModel(root); JTree tree = new JTree(model); ... TreePath selectedPath = tree.getSelectionPath(); DefaultMutableTreeNode selectedNode = ((DefaultMutableTreeNode)selectedPath.getLastPathComponent()). getUserObject(); Subclasses typically need override only getLastPathComponent, and getParentPath. As JTree internally creates TreePaths at various points, it's generally not useful to subclass TreePath and use with JTree.

While TreePath is serializable, a NotSerializableException is thrown if any elements of the path are not serializable.

For further information and examples of using tree paths, see How to Use Trees 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. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

TreePath represents an array of objects that uniquely
identify the path to a node in a tree. The elements of the array
are ordered with the root as the first element of the array. For
example, a file on the file system is uniquely identified based on
the array of parent directories and the name of the file. The path
/tmp/foo/bar could be represented by a TreePath as
new TreePath(new Object[] {"tmp", "foo", "bar"}).

TreePath is used extensively by JTree and related classes.
For example, JTree represents the selection as an array of
TreePaths. When used with JTree, the elements of the
path are the objects returned from the TreeModel. When JTree
is paired with DefaultTreeModel, the elements of the
path are TreeNodes. The following example illustrates extracting
the user object from the selection of a JTree:


  DefaultMutableTreeNode root = ...;
  DefaultTreeModel model = new DefaultTreeModel(root);
  JTree tree = new JTree(model);
  ...
  TreePath selectedPath = tree.getSelectionPath();
  DefaultMutableTreeNode selectedNode =
      ((DefaultMutableTreeNode)selectedPath.getLastPathComponent()).
      getUserObject();
Subclasses typically need override only getLastPathComponent, and getParentPath. As JTree
internally creates TreePaths at various points, it's
generally not useful to subclass TreePath and use with
JTree.

While TreePath is serializable, a NotSerializableException is thrown if any elements of the path are
not serializable.

For further information and examples of using tree paths,
see How to Use Trees
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.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.tree.TreeSelectionModel

This interface represents the current state of the selection for the tree component. For information and examples of using tree selection models, see How to Use Trees in The Java Tutorial.

The state of the tree selection is characterized by a set of TreePaths, and optionally a set of integers. The mapping from TreePath to integer is done by way of an instance of RowMapper. It is not necessary for a TreeSelectionModel to have a RowMapper to correctly operate, but without a RowMapper getSelectionRows will return null.

A TreeSelectionModel can be configured to allow only one path (SINGLE_TREE_SELECTION) a number of contiguous paths (CONTIGUOUS_TREE_SELECTION) or a number of discontiguous paths (DISCONTIGUOUS_TREE_SELECTION). A RowMapper is used to determine if TreePaths are contiguous. In the absence of a RowMapper CONTIGUOUS_TREE_SELECTION and DISCONTIGUOUS_TREE_SELECTION behave the same, that is they allow any number of paths to be contained in the TreeSelectionModel.

For a selection model of CONTIGUOUS_TREE_SELECTION any time the paths are changed (setSelectionPath, addSelectionPath ...) the TreePaths are again checked to make they are contiguous. A check of the TreePaths can also be forced by invoking resetRowSelection. How a set of discontiguous TreePaths is mapped to a contiguous set is left to implementors of this interface to enforce a particular policy.

Implementations should combine duplicate TreePaths that are added to the selection. For example, the following code

TreePath[] paths = new TreePath[] { treePath, treePath }; treeSelectionModel.setSelectionPaths(paths); should result in only one path being selected: treePath, and not two copies of treePath.

The lead TreePath is the last path that was added (or set). The lead row is then the row that corresponds to the TreePath as determined from the RowMapper.

This interface represents the current state of the selection for
the tree component.
For information and examples of using tree selection models,
see How to Use Trees
in The Java Tutorial.


The state of the tree selection is characterized by
a set of TreePaths, and optionally a set of integers. The mapping
from TreePath to integer is done by way of an instance of RowMapper.
It is not necessary for a TreeSelectionModel to have a RowMapper to
correctly operate, but without a RowMapper getSelectionRows
will return null.



A TreeSelectionModel can be configured to allow only one
path (SINGLE_TREE_SELECTION) a number of
contiguous paths (CONTIGUOUS_TREE_SELECTION) or a number of
discontiguous paths (DISCONTIGUOUS_TREE_SELECTION).
A RowMapper is used to determine if TreePaths are
contiguous.
In the absence of a RowMapper CONTIGUOUS_TREE_SELECTION and
DISCONTIGUOUS_TREE_SELECTION behave the same, that is they
allow any number of paths to be contained in the TreeSelectionModel.



For a selection model of CONTIGUOUS_TREE_SELECTION any
time the paths are changed (setSelectionPath,
addSelectionPath ...) the TreePaths are again checked to
make they are contiguous. A check of the TreePaths can also be forced
by invoking resetRowSelection. How a set of discontiguous
TreePaths is mapped to a contiguous set is left to implementors of
this interface to enforce a particular policy.



Implementations should combine duplicate TreePaths that are
added to the selection. For example, the following code


  TreePath[] paths = new TreePath[] { treePath, treePath };
  treeSelectionModel.setSelectionPaths(paths);
should result in only one path being selected:
treePath, and
not two copies of treePath.



The lead TreePath is the last path that was added (or set). The lead
row is then the row that corresponds to the TreePath as determined
from the RowMapper.
raw docstring

javax.swing.tree.VariableHeightLayoutCache

NOTE: This will become more open in a future release.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

NOTE: This will become more open in a future release.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.UIDefaults

A table of defaults for Swing components. Applications can set/get default values via the UIManager.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

A table of defaults for Swing components.  Applications can set/get
default values via the UIManager.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.UIDefaults$ActiveValue

This class enables one to store an entry in the defaults table that's constructed each time it's looked up with one of the getXXX(key) methods. Here's an example of an ActiveValue that constructs a DefaultListCellRenderer:

Object cellRendererActiveValue = new UIDefaults.ActiveValue() { public Object createValue(UIDefaults table) { return new DefaultListCellRenderer(); } };

uiDefaultsTable.put("MyRenderer", cellRendererActiveValue);

This class enables one to store an entry in the defaults
table that's constructed each time it's looked up with one of
the getXXX(key) methods. Here's an example of
an ActiveValue that constructs a
DefaultListCellRenderer:


 Object cellRendererActiveValue = new UIDefaults.ActiveValue() {
     public Object createValue(UIDefaults table) {
         return new DefaultListCellRenderer();
     }
 };

 uiDefaultsTable.put("MyRenderer", cellRendererActiveValue);
raw docstring

javax.swing.UIDefaults$LazyInputMap

LazyInputMap will create a InputMap in its createValue method. The bindings are passed in in the constructor. The bindings are an array with the even number entries being string KeyStrokes (eg "alt SPACE") and the odd number entries being the value to use in the InputMap (and the key in the ActionMap).

LazyInputMap will create a InputMap
in its createValue
method. The bindings are passed in in the constructor.
The bindings are an array with
the even number entries being string KeyStrokes
(eg "alt SPACE") and
the odd number entries being the value to use in the
InputMap (and the key in the ActionMap).
raw docstring

javax.swing.UIDefaults$LazyValue

This class enables one to store an entry in the defaults table that isn't constructed until the first time it's looked up with one of the getXXX(key) methods. Lazy values are useful for defaults that are expensive to construct or are seldom retrieved. The first time a LazyValue is retrieved its "real value" is computed by calling LazyValue.createValue() and the real value is used to replace the LazyValue in the UIDefaults table. Subsequent lookups for the same key return the real value. Here's an example of a LazyValue that constructs a Border:

Object borderLazyValue = new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { return new BorderFactory.createLoweredBevelBorder(); } };

uiDefaultsTable.put("MyBorder", borderLazyValue);

This class enables one to store an entry in the defaults
table that isn't constructed until the first time it's
looked up with one of the getXXX(key) methods.
Lazy values are useful for defaults that are expensive
to construct or are seldom retrieved.  The first time
a LazyValue is retrieved its "real value" is computed
by calling LazyValue.createValue() and the real
value is used to replace the LazyValue in the
UIDefaults
table.  Subsequent lookups for the same key return
the real value.  Here's an example of a LazyValue
that constructs a Border:


 Object borderLazyValue = new UIDefaults.LazyValue() {
     public Object createValue(UIDefaults table) {
         return new BorderFactory.createLoweredBevelBorder();
     }
 };

 uiDefaultsTable.put("MyBorder", borderLazyValue);
raw docstring

javax.swing.UIDefaults$ProxyLazyValue

This class provides an implementation of LazyValue which can be used to delay loading of the Class for the instance to be created. It also avoids creation of an anonymous inner class for the LazyValue subclass. Both of these improve performance at the time that a a Look and Feel is loaded, at the cost of a slight performance reduction the first time createValue is called (since Reflection APIs are used).

This class provides an implementation of LazyValue
which can be
used to delay loading of the Class for the instance to be created.
It also avoids creation of an anonymous inner class for the
LazyValue
subclass.  Both of these improve performance at the time that a
a Look and Feel is loaded, at the cost of a slight performance
reduction the first time createValue is called
(since Reflection APIs are used).
raw docstring

javax.swing.UIManager

UIManager manages the current look and feel, the set of available look and feels, PropertyChangeListeners that are notified when the look and feel changes, look and feel defaults, and convenience methods for obtaining various default values.

Specifying the look and feel

The look and feel can be specified in two distinct ways: by specifying the fully qualified name of the class for the look and feel, or by creating an instance of LookAndFeel and passing it to setLookAndFeel. The following example illustrates setting the look and feel to the system look and feel:

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); The following example illustrates setting the look and feel based on class name:

UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); Once the look and feel has been changed it is imperative to invoke updateUI on all JComponents. The method SwingUtilities.updateComponentTreeUI(java.awt.Component) makes it easy to apply updateUI to a containment hierarchy. Refer to it for details. The exact behavior of not invoking updateUI after changing the look and feel is unspecified. It is very possible to receive unexpected exceptions, painting problems, or worse.

Default look and feel

The class used for the default look and feel is chosen in the following manner:

If the system property swing.defaultlaf is non-null, use its value as the default look and feel class name. If the Properties file swing.properties exists and contains the key swing.defaultlaf, use its value as the default look and feel class name. The location that is checked for swing.properties may vary depending upon the implementation of the Java platform. Typically the swing.properties file is located in the lib subdirectory of the Java installation directory. Refer to the release notes of the implementation being used for further details. Otherwise use the cross platform look and feel.

Defaults

UIManager manages three sets of UIDefaults. In order, they are:

Developer defaults. With few exceptions Swing does not alter the developer defaults; these are intended to be modified and used by the developer. Look and feel defaults. The look and feel defaults are supplied by the look and feel at the time it is installed as the current look and feel (setLookAndFeel() is invoked). The look and feel defaults can be obtained using the getLookAndFeelDefaults() method. System defaults. The system defaults are provided by Swing.

Invoking any of the various get methods results in checking each of the defaults, in order, returning the first non-null value. For example, invoking UIManager.getString("Table.foreground") results in first checking developer defaults. If the developer defaults contain a value for "Table.foreground" it is returned, otherwise the look and feel defaults are checked, followed by the system defaults.

It's important to note that getDefaults returns a custom instance of UIDefaults with this resolution logic built into it. For example, UIManager.getDefaults().getString("Table.foreground") is equivalent to UIManager.getString("Table.foreground"). Both resolve using the algorithm just described. In many places the documentation uses the word defaults to refer to the custom instance of UIDefaults with the resolution logic as previously described.

When the look and feel is changed, UIManager alters only the look and feel defaults; the developer and system defaults are not altered by the UIManager in any way.

The set of defaults a particular look and feel supports is defined and documented by that look and feel. In addition, each look and feel, or ComponentUI provided by a look and feel, may access the defaults at different times in their life cycle. Some look and feels may aggressively look up defaults, so that changing a default may not have an effect after installing the look and feel. Other look and feels may lazily access defaults so that a change to the defaults may effect an existing look and feel. Finally, other look and feels might not configure themselves from the defaults table in any way. None-the-less it is usually the case that a look and feel expects certain defaults, so that in general a ComponentUI provided by one look and feel will not work with another look and feel.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

UIManager manages the current look and feel, the set of
available look and feels, PropertyChangeListeners that
are notified when the look and feel changes, look and feel defaults, and
convenience methods for obtaining various default values.

Specifying the look and feel

The look and feel can be specified in two distinct ways: by
specifying the fully qualified name of the class for the look and
feel, or by creating an instance of LookAndFeel and passing
it to setLookAndFeel. The following example illustrates
setting the look and feel to the system look and feel:


  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
The following example illustrates setting the look and feel based on
class name:


  UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
Once the look and feel has been changed it is imperative to invoke
updateUI on all JComponents. The method SwingUtilities.updateComponentTreeUI(java.awt.Component) makes it easy to apply updateUI to a containment hierarchy. Refer to it for
details. The exact behavior of not invoking updateUI after changing the look and feel is
unspecified. It is very possible to receive unexpected exceptions,
painting problems, or worse.

Default look and feel

The class used for the default look and feel is chosen in the following
manner:

  If the system property swing.defaultlaf is
      non-null, use its value as the default look and feel class
      name.
  If the Properties file swing.properties
      exists and contains the key swing.defaultlaf,
      use its value as the default look and feel class name. The location
      that is checked for swing.properties may vary depending
      upon the implementation of the Java platform. Typically the
      swing.properties file is located in the lib
      subdirectory of the Java installation directory.
      Refer to the release notes of the implementation being used for
      further details.
  Otherwise use the cross platform look and feel.


Defaults

UIManager manages three sets of UIDefaults. In order, they
are:

  Developer defaults. With few exceptions Swing does not
      alter the developer defaults; these are intended to be modified
      and used by the developer.
  Look and feel defaults. The look and feel defaults are
      supplied by the look and feel at the time it is installed as the
      current look and feel (setLookAndFeel() is invoked). The
      look and feel defaults can be obtained using the getLookAndFeelDefaults() method.
  System defaults. The system defaults are provided by Swing.

Invoking any of the various get methods
results in checking each of the defaults, in order, returning
the first non-null value. For example, invoking
UIManager.getString("Table.foreground") results in first
checking developer defaults. If the developer defaults contain
a value for "Table.foreground" it is returned, otherwise
the look and feel defaults are checked, followed by the system defaults.

It's important to note that getDefaults returns a custom
instance of UIDefaults with this resolution logic built into it.
For example, UIManager.getDefaults().getString("Table.foreground")
is equivalent to UIManager.getString("Table.foreground"). Both
resolve using the algorithm just described. In many places the
documentation uses the word defaults to refer to the custom instance
of UIDefaults with the resolution logic as previously described.

When the look and feel is changed, UIManager alters only the
look and feel defaults; the developer and system defaults are not
altered by the UIManager in any way.

The set of defaults a particular look and feel supports is defined
and documented by that look and feel. In addition, each look and
feel, or ComponentUI provided by a look and feel, may
access the defaults at different times in their life cycle. Some
look and feels may aggressively look up defaults, so that changing a
default may not have an effect after installing the look and feel.
Other look and feels may lazily access defaults so that a change to
the defaults may effect an existing look and feel. Finally, other look
and feels might not configure themselves from the defaults table in
any way. None-the-less it is usually the case that a look and feel
expects certain defaults, so that in general
a ComponentUI provided by one look and feel will not
work with another look and feel.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.UIManager$LookAndFeelInfo

Provides a little information about an installed LookAndFeel for the sake of configuring a menu or for initial application set up.

Provides a little information about an installed
LookAndFeel for the sake of configuring a menu or
for initial application set up.
raw docstring

javax.swing.undo.AbstractUndoableEdit

An abstract implementation of UndoableEdit, implementing simple responses to all boolean methods in that interface.

An abstract implementation of UndoableEdit,
implementing simple responses to all boolean methods in
that interface.
raw docstring

javax.swing.undo.CannotRedoException

Thrown when an UndoableEdit is told to redo() and can't.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Thrown when an UndoableEdit is told to redo() and can't.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.undo.CannotUndoException

Thrown when an UndoableEdit is told to undo() and can't.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

Thrown when an UndoableEdit is told to undo() and can't.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.undo.CompoundEdit

A concrete subclass of AbstractUndoableEdit, used to assemble little UndoableEdits into great big ones.

A concrete subclass of AbstractUndoableEdit, used to assemble little
UndoableEdits into great big ones.
raw docstring

javax.swing.undo.core

No vars found in this namespace.

javax.swing.undo.StateEdit

StateEdit is a general edit for objects that change state. Objects being edited must conform to the StateEditable interface.

This edit class works by asking an object to store it's state in Hashtables before and after editing occurs. Upon undo or redo the object is told to restore it's state from these Hashtables.

A state edit is used as follows:

 // Create the edit during the "before" state of the object
 StateEdit newEdit = new StateEdit(myObject);
 // Modify the object
 myObject.someStateModifyingMethod();
 // "end" the edit when you are done modifying the object
 newEdit.end();

Note that when a StateEdit ends, it removes redundant state from the Hashtables - A state Hashtable is not guaranteed to contain all keys/values placed into it when the state is stored!

StateEdit is a general edit for objects that change state.
Objects being edited must conform to the StateEditable interface.

This edit class works by asking an object to store it's state in
Hashtables before and after editing occurs.  Upon undo or redo the
object is told to restore it's state from these Hashtables.

A state edit is used as follows:


     // Create the edit during the "before" state of the object
     StateEdit newEdit = new StateEdit(myObject);
     // Modify the object
     myObject.someStateModifyingMethod();
     // "end" the edit when you are done modifying the object
     newEdit.end();

Note that when a StateEdit ends, it removes redundant state from
the Hashtables - A state Hashtable is not guaranteed to contain all
keys/values placed into it when the state is stored!
raw docstring

javax.swing.undo.StateEditable

StateEditable defines the interface for objects that can have their state undone/redone by a StateEdit.

StateEditable defines the interface for objects that can have
their state undone/redone by a StateEdit.
raw docstring

javax.swing.undo.UndoableEdit

An UndoableEdit represents an edit. The edit may be undone, or if already undone the edit may be redone.

UndoableEdit is designed to be used with the UndoManager. As UndoableEdits are generated by an UndoableEditListener they are typically added to the UndoManager. When an UndoableEdit is added to an UndoManager the following occurs (assuming end has not been called on the UndoManager):

If the UndoManager contains edits it will call addEdit on the current edit passing in the new edit as the argument. If addEdit returns true the new edit is assumed to have been incorporated into the current edit and the new edit will not be added to the list of current edits. Edits can use addEdit as a way for smaller edits to be incorporated into a larger edit and treated as a single edit. If addEdit returns false replaceEdit is called on the new edit with the current edit passed in as the argument. This is the inverse of addEdit — if the new edit returns true from replaceEdit, the new edit replaces the current edit.

The UndoManager makes use of isSignificant to determine how many edits should be undone or redone. The UndoManager will undo or redo all insignificant edits (isSignificant returns false) between the current edit and the last or next significant edit. addEdit and replaceEdit can be used to treat multiple edits as a single edit, returning false from isSignificant allows for treating can be used to have many smaller edits undone or redone at once. Similar functionality can also be done using the addEdit method.

An UndoableEdit represents an edit.  The edit may
be undone, or if already undone the edit may be redone.

UndoableEdit is designed to be used with the
UndoManager.  As UndoableEdits are generated
by an UndoableEditListener they are typically added to
the UndoManager.  When an UndoableEdit
is added to an UndoManager the following occurs (assuming
end has not been called on the UndoManager):

If the UndoManager contains edits it will call
    addEdit on the current edit passing in the new edit
    as the argument.  If addEdit returns true the
    new edit is assumed to have been incorporated into the current edit and
    the new edit will not be added to the list of current edits.
    Edits can use addEdit as a way for smaller edits to
    be incorporated into a larger edit and treated as a single edit.
If addEdit returns false replaceEdit
    is called on the new edit with the current edit passed in as the
    argument. This is the inverse of addEdit —
    if the new edit returns true from replaceEdit, the new
    edit replaces the current edit.

The UndoManager makes use of
isSignificant to determine how many edits should be
undone or redone.  The UndoManager will undo or redo
all insignificant edits (isSignificant returns false)
between the current edit and the last or
next significant edit.   addEdit and
replaceEdit can be used to treat multiple edits as
a single edit, returning false from isSignificant
allows for treating can be used to
have many smaller edits undone or redone at once.  Similar functionality
can also be done using the addEdit method.
raw docstring

javax.swing.undo.UndoManager

UndoManager manages a list of UndoableEdits, providing a way to undo or redo the appropriate edits. There are two ways to add edits to an UndoManager. Add the edit directly using the addEdit method, or add the UndoManager to a bean that supports UndoableEditListener. The following examples creates an UndoManager and adds it as an UndoableEditListener to a JTextField:

UndoManager undoManager = new UndoManager(); JTextField tf = ...; tf.getDocument().addUndoableEditListener(undoManager);

UndoManager maintains an ordered list of edits and the index of the next edit in that list. The index of the next edit is either the size of the current list of edits, or if undo has been invoked it corresponds to the index of the last significant edit that was undone. When undo is invoked all edits from the index of the next edit to the last significant edit are undone, in reverse order. For example, consider an UndoManager consisting of the following edits: A b c D. Edits with a upper-case letter in bold are significant, those in lower-case and italicized are insignificant.

Figure 1

As shown in figure 1, if D was just added, the index of the next edit will be 4. Invoking undo results in invoking undo on D and setting the index of the next edit to 3 (edit c), as shown in the following figure.

Figure 2

The last significant edit is A, so that invoking undo again invokes undo on c, b, and A, in that order, setting the index of the next edit to 0, as shown in the following figure.

Figure 3

Invoking redo results in invoking redo on all edits between the index of the next edit and the next significant edit (or the end of the list). Continuing with the previous example if redo were invoked, redo would in turn be invoked on A, b and c. In addition the index of the next edit is set to 3 (as shown in figure 2).

Adding an edit to an UndoManager results in removing all edits from the index of the next edit to the end of the list. Continuing with the previous example, if a new edit, e, is added the edit D is removed from the list (after having die invoked on it). If c is not incorporated by the next edit (c.addEdit(e) returns true), or replaced by it (e.replaceEdit(c) returns true), the new edit is added after c, as shown in the following figure.

Figure 4

Once end has been invoked on an UndoManager the superclass behavior is used for all UndoableEdit methods. Refer to CompoundEdit for more details on its behavior.

Unlike the rest of Swing, this class is thread safe.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

UndoManager manages a list of UndoableEdits,
providing a way to undo or redo the appropriate edits.  There are
two ways to add edits to an UndoManager.  Add the edit
directly using the addEdit method, or add the
UndoManager to a bean that supports
UndoableEditListener.  The following examples creates
an UndoManager and adds it as an
UndoableEditListener to a JTextField:


  UndoManager undoManager = new UndoManager();
  JTextField tf = ...;
  tf.getDocument().addUndoableEditListener(undoManager);

UndoManager maintains an ordered list of edits and the
index of the next edit in that list. The index of the next edit is
either the size of the current list of edits, or if
undo has been invoked it corresponds to the index
of the last significant edit that was undone. When
undo is invoked all edits from the index of the next
edit to the last significant edit are undone, in reverse order.
For example, consider an UndoManager consisting of the
following edits: A b c D.  Edits with a
upper-case letter in bold are significant, those in lower-case
and italicized are insignificant.





Figure 1


As shown in figure 1, if D was just added, the
index of the next edit will be 4. Invoking undo
results in invoking undo on D and setting the
index of the next edit to 3 (edit c), as shown in the following
figure.





Figure 2


The last significant edit is A, so that invoking
undo again invokes undo on c,
b, and A, in that order, setting the index of the
next edit to 0, as shown in the following figure.





Figure 3


Invoking redo results in invoking redo on
all edits between the index of the next edit and the next
significant edit (or the end of the list).  Continuing with the previous
example if redo were invoked, redo would in
turn be invoked on A, b and c.  In addition
the index of the next edit is set to 3 (as shown in figure 2).

Adding an edit to an UndoManager results in
removing all edits from the index of the next edit to the end of
the list.  Continuing with the previous example, if a new edit,
e, is added the edit D is removed from the list
(after having die invoked on it).  If c is not
incorporated by the next edit
(c.addEdit(e) returns true), or replaced
by it (e.replaceEdit(c) returns true),
the new edit is added after c, as shown in the following
figure.





Figure 4


Once end has been invoked on an UndoManager
the superclass behavior is used for all UndoableEdit
methods.  Refer to CompoundEdit for more details on its
behavior.

Unlike the rest of Swing, this class is thread safe.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.UnsupportedLookAndFeelException

An exception that indicates the requested look & feel management classes are not present on the user's system.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

An exception that indicates the requested look & feel
management classes are not present on the user's system.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.ViewportLayout

The default layout manager for JViewport. ViewportLayout defines a policy for layout that should be useful for most applications. The viewport makes its view the same size as the viewport, however it will not make the view smaller than its minimum size. As the viewport grows the view is kept bottom justified until the entire view is visible, subsequently the view is kept top justified.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans package. Please see XMLEncoder.

The default layout manager for JViewport.
ViewportLayout defines
a policy for layout that should be useful for most applications.
The viewport makes its view the same size as the viewport,
however it will not make the view smaller than its minimum size.
As the viewport grows the view is kept bottom justified until
the entire view is visible, subsequently the view is kept top
justified.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing.  As of 1.4, support for long term storage
of all JavaBeans™
has been added to the java.beans package.
Please see XMLEncoder.
raw docstring

javax.swing.WindowConstants

Constants used to control the window-closing operation. The setDefaultCloseOperation and getDefaultCloseOperation methods provided by JFrame, JInternalFrame, and JDialog use these constants. For examples of setting the default window-closing operation, see Responding to Window-Closing Events, a section in The Java Tutorial.

Constants used to control the window-closing operation.
The setDefaultCloseOperation and
getDefaultCloseOperation methods
provided by JFrame,
JInternalFrame, and
JDialog
use these constants.
For examples of setting the default window-closing operation, see
Responding to Window-Closing Events,
a section in The Java Tutorial.
raw docstring

No vars found in this namespace.

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close