This large package contains the most important classes and interfaces of Swing. Swing is a core part of Java 1.2 and is also available as a standard extension to Java 1.1. The GUI component classes are at the heart of Swing. These classes have names that begin with the letter J. Figure 23-1 shows the hierarchy of Swing components in javax.swing. Note that this diagram does not show the fact that all the Swing components implement javax.accessibility.Accessible; see the individual class synopses for this information.

Most Swing components rely on a model object to hold their state information. Various interfaces define the methods that these state objects must implement, and various abstract and concrete classes implement these interfaces. These model interfaces and classes are recognizable by the word "Model" in their names. Figure 23-2 shows the model objects and layout managers in javax.swing.
Classes with the word "Manager" in their names typically manage some important part of the Swing user-interface or application environment. Other important classes and interfaces defined by this package include: Action, Icon, KeyStroke, Timer, and SwingUtilities. Figure 23-3 shows the rest of the classes and interfaces in javax.swing.
All Swing components are accessible, which means that they implement the javax.accessiblity.Accessible interface and define getAccessibleContext() methods. This method returns a javax.accessibility.AccessibleContext object that provides support to accessibility tools, such as screen readers for the vision impaired. Each accessible component has its own specific subclass of AccessibleContext, which is typically defined as a protected inner class of the component. These AccessibleContext inner classes have been omitted from this chapter and from Figure 23-1 because they contain little useful information and they detract from other, more important classes. Practically everything you need to know about an AccessibleContext subclass can be found in the single-line inner class synopsis that appears in the containing class, the accessible flag of the containing class, and in Chapter 22, "The javax.accessibility Package".
See Chapter 2, "Swing and AWTArchitecture", for an overview of GUI programming in Java, and see Chapter 3, "Swing Programming Topics", for detailed explanations of many important Swing components and capabilities.


| AbstractAction | Java 1.2 | |
|
|
||
| javax.swing | cloneable serializable | |
This class implements all the methods of the Action interface except for the crucial actionPerformed() method that provides the substance of the action. Subclassing AbstractAction is one of the easiest ways to define Action objects for your application. Note the one- and two-argument constructors. These constructors automatically define name and icon attributes for the action and are simpler than using putValue().
| public abstract class AbstractAction implements Action, Cloneable, Serializable { | ||
| // | Public Constructors | |
| public AbstractAction (); | ||
| public AbstractAction (String name); | ||
| public AbstractAction (String name, Icon icon); | ||
| // | Event Registration Methods (by event name) | |
| public void addPropertyChangeListener (java.beans.PropertyChangeListener listener); | Implements:Action synchronized | |
| public void removePropertyChangeListener (java.beans.PropertyChangeListener listener); | Implements:Action synchronized | |
| // | Methods Implementing Action | |
| public void addPropertyChangeListener (java.beans.PropertyChangeListener listener); | synchronized | |
| public Object getValue (String key); | ||
| public boolean isEnabled (); | ||
| public void putValue (String key, Object newValue); | synchronized | |
| public void removePropertyChangeListener (java.beans.PropertyChangeListener listener); | synchronized | |
| public void setEnabled (boolean newValue); | synchronized | |
| // | Methods Implementing ActionListener | |
| public abstract void actionPerformed (java.awt.event.ActionEvent e); | ||
| // | Protected Methods Overriding Object | |
| protected Object clone () throws CloneNotSupportedException; | ||
| // | Protected Instance Methods | |
| protected void firePropertyChange (String propertyName, Object oldValue, Object newValue); | ||
| // | Protected Instance Fields | |
| protected javax.swing.event.SwingPropertyChangeSupport changeSupport ; | ||
| protected boolean enabled ; | ||
| } | ||
Hierarchy: Object-->AbstractAction(Action(java.awt.event.ActionListener(java.util.EventListener)),Cloneable,Serializable)
Subclasses: javax.swing.text.TextAction
| AbstractButton | Java 1.2 | |
|
|
||
| javax.swing | serializable swing component | |
This class serves as the superclass for Swing components with buttonlike behavior. Because it is a general-purpose class, it defines a large number of properties. Like Swing labels, Swing buttons can display text and/or an icon, and several properties specify the relative positioning of the text and icon. (See JLabel for details on these positioning properties.) Swing buttons can display different icons when in different states. In addition to the default icon, AbstractButton has properties that specify icons to be displayed when the button is pressed, selected, disabled, disabled and selected, rolled over, and rolled over and selected. If the rolloverIcon property is specified and if the rolloverEnabled property is true, the rolloverIcon is displayed when the mouse is over the button.
By default, an AbstractButton displays a single line of text in a single font. However, as of Swing 1.1.1 and Java 1.2.2, if the text property begins with "<html>", the button text is formatted as HTML and may contain multiple fonts and multiple lines.
A Swing button may be enabled and disabled with setEnabled(). Disabled buttons are typically displayed with grayed-out graphics, although some other disabled icon can also be specified. A mnemonic can be specified with setMnemonic(). This causes the mnemonic character to be underlined in the button's text and allows the button to be operated via the keyboard.
Swing buttons generate three types of events. A java.awt.event.ActionEvent is generated when any button is pushed. A java.awt.event.ItemEvent is generated when a toggle-type button is selected or deselected. And a javax.swing.event.ChangeEvent is generated when the button's internal state changes--for example, when the mouse pointer enters the button or when the user arms the button by pressing the mouse button.
| public abstract class AbstractButton extends JComponent implements java.awt.ItemSelectable, SwingConstants { | ||
| // | Public Constructors | |
| public AbstractButton (); | ||
| // | Public Constants | |
| public static final String BORDER_PAINTED_CHANGED_PROPERTY ; | ="borderPainted" | |
| public static final String CONTENT_AREA_FILLED_CHANGED_PROPERTY ; | ="contentAreaFilled" | |
| public static final String DISABLED_ICON_CHANGED_PROPERTY ; | ="disabledIcon" | |
| public static final String DISABLED_SELECTED_ICON_CHANGED_PROPERTY ; | ="disabledSelectedIcon" | |
| public static final String FOCUS_PAINTED_CHANGED_PROPERTY ; | ="focusPainted" | |
| public static final String HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY ; | ="horizontalAlignment" | |
| public static final String HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY ; | ="horizontalTextPosition" | |
| public static final String ICON_CHANGED_PROPERTY ; | ="icon" | |
| public static final String MARGIN_CHANGED_PROPERTY ; | ="margin" | |
| public static final String MNEMONIC_CHANGED_PROPERTY ; | ="mnemonic" | |
| public static final String MODEL_CHANGED_PROPERTY ; | ="model" | |
| public static final String PRESSED_ICON_CHANGED_PROPERTY ; | ="pressedIcon" | |
| public static final String ROLLOVER_ENABLED_CHANGED_PROPERTY ; | ="rolloverEnabled" | |
| public static final String ROLLOVER_ICON_CHANGED_PROPERTY ; | ="rolloverIcon" | |
| public static final String ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY ; | ="rolloverSelectedIcon" | |
| public static final String SELECTED_ICON_CHANGED_PROPERTY ; | ="selectedIcon" | |
| public static final String TEXT_CHANGED_PROPERTY ; | ="text" | |
| public static final String VERTICAL_ALIGNMENT_CHANGED_PROPERTY ; | ="verticalAlignment" | |
| public static final String VERTICAL_TEXT_POSITION_CHANGED_PROPERTY ; | ="verticalTextPosition" | |
| // | Inner Classes | |
| ; | ||
| ; | ||
| // | Event Registration Methods (by event name) | |
| public void addActionListener (java.awt.event.ActionListener l); | ||
| public void removeActionListener (java.awt.event.ActionListener l); | ||
| public void addChangeListener (javax.swing.event.ChangeListener l); | ||
| public void removeChangeListener (javax.swing.event.ChangeListener l); | ||
| public void addItemListener (java.awt.event.ItemListener l); | Implements:ItemSelectable | |
| public void removeItemListener (java.awt.event.ItemListener l); | Implements:ItemSelectable | |
| // | Property Accessor Methods (by property name) | |
| public String getActionCommand (); | ||
| public void setActionCommand (String actionCommand); | ||
| public boolean isBorderPainted (); | ||
| public void setBorderPainted (boolean b); | bound | |
| public boolean isContentAreaFilled (); | ||
| public void setContentAreaFilled (boolean b); | bound | |
| public Icon getDisabledIcon (); | ||
| public void setDisabledIcon (Icon disabledIcon); | bound | |
| public Icon getDisabledSelectedIcon (); | ||
| public void setDisabledSelectedIcon (Icon disabledSelectedIcon); | ||
| public boolean isFocusPainted (); | ||
| public void setFocusPainted (boolean b); | bound | |
| public int getHorizontalAlignment (); | ||
| public void setHorizontalAlignment (int alignment); | bound | |
| public int getHorizontalTextPosition (); | ||
| public void setHorizontalTextPosition (int textPosition); | bound | |
| public Icon getIcon (); | ||
| public void setIcon (Icon defaultIcon); | bound | |
| public java.awt.Insets getMargin (); | ||
| public void setMargin (java.awt.Insets m); | bound | |
| public int getMnemonic (); | ||
| public void setMnemonic (int mnemonic); | bound | |
| public void setMnemonic (char mnemonic); | ||
| public ButtonModel getModel (); | ||
| public void setModel (ButtonModel newModel); | bound | |
| public Icon getPressedIcon (); | ||
| public void setPressedIcon (Icon pressedIcon); | bound | |
| public boolean isRolloverEnabled (); | ||
| public void setRolloverEnabled (boolean b); | bound | |
| public Icon getRolloverIcon (); | ||
| public void setRolloverIcon (Icon rolloverIcon); | bound | |
| public Icon getRolloverSelectedIcon (); | ||
| public void setRolloverSelectedIcon (Icon rolloverSelectedIcon); | bound | |
| public boolean isSelected (); | ||
| public void setSelected (boolean b); | ||
| public Icon getSelectedIcon (); | ||
| public void setSelectedIcon (Icon selectedIcon); | bound | |
| public Object[ ] getSelectedObjects (); | Implements:ItemSelectable synchronized | |
| public String getText (); | ||
| public void setText (String text); | bound preferred | |
| public javax.swing.plaf.ButtonUI getUI (); | ||
| public void setUI (javax.swing.plaf.ButtonUI ui); | ||
| public int getVerticalAlignment (); | ||
| public void setVerticalAlignment (int alignment); | bound | |
| public int getVerticalTextPosition (); | ||
| public void setVerticalTextPosition (int textPosition); | bound | |
| // | Public Instance Methods | |
| public void doClick (); | ||
| public void doClick (int pressTime); | ||
| // | Methods Implementing ItemSelectable | |
| public void addItemListener (java.awt.event.ItemListener l); | ||
| public Object[ ] getSelectedObjects (); | synchronized | |
| public void removeItemListener (java.awt.event.ItemListener l); | ||
| // | Public Methods Overriding JComponent | |
| public void setEnabled (boolean b); | ||
| public void updateUI (); | empty | |
| // | Protected Methods Overriding JComponent | |
| protected void paintBorder (java.awt.Graphics g); | ||
| protected String paramString (); | ||
| // | Protected Instance Methods | |
| protected int checkHorizontalKey (int key, String exception); | ||
| protected int checkVerticalKey (int key, String exception); | ||
| protected java.awt.event.ActionListener createActionListener (); | ||
| protected javax.swing.event.ChangeListener createChangeListener (); | ||
| protected java.awt.event.ItemListener createItemListener (); | ||
| protected void fireActionPerformed (java.awt.event.ActionEvent event); | ||
| protected void fireItemStateChanged (java.awt.event.ItemEvent event); | ||
| protected void fireStateChanged (); | ||
| protected void init (String text, Icon icon); | ||
| // | Protected Instance Fields | |
| protected java.awt.event.ActionListener actionListener ; | ||
| protected transient javax.swing.event.ChangeEvent changeEvent ; | ||
| protected javax.swing.event.ChangeListener changeListener ; | ||
| protected java.awt.event.ItemListener itemListener ; | ||
| protected ButtonModel model ; | ||
| // | Deprecated Public Methods | |
| # | public String getLabel (); | |
| # | public void setLabel (String label); | bound |
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->AbstractButton(java.awt.ItemSelectable,SwingConstants)
Subclasses: JButton, JMenuItem, JToggleButton
Passed To: ButtonGroup.{add(), remove()}
| AbstractButton.ButtonChangeListener | Java 1.2 | |
|
|
||
| javax.swing | serializable | |
This protected inner class is a simple Serializable implementation of javax.swing. event.ChangeListener that AbstractButton uses internally to receive change notifications from its ButtonModel. Application-level code never needs to use this class.
| protected class AbstractButton.ButtonChangeListener implements javax.swing.event.ChangeListener, Serializable { | ||
| // | No Constructor | |
| // | Methods Implementing ChangeListener | |
| public void stateChanged (javax.swing.event.ChangeEvent e); | ||
| } | ||
| AbstractListModel | Java 1.2 | |
|
|
||
| javax.swing | serializable model | |
This abstract class provides a partial implementation of the ListModel interface. Subclassing AbstractListModel is usually easier than implementing ListModel from scratch. Note, however, that the DefaultListModel class is a usually an adequate ListModel implementation, so you shouldn't need to subclass AbstractListModel very often. Furthermore, the JList component provides convenience methods that often make it unnecessary to work with any kind of ListModel at all.
| public abstract class AbstractListModel implements ListModel, Serializable { | ||
| // | Public Constructors | |
| public AbstractListModel (); | ||
| // | Event Registration Methods (by event name) | |
| public void addListDataListener (javax.swing.event.ListDataListener l); | Implements:ListModel | |
| public void removeListDataListener (javax.swing.event.ListDataListener l); | Implements:ListModel | |
| // | Methods Implementing ListModel | |
| public void addListDataListener (javax.swing.event.ListDataListener l); | ||
| public abstract Object getElementAt (int index); | ||
| public abstract int getSize (); | ||
| public void removeListDataListener (javax.swing.event.ListDataListener l); | ||
| // | Protected Instance Methods | |
| protected void fireContentsChanged (Object source, int index0, int index1); | ||
| protected void fireIntervalAdded (Object source, int index0, int index1); | ||
| protected void fireIntervalRemoved (Object source, int index0, int index1); | ||
| // | Protected Instance Fields | |
| protected javax.swing.event.EventListenerList listenerList ; | ||
| } | ||
Hierarchy: Object-->AbstractListModel(ListModel,Serializable)
Subclasses: DefaultComboBoxModel, DefaultListModel
| Action | Java 1.2 | |
|
|
||
| javax.swing | event listener | |
An action is a single piece of application functionality, such as saving a file or printing a document. The actions performed by an application may be made available to the user in several different ways: in a pulldown or popup menu, in a toolbar, and from a keyboard binding, for example.
The Action interface extends java.awt.event.ActionListener and adds the ability to enable or disable the action. If an editor contains an empty document, its print action probably should not be enabled, for example. setEnabled() specifies whether the action is enabled. When an action is enabled or disabled, this change is broadcast by a java.beans.PropertyChangeEvent.
The Action interface also defines methods that associate attributes with an action. The putValue() method maps an arbitrary attribute name to an arbitrary attribute value. The getValue() method queries an attribute value. The constants defined by the Action interface specify predefined names for commonly used attributes. NAME and SMALL_ICON are the most commonly used. Finally, the actionPerformed() method, inherited from ActionListener, is responsible for performing the action.
JMenu, JPopupMenu, and JToolBar define methods that allow Action objects to be added to them. These methods query the action for its name and an icon that represents the action and use this information to present the action to the user. If the action is enabled, the component allows the user to invoke it. The JTextComponent and Keymap classes from the javax.swing.text package additionally provide techniques for mapping keystrokes to Action objects.
AbstractAction provides a useful starting point for defining your own Action classes.
| public abstract interface Action extends java.awt.event.ActionListener { | ||
| // | Public Constants | |
| public static final String DEFAULT ; | ="Default" | |
| public static final String LONG_DESCRIPTION ; | ="LongDescription" | |
| public static final String NAME ; | ="Name" | |
| public static final String SHORT_DESCRIPTION ; | ="ShortDescription" | |
| public static final String SMALL_ICON ; | ="SmallIcon" | |
| // | Event Registration Methods (by event name) | |
| public abstract void addPropertyChangeListener (java.beans.PropertyChangeListener listener); | ||
| public abstract void removePropertyChangeListener (java.beans.PropertyChangeListener listener); | ||
| // | Public Instance Methods | |
| public abstract Object getValue (String key); | ||
| public abstract boolean isEnabled (); | ||
| public abstract void putValue (String key, Object value); | ||
| public abstract void setEnabled (boolean b); | ||
| } | ||
Hierarchy: (Action(java.awt.event.ActionListener(java.util.EventListener)))
Implementations: AbstractAction
Passed To: JMenu.{add(), insert()}, JPopupMenu.{add(), insert()}, JToolBar.add(), javax.swing.text.JTextComponent.loadKeymap(), javax.swing.text.Keymap.{addActionForKeyStroke(), getKeyStrokesForAction(), setDefaultAction()}, javax.swing.text.TextAction.augmentList()
Returned By: JTextField.getActions(), javax.swing.text.DefaultEditorKit.getActions(), javax.swing.text.EditorKit.getActions(), javax.swing.text.JTextComponent.getActions(), javax.swing.text.Keymap.{getAction(), getBoundActions(), getDefaultAction()}, javax.swing.text.StyledEditorKit.getActions(), javax.swing.text.TextAction.augmentList(), javax.swing.text.html.HTMLEditorKit.getActions()
| BorderFactory | Java 1.2 | |
|
|
||
| javax.swing | ||
The static methods of this class return various types of Border objects. These methods may return previously created shared objects, making their use more memory-efficient than creating unshared Border objects with the new operator. See the various classes of the javax.swing.border package for more information on the types of borders supported by Swing.
| public class BorderFactory { | ||
| // | No Constructor | |
| // | Public Class Methods | |
| public static javax.swing.border.Border createBevelBorder (int type); | ||
| public static javax.swing.border.Border createBevelBorder (int type, java.awt.Color highlight, java.awt.Color shadow); | ||
| public static javax.swing.border.Border createBevelBorder (int type, java.awt.Color highlightOuter, java.awt.Color highlightInner, java.awt.Color shadowOuter, java.awt.Color shadowInner); | ||
| public static javax.swing.border.CompoundBorder createCompoundBorder (); | ||
| public static javax.swing.border.CompoundBorder createCompoundBorder (javax.swing.border.Border outsideBorder, javax.swing.border.Border insideBorder); | ||
| public static javax.swing.border.Border createEmptyBorder (); | ||
| public static javax.swing.border.Border createEmptyBorder (int top, int left, int bottom, int right); | ||
| public static javax.swing.border.Border createEtchedBorder (); | ||
| public static javax.swing.border.Border createEtchedBorder (java.awt.Color highlight, java.awt.Color shadow); | ||
| public static javax.swing.border.Border createLineBorder (java.awt.Color color); | ||
| public static javax.swing.border.Border createLineBorder (java.awt.Color color, int thickness); | ||
| public static javax.swing.border.Border createLoweredBevelBorder (); | ||
| public static javax.swing.border.MatteBorder createMatteBorder (int top, int left, int bottom, int right, Icon tileIcon); | ||
| public static javax.swing.border.MatteBorder createMatteBorder (int top, int left, int bottom, int right, java.awt.Color color); | ||
| public static javax.swing.border.Border createRaisedBevelBorder (); | ||
| public static javax.swing.border.TitledBorder createTitledBorder (javax.swing.border.Border border); | ||
| public static javax.swing.border.TitledBorder createTitledBorder (String title); | ||
| public static javax.swing.border.TitledBorder createTitledBorder (javax.swing.border.Border border, String title); | ||
| public static javax.swing.border.TitledBorder createTitledBorder (javax.swing.border.Border border, String title, int titleJustification, int titlePosition); | ||
| public static javax.swing.border.TitledBorder createTitledBorder (javax.swing.border.Border border, String title, int titleJustification, int titlePosition, java.awt.Font titleFont); | ||
| public static javax.swing.border.TitledBorder createTitledBorder (javax.swing.border.Border border, String title, int titleJustification, int titlePosition, java.awt.Font titleFont, java.awt.Color titleColor); | ||
| } | ||
| BoundedRangeModel | Java 1.2 | |
|
|
||
| javax.swing | model | |
This interface defines the data model used by the JScrollBar, JSlider, and JProgressBar components. The model is defined by four integer properties that obey the following relationship:
minimum <= value <= value+extent <= maximum
The value property specifies the value currently displayed by the component. It must be between the values specified by the minimum and maximum properties. The extent property specifies the amount of data displayed. For JScrollBar components, this property specifies the size of the scrollbar thumb, or knob. Note the convenience method setRangeProperties() that sets all properties of the model at once.
When any value changes, interested listeners are notified with a javax.swing.event.ChangeEvent. One additional property defined by this interface is valueIsAdjusting. If this property is true, it means that a series of rapid property changes (such as those caused when the user drags the scrollbar) is in progress. This property is false for the last change in the series, so listeners can therefore choose to ignore transient changes that have this property set to true.
DefaultBoundedRangeModel is an implementation of this interface appropriate for most uses.
| public abstract interface BoundedRangeModel { | ||
| // | Event Registration Methods (by event name) | |
| public abstract void addChangeListener (javax.swing.event.ChangeListener x); | ||
| public abstract void removeChangeListener (javax.swing.event.ChangeListener x); | ||
| // | Property Accessor Methods (by property name) | |
| public abstract int getExtent (); | ||
| public abstract void setExtent (int newExtent); | ||
| public abstract int getMaximum (); | ||
| public abstract void setMaximum (int newMaximum); | ||
| public abstract int getMinimum (); | ||
| public abstract void setMinimum (int newMinimum); | ||
| public abstract int getValue (); | ||
| public abstract void setValue (int newValue); | ||
| public abstract boolean getValueIsAdjusting (); | ||
| public abstract void setValueIsAdjusting (boolean b); | ||
| // | Public Instance Methods | |
| public abstract void setRangeProperties (int value, int extent, int min, int max, boolean adjusting); | ||
| } | ||
Implementations: DefaultBoundedRangeModel
Passed To: JProgressBar.{JProgressBar(), setModel()}, JScrollBar.setModel(), JSlider.{JSlider(), setModel()}
Returned By: JProgressBar.getModel(), JScrollBar.getModel(), JSlider.getModel(), JTextField.getHorizontalVisibility()
Type Of: JProgressBar.model, JScrollBar.model, JSlider.sliderModel
| Box | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This class is a container that uses the BoxLayout layout manager to arrange its children in a row or a column. Pass one of the constants BoxLayout.X_AXIS or BoxLayout.Y_AXIS to the constructor to create a horizontal or vertical box or use the static methods createHorizontalBox() and createVerticalBox(). A horizontal box attempts to lay out its children from left to right, one next to the other, at their preferred widths and tries to make each child as tall as the tallest child. A vertical box does the opposite: it lays out its children from top to bottom, trying both to maintain the preferred height of each child and to make all children as wide as the widest child.
The arrangement of children in a Box is often improved with the use of struts and glue: invisible components that exist only to improve the appearance of a layout. A horizontal strut has 0 height and has a specified value as its minimum, preferred, and maximum width. A vertical strut has 0 width and a fixed height. Struts are useful for inserting fixed amounts of space between components in a Box. Use createHorizontalStrut() and createVerticalStrut() to create struts.
Glue is a component with a preferred width or height of 0 but with an infinite maximum width or height. Glue is used to specify where extra space in a layout should go. For example, if you have three fixed-sized JButton components in a row that is wider than the sum of the button widths, placing glue between them forces them to be evenly spaced. Use createHorizontalGlue() and createVerticalGlue() to create glue components.
| public class Box extends Container implements Accessible { | ||
| // | Public Constructors | |
| public Box (int axis); | ||
| // | Inner Classes | |
| ; | ||
| ; | ||
| // | Public Class Methods | |
| public static Component createGlue (); | ||
| public static Box createHorizontalBox (); | ||
| public static Component createHorizontalGlue (); | ||
| public static Component createHorizontalStrut (int width); | ||
| public static Component createRigidArea (java.awt.Dimension d); | ||
| public static Box createVerticalBox (); | ||
| public static Component createVerticalGlue (); | ||
| public static Component createVerticalStrut (int height); | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible | |
| public void setLayout (java.awt.LayoutManager l); | Overrides:Container | |
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | ||
| // | Protected Instance Fields | |
| protected AccessibleContext accessibleContext ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->Box(Accessible)
Returned By: Box.{createHorizontalBox(), createVerticalBox()}
| Box.Filler | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This class implements the invisible component used to create struts and glue for use with the Box container. It allows you to create an invisible component with any specified minimum, preferred, and maximum sizes.
| public static class Box.Filler extends Component implements Accessible { | ||
| // | Public Constructors | |
| public Filler (java.awt.Dimension min, java.awt.Dimension pref, java.awt.Dimension max); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible | |
| public java.awt.Dimension getMaximumSize (); | Overrides:Component | |
| public java.awt.Dimension getMinimumSize (); | Overrides:Component | |
| public java.awt.Dimension getPreferredSize (); | Overrides:Component | |
| // | Public Instance Methods | |
| public void changeShape (java.awt.Dimension min, java.awt.Dimension pref, java.awt.Dimension max); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | ||
| // | Protected Instance Fields | |
| protected AccessibleContext accessibleContext ; | ||
| } | ||
| BoxLayout | Java 1.2 | |
|
|
||
| javax.swing | serializable layout manager | |
This class is a layout manager that arranges its children into a row or a column. It is the layout manager used by the Box container. See Box for details.
| public class BoxLayout implements java.awt.LayoutManager2, Serializable { | ||
| // | Public Constructors | |
| public BoxLayout (Container target, int axis); | ||
| // | Public Constants | |
| public static final int X_AXIS ; | =0 | |
| public static final int Y_AXIS ; | =1 | |
| // | Methods Implementing LayoutManager | |
| public void addLayoutComponent (String name, Component comp); | empty | |
| public void layoutContainer (Container target); | ||
| public java.awt.Dimension minimumLayoutSize (Container target); | ||
| public java.awt.Dimension preferredLayoutSize (Container target); | ||
| public void removeLayoutComponent (Component comp); | empty | |
| // | Methods Implementing LayoutManager2 | |
| public void addLayoutComponent (Component comp, Object constraints); | empty | |
| public float getLayoutAlignmentX (Container target); | ||
| public float getLayoutAlignmentY (Container target); | ||
| public void invalidateLayout (Container target); | ||
| public java.awt.Dimension maximumLayoutSize (Container target); | ||
| } | ||
Hierarchy: Object-->BoxLayout(java.awt.LayoutManager2(java.awt.LayoutManager),Serializable)
| ButtonGroup | Java 1.2 | |
|
|
||
| javax.swing | serializable | |
This class enforces mutual exclusion (radio behavior) for a group of toggle buttons. Once buttons are added to a ButtonGroup with the add() method, mutual exclusion is automatic, and no further action is necessary.
| public class ButtonGroup implements Serializable { | ||
| // | Public Constructors | |
| public ButtonGroup (); | ||
| // | Property Accessor Methods (by property name) | |
| public java.util.Enumeration getElements (); | ||
| public ButtonModel getSelection (); | default:null | |
| // | Public Instance Methods | |
| public void add (AbstractButton b); | ||
| public boolean isSelected (ButtonModel m); | ||
| public void remove (AbstractButton b); | ||
| public void setSelected (ButtonModel m, boolean b); | ||
| // | Protected Instance Fields | |
| protected java.util.Vector buttons ; | ||
| } | ||
Hierarchy: Object-->ButtonGroup(Serializable)
Passed To: ButtonModel.setGroup(), DefaultButtonModel.setGroup()
Type Of: DefaultButtonModel.group
| ButtonModel | Java 1.2 | |
|
|
||
| javax.swing | model | |
This interface defines the model for Swing buttons. This model consists of five boolean properties that specify the current selection state of the button and three other properties that specify an optional mnemonic, ButtonGroup, and action command (a string passed with a java.awt.event.ActionEvent) for the button.
| public abstract interface ButtonModel extends java.awt.ItemSelectable { | ||
| // | Event Registration Methods (by event name) | |
| public abstract void addActionListener (java.awt.event.ActionListener l); | ||
| public abstract void removeActionListener (java.awt.event.ActionListener l); | ||
| public abstract void addChangeListener (javax.swing.event.ChangeListener l); | ||
| public abstract void removeChangeListener (javax.swing.event.ChangeListener l); | ||
| public abstract void addItemListener (java.awt.event.ItemListener l); | ||
| public abstract void removeItemListener (java.awt.event.ItemListener l); | ||
| // | Property Accessor Methods (by property name) | |
| public abstract String getActionCommand (); | ||
| public abstract void setActionCommand (String s); | ||
| public abstract boolean isArmed (); | ||
| public abstract void setArmed (boolean b); | ||
| public abstract boolean isEnabled (); | ||
| public abstract void setEnabled (boolean b); | ||
| public abstract int getMnemonic (); | ||
| public abstract void setMnemonic (int key); | ||
| public abstract boolean isPressed (); | ||
| public abstract void setPressed (boolean b); | ||
| public abstract boolean isRollover (); | ||
| public abstract void setRollover (boolean b); | ||
| public abstract boolean isSelected (); | ||
| public abstract void setSelected (boolean b); | ||
| // | Public Instance Methods | |
| public abstract void setGroup (ButtonGroup group); | ||
| } | ||
Hierarchy: (ButtonModel(java.awt.ItemSelectable))
Implementations: DefaultButtonModel
Passed To: AbstractButton.setModel(), ButtonGroup.{isSelected(), setSelected()}, JMenu.setModel()
Returned By: AbstractButton.getModel(), ButtonGroup.getSelection()
Type Of: AbstractButton.model
| CellEditor | Java 1.2 | |
|
|
||
| javax.swing | ||
This interface defines general methods that must be implemented by any cell editor object. isCellEditable() should return true if the cell is editable and if the specified event is an appropriate event to trigger an edit. (For example, some programs might require a double-click to edit a cell.) shouldSelectCell() should return true if the given event should cause the cell to become selected or false otherwise. However, this is only a minor secondary purpose of the method. Despite its name, the primary purpose of shouldSelectCell() is to cause the cell editor to begin editing the cell. The editor can use the specified event to set the initial state (e.g., cursor position) of the editor.
getCellEditorValue() returns the value being edited. cancelCellEditing() cancels an edit. stopCellEditing() instructs the editor to stop editing and accept a partially edited value. An editor may return false if it cannot accept the current value (because the partial value is not valid, for example). If the editor stops or cancels editing itself, it sends a javax.swing.event.ChangeEvent to any registered javax.swing.event.CellEditorListener objects.
javax.swing.table.TableCellEditor and javax.swing.tree.TreeCellEditor are table- and tree-specific cell editor interfaces; DefaultCellEditor is an implementation of both those interfaces.
| public abstract interface CellEditor { | ||
| // | Event Registration Methods (by event name) | |
| public abstract void addCellEditorListener (javax.swing.event.CellEditorListener l); | ||
| public abstract void removeCellEditorListener (javax.swing.event.CellEditorListener l); | ||
| // | Public Instance Methods | |
| public abstract void cancelCellEditing (); | ||
| public abstract Object getCellEditorValue (); | ||
| public abstract boolean isCellEditable (java.util.EventObject anEvent); | ||
| public abstract boolean shouldSelectCell (java.util.EventObject anEvent); | ||
| public abstract boolean stopCellEditing (); | ||
| } | ||
Implementations: javax.swing.table.TableCellEditor, javax.swing.tree.TreeCellEditor
| CellRendererPane | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This class is used by Swing components that rely on cell renderer interfaces, such as ListCellRenderer, javax.swing.table.TableCellRenderer, and javax.swing.tree.TreeCellRenderer. The methods of this class are used to paint a single cell renderer component at various specified locations within a container.
| public class CellRendererPane extends Container implements Accessible { | ||
| // | Public Constructors | |
| public CellRendererPane (); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleCellRendererPane | |
| // | Public Instance Methods | |
| public void paintComponent (java.awt.Graphics g, Component c, Container p, java.awt.Rectangle r); | ||
| public void paintComponent (java.awt.Graphics g, Component c, Container p, int x, int y, int w, int h); | ||
| public void paintComponent (java.awt.Graphics g, Component c, Container p, int x, int y, int w, int h, boolean shouldValidate); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleCellRendererPane | |
| // | Public Methods Overriding Container | |
| public void invalidate (); | empty | |
| public void paint (java.awt.Graphics g); | empty | |
| public void update (java.awt.Graphics g); | empty | |
| // | Protected Methods Overriding Container | |
| protected void addImpl (Component x, Object constraints, int index); | ||
| // | Protected Instance Fields | |
| protected AccessibleContext accessibleContext ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->CellRendererPane(Accessible)
| ComboBoxEditor | Java 1.2 | |
|
|
||
| javax.swing | ||
This interface defines the methods that must be implemented by an object that wishes to serve as the editor object for a JComboBox component. It is typically implemented as part of a pluggable look-and-feel and is not normally used by application programmers.
| public abstract interface ComboBoxEditor { | ||
| // | Event Registration Methods (by event name) | |
| public abstract void addActionListener (java.awt.event.ActionListener l); | ||
| public abstract void removeActionListener (java.awt.event.ActionListener l); | ||
| // | Public Instance Methods | |
| public abstract Component getEditorComponent (); | ||
| public abstract Object getItem (); | ||
| public abstract void selectAll (); | ||
| public abstract void setItem (Object anObject); | ||
| } | ||
Passed To: JComboBox.{configureEditor(), setEditor()}
Returned By: JComboBox.getEditor()
Type Of: JComboBox.editor
| ComboBoxModel | Java 1.2 | |
|
|
||
| javax.swing | model | |
This interface defines the basic model used by the JComboBox component. The JComboBox allows the user to select a value from a list or type a value directly. Therefore, ComboBoxModel extends ListModel to add support for a selected item, in addition to the list of items that ListModel already supports. See also MutableComboBoxModel and DefaultComboBoxModel.
| public abstract interface ComboBoxModel extends ListModel { | ||
| // | Public Instance Methods | |
| public abstract Object getSelectedItem (); | ||
| public abstract void setSelectedItem (Object anItem); | ||
| } | ||
Hierarchy: (ComboBoxModel(ListModel))
Implementations: MutableComboBoxModel
Passed To: JComboBox.{JComboBox(), setModel()}, JComboBox.KeySelectionManager.selectionForKey()
Returned By: JComboBox.getModel()
Type Of: JComboBox.dataModel
| DebugGraphics | Java 1.2 | |
|
|
||
| javax.swing | ||
This subclass of java.awt.Graphics reimplements most of the methods of its superclass to facilitate debugging of drawing operations. Instances of this class are rarely used directly; programs can enable graphics debugging by calling setDebugGraphicsOptions() on any Swing component.
| public class DebugGraphics extends java.awt.Graphics { | ||
| // | Public Constructors | |
| public DebugGraphics (); | ||
| public DebugGraphics (java.awt.Graphics graphics); | ||
| public DebugGraphics (java.awt.Graphics graphics, JComponent component); | ||
| // | Public Constants | |
| public static final int BUFFERED_OPTION ; | =4 | |
| public static final int FLASH_OPTION ; | =2 | |
| public static final int LOG_OPTION ; | =1 | |
| public static final int NONE_OPTION ; | =-1 | |
| // | Public Class Methods | |
| public static java.awt.Color flashColor (); | ||
| public static int flashCount (); | ||
| public static int flashTime (); | ||
| public static java.io.PrintStream logStream (); | ||
| public static void setFlashColor (java.awt.Color flashColor); | ||
| public static void setFlashCount (int flashCount); | ||
| public static void setFlashTime (int flashTime); | ||
| public static void setLogStream (java.io.PrintStream stream); | ||
| // | Property Accessor Methods (by property name) | |
| public java.awt.Shape getClip (); | Overrides:Graphics | |
| public void setClip (java.awt.Shape clip); | Overrides:Graphics | |
| public void setClip (int x, int y, int width, int height); | Overrides:Graphics | |
| public java.awt.Rectangle getClipBounds (); | Overrides:Graphics | |
| public java.awt.Color getColor (); | Overrides:Graphics | |
| public void setColor (java.awt.Color aColor); | Overrides:Graphics | |
| public int getDebugOptions (); | default:0 | |
| public void setDebugOptions (int options); | ||
| public boolean isDrawingBuffer (); | default:false | |
| public java.awt.Font getFont (); | Overrides:Graphics | |
| public void setFont (java.awt.Font aFont); | Overrides:Graphics | |
| public java.awt.FontMetrics getFontMetrics (); | Overrides:Graphics | |
| public java.awt.FontMetrics getFontMetrics (java.awt.Font f); | Overrides:Graphics | |
| // | Public Methods Overriding Graphics | |
| public void clearRect (int x, int y, int width, int height); | ||
| public void clipRect (int x, int y, int width, int height); | ||
| public void copyArea (int x, int y, int width, int height, int destX, int destY); | ||
| public java.awt.Graphics create (); | ||
| public java.awt.Graphics create (int x, int y, int width, int height); | ||
| public void dispose (); | ||
| public void draw3DRect (int x, int y, int width, int height, boolean raised); | ||
| public void drawArc (int x, int y, int width, int height, int startAngle, int arcAngle); | ||
| public void drawBytes (byte[ ] data, int offset, int length, int x, int y); | ||
| public void drawChars (char[ ] data, int offset, int length, int x, int y); | ||
| public boolean drawImage (java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer); | ||
| public boolean drawImage (java.awt.Image img, int x, int y, java.awt.Color bgcolor, java.awt.image.ImageObserver observer); | ||
| public boolean drawImage (java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer); | ||
| public boolean drawImage (java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgcolor, java.awt.image.ImageObserver observer); | ||
| public boolean drawImage (java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer); | ||
| public boolean drawImage (java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgcolor, java.awt.image.ImageObserver observer); | ||
| public void drawLine (int x1, int y1, int x2, int y2); | ||
| public void drawOval (int x, int y, int width, int height); | ||
| public void drawPolygon (int[ ] xPoints, int[ ] yPoints, int nPoints); | ||
| public void drawPolyline (int[ ] xPoints, int[ ] yPoints, int nPoints); | ||
| public void drawRect (int x, int y, int width, int height); | ||
| public void drawRoundRect (int x, int y, int width, int height, int arcWidth, int arcHeight); | ||
| public void drawString (java.text.AttributedCharacterIterator iterator, int x, int y); | ||
| public void drawString (String aString, int x, int y); | ||
| public void fill3DRect (int x, int y, int width, int height, boolean raised); | ||
| public void fillArc (int x, int y, int width, int height, int startAngle, int arcAngle); | ||
| public void fillOval (int x, int y, int width, int height); | ||
| public void fillPolygon (int[ ] xPoints, int[ ] yPoints, int nPoints); | ||
| public void fillRect (int x, int y, int width, int height); | ||
| public void fillRoundRect (int x, int y, int width, int height, int arcWidth, int arcHeight); | ||
| public void setPaintMode (); | ||
| public void setXORMode (java.awt.Color aColor); | ||
| public void translate (int x, int y); | ||
| } | ||
Hierarchy: Object-->java.awt.Graphics-->DebugGraphics
| DefaultBoundedRangeModel | Java 1.2 | |
|
|
||
| javax.swing | serializable model | |
This class is an implementation of the BoundedRangeModel appropriate for most uses. See BoundedRangeModel for details.
| public class DefaultBoundedRangeModel implements BoundedRangeModel, Serializable { | ||
| // | Public Constructors | |
| public DefaultBoundedRangeModel (); | ||
| public DefaultBoundedRangeModel (int value, int extent, int min, int max); | ||
| // | Event Registration Methods (by event name) | |
| public void addChangeListener (javax.swing.event.ChangeListener l); | Implements:BoundedRangeModel | |
| public void removeChangeListener (javax.swing.event.ChangeListener l); | Implements:BoundedRangeModel | |
| // | Methods Implementing BoundedRangeModel | |
| public void addChangeListener (javax.swing.event.ChangeListener l); | ||
| public int getExtent (); | default:0 | |
| public int getMaximum (); | default:100 | |
| public int getMinimum (); | default:0 | |
| public int getValue (); | default:0 | |
| public boolean getValueIsAdjusting (); | default:false | |
| public void removeChangeListener (javax.swing.event.ChangeListener l); | ||
| public void setExtent (int n); | ||
| public void setMaximum (int n); | ||
| public void setMinimum (int n); | ||
| public void setRangeProperties (int newValue, int newExtent, int newMin, int newMax, boolean adjusting); | ||
| public void setValue (int n); | ||
| public void setValueIsAdjusting (boolean b); | ||
| // | Public Methods Overriding Object | |
| public String toString (); | ||
| // | Protected Instance Methods | |
| protected void fireStateChanged (); | ||
| // | Protected Instance Fields | |
| protected transient javax.swing.event.ChangeEvent changeEvent ; | ||
| protected javax.swing.event.EventListenerList listenerList ; | ||
| } | ||
Hierarchy: Object-->DefaultBoundedRangeModel(BoundedRangeModel,Serializable)
| DefaultButtonModel | Java 1.2 | |
|
|
||
| javax.swing | serializable model | |
This class is a straightforward implementation of the ButtonModel interface that is suitable for most uses. It is the default model for JButton and JMenuItem.
| public class DefaultButtonModel implements ButtonModel, Serializable { | ||
| // | Public Constructors | |
| public DefaultButtonModel (); | ||
| // | Public Constants | |
| public static final int ARMED ; | =1 | |
| public static final int ENABLED ; | =8 | |
| public static final int PRESSED ; | =4 | |
| public static final int ROLLOVER ; | =16 | |
| public static final int SELECTED ; | =2 | |
| // | Event Registration Methods (by event name) | |
| public void addActionListener (java.awt.event.ActionListener l); | Implements:ButtonModel | |
| public void removeActionListener (java.awt.event.ActionListener l); | Implements:ButtonModel | |
| public void addChangeListener (javax.swing.event.ChangeListener l); | Implements:ButtonModel | |
| public void removeChangeListener (javax.swing.event.ChangeListener l); | Implements:ButtonModel | |
| public void addItemListener (java.awt.event.ItemListener l); | Implements:ButtonModel | |
| public void removeItemListener (java.awt.event.ItemListener l); | Implements:ButtonModel | |
| // | Methods Implementing ButtonModel | |
| public void addActionListener (java.awt.event.ActionListener l); | ||
| public void addChangeListener (javax.swing.event.ChangeListener l); | ||
| public void addItemListener (java.awt.event.ItemListener l); | ||
| public String getActionCommand (); | default:null | |
| public int getMnemonic (); | default:0 | |
| public boolean isArmed (); | default:false | |
| public boolean isEnabled (); | default:true | |
| public boolean isPressed (); | default:false | |
| public boolean isRollover (); | default:false | |
| public boolean isSelected (); | default:false | |
| public void removeActionListener (java.awt.event.ActionListener l); | ||
| public void removeChangeListener (javax.swing.event.ChangeListener l); | ||
| public void removeItemListener (java.awt.event.ItemListener l); | ||
| public void setActionCommand (String actionCommand); | ||
| public void setArmed (boolean b); | ||
| public void setEnabled (boolean b); | ||
| public void setGroup (ButtonGroup group); | ||
| public void setMnemonic (int key); | ||
| public void setPressed (boolean b); | ||
| public void setRollover (boolean b); | ||
| public void setSelected (boolean b); | ||
| // | Methods Implementing ItemSelectable | |
| public Object[ ] getSelectedObjects (); | constant default:null | |
| // | Protected Instance Methods | |
| protected void fireActionPerformed (java.awt.event.ActionEvent e); | ||
| protected void fireItemStateChanged (java.awt.event.ItemEvent e); | ||
| protected void fireStateChanged (); | ||
| // | Protected Instance Fields | |
| protected String actionCommand ; | ||
| protected transient javax.swing.event.ChangeEvent changeEvent ; | ||
| protected ButtonGroup group ; | ||
| protected javax.swing.event.EventListenerList listenerList ; | ||
| protected int mnemonic ; | ||
| protected int stateMask ; | ||
| } | ||
Hierarchy: Object-->DefaultButtonModel(ButtonModel(java.awt.ItemSelectable),Serializable)
Subclasses: JToggleButton.ToggleButtonModel
| DefaultCellEditor | Java 1.2 | |
|
|
||
| javax.swing | serializable | |
This class implements both the javax.swing.table.TableCellEditor and the javax.swing.tree.TreeCellEditor interfaces. It is the default editor class used by JTable. Instances of this class can be created to use a specified JTextField, JCheckBox, or JComboBox as the editor component.
| public class DefaultCellEditor implements Serializable, javax.swing.table.TableCellEditor, javax.swing.tree.TreeCellEditor { | ||
| // | Public Constructors | |
| public DefaultCellEditor (JComboBox comboBox); | ||
| public DefaultCellEditor (JTextField textField); | ||
| public DefaultCellEditor (JCheckBox checkBox); | ||
| // | Inner Classes | |
| ; | ||
| // | Event Registration Methods (by event name) | |
| public void addCellEditorListener (javax.swing.event.CellEditorListener l); | Implements:CellEditor | |
| public void removeCellEditorListener (javax.swing.event.CellEditorListener l); | Implements:CellEditor | |
| // | Public Instance Methods | |
| public int getClickCountToStart (); | ||
| public Component getComponent (); | ||
| public void setClickCountToStart (int count); | ||
| // | Methods Implementing CellEditor | |
| public void addCellEditorListener (javax.swing.event.CellEditorListener l); | ||
| public void cancelCellEditing (); | ||
| public Object getCellEditorValue (); | ||
| public boolean isCellEditable (java.util.EventObject anEvent); | ||
| public void removeCellEditorListener (javax.swing.event.CellEditorListener l); | ||
| public boolean shouldSelectCell (java.util.EventObject anEvent); | ||
| public boolean stopCellEditing (); | ||
| // | Methods Implementing TableCellEditor | |
| public Component getTableCellEditorComponent (JTable table, Object value, boolean isSelected, int row, int column); | ||
| // | Methods Implementing TreeCellEditor | |
| public Component getTreeCellEditorComponent (JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row); | ||
| // | Protected Instance Methods | |
| protected void fireEditingCanceled (); | ||
| protected void fireEditingStopped (); | ||
| // | Protected Instance Fields | |
| protected transient javax.swing.event.ChangeEvent changeEvent ; | ||
| protected int clickCountToStart ; | ||
| protected DefaultCellEditor.EditorDelegate delegate ; | ||
| protected JComponent editorComponent ; | ||
| protected javax.swing.event.EventListenerList listenerList ; | ||
| } | ||
Hierarchy: Object-->DefaultCellEditor(Serializable,javax.swing.table.TableCellEditor(CellEditor),javax.swing.tree.TreeCellEditor(CellEditor))
| DefaultCellEditor.EditorDelegate | Java 1.2 | |
|
|
||
| javax.swing | serializable | |
This DefaultCellEditor class can use a JTextField, JComboBox, or JCheckBox as the cell editor component. This protected inner class is used internally by DefaultCellEditor to encapsulate the differences between these three editor components. Application-level code never needs to use this class.
| protected class DefaultCellEditor.EditorDelegate implements java.awt.event.ActionListener, java.awt.event.ItemListener, Serializable { | ||
| // | Protected Constructors | |
| protected EditorDelegate (); | ||
| // | Property Accessor Methods (by property name) | |
| public Object getCellEditorValue (); | constant | |
| // | Public Instance Methods | |
| public void cancelCellEditing (); | empty | |
| public boolean isCellEditable (java.util.EventObject anEvent); | constant | |
| public void setValue (Object x); | empty | |
| public boolean startCellEditing (java.util.EventObject anEvent); | constant | |
| public boolean stopCellEditing (); | constant | |
| // | Methods Implementing ActionListener | |
| public void actionPerformed (java.awt.event.ActionEvent e); | ||
| // | Methods Implementing ItemListener | |
| public void itemStateChanged (java.awt.event.ItemEvent e); | ||
| // | Protected Instance Fields | |
| protected Object value ; | ||
| } | ||
Type Of: DefaultCellEditor.delegate
| DefaultComboBoxModel | Java 1.2 | |
|
|
||
| javax.swing | serializable model | |
This MutableComboBoxModel implementation is the default model object used by the JComboBox component. In addition to the methods of the MutableComboBoxModel, ComboBoxModel, and ListModel interfaces, DefaultComboBoxModel also implements methods to remove all elements from the list and to find a specified element in the list.
| public class DefaultComboBoxModel extends AbstractListModel implements MutableComboBoxModel, Serializable { | ||
| // | Public Constructors | |
| public DefaultComboBoxModel (); | ||
| public DefaultComboBoxModel (Object[ ] items); | ||
| public DefaultComboBoxModel (java.util.Vector v); | ||
| // | Public Instance Methods | |
| public int getIndexOf (Object anObject); | ||
| public void removeAllElements (); | ||
| // | Methods Implementing ComboBoxModel | |
| public Object getSelectedItem (); | default:null | |
| public void setSelectedItem (Object anObject); | ||
| // | Methods Implementing ListModel | |
| public Object getElementAt (int index); | ||
| public int getSize (); | default:0 | |
| // | Methods Implementing MutableComboBoxModel | |
| public void addElement (Object anObject); | ||
| public void insertElementAt (Object anObject, int index); | ||
| public void removeElement (Object anObject); | ||
| public void removeElementAt (int index); | ||
| } | ||
Hierarchy: Object-->AbstractListModel(ListModel,Serializable)-->DefaultComboBoxModel(MutableComboBoxModel(ComboBoxModel(ListModel)),Serializable)
| DefaultDesktopManager | Java 1.2 | |
|
|
||
| javax.swing | serializable | |
This class is a simple default implementation of the DesktopManager interface. It can be used as a starting point for pluggable look-and-feel DesktopManager implementations. It is also used to manage JInternalFrame components that are not within a JDesktopPane. Appliations typically do not need to use this class.
| public class DefaultDesktopManager implements DesktopManager, Serializable { | ||
| // | Public Constructors | |
| public DefaultDesktopManager (); | ||
| // | Methods Implementing DesktopManager | |
| public void activateFrame (JInternalFrame f); | ||
| public void beginDraggingFrame (JComponent f); | ||
| public void beginResizingFrame (JComponent f, int direction); | ||
| public void closeFrame (JInternalFrame f); | ||
| public void deactivateFrame (JInternalFrame f); | ||
| public void deiconifyFrame (JInternalFrame f); | ||
| public void dragFrame (JComponent f, int newX, int newY); | ||
| public void endDraggingFrame (JComponent f); | ||
| public void endResizingFrame (JComponent f); | ||
| public void iconifyFrame (JInternalFrame f); | ||
| public void maximizeFrame (JInternalFrame f); | ||
| public void minimizeFrame (JInternalFrame f); | ||
| public void openFrame (JInternalFrame f); | ||
| public void resizeFrame (JComponent f, int newX, int newY, int newWidth, int newHeight); | ||
| public void setBoundsForFrame (JComponent f, int newX, int newY, int newWidth, int newHeight); | ||
| // | Protected Instance Methods | |
| protected java.awt.Rectangle getBoundsForIconOf (JInternalFrame f); | ||
| protected java.awt.Rectangle getPreviousBounds (JInternalFrame f); | ||
| protected void removeIconFor (JInternalFrame f); | ||
| protected void setPreviousBounds (JInternalFrame f, java.awt.Rectangle r); | ||
| protected void setWasIcon (JInternalFrame f, Boolean value); | ||
| protected boolean wasIcon (JInternalFrame f); | ||
| } | ||
Hierarchy: Object-->DefaultDesktopManager(DesktopManager,Serializable)
| DefaultFocusManager | Java 1.2 | |
|
|
||
| javax.swing | ||
This class is the default FocusManager used by Swing components. It uses the Tab and Shift-Tab keys to move focus forward and backward.
| public class DefaultFocusManager extends FocusManager { | ||
| // | Public Constructors | |
| public DefaultFocusManager (); | ||
| // | Public Instance Methods | |
| public boolean compareTabOrder (Component a, Component b); | ||
| public Component getComponentAfter (Container aContainer, Component aComponent); | ||
| public Component getComponentBefore (Container aContainer, Component aComponent); | ||
| public Component getFirstComponent (Container aContainer); | ||
| public Component getLastComponent (Container aContainer); | ||
| // | Public Methods Overriding FocusManager | |
| public void focusNextComponent (Component aComponent); | ||
| public void focusPreviousComponent (Component aComponent); | ||
| public void processKeyEvent (Component focusedComponent, java.awt.event.KeyEvent anEvent); | ||
| } | ||
Hierarchy: Object-->FocusManager-->DefaultFocusManager
| DefaultListCellRenderer | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This class is the default ListCellRenderer used by the JList component to render the items of the list. This class extends JLabel and uses JLabel features to render list items. Since JList uses this class by default, you should not have to instantiate or use it directly.
| public class DefaultListCellRenderer extends JLabel implements ListCellRenderer, Serializable { | ||
| // | Public Constructors | |
| public DefaultListCellRenderer (); | ||
| // | Inner Classes | |
| ; | ||
| // | Methods Implementing ListCellRenderer | |
| public Component getListCellRendererComponent (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus); | ||
| // | Protected Class Fields | |
| protected static javax.swing.border.Border noFocusBorder ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->JLabel(Accessible,SwingConstants)-->DefaultListCellRenderer(ListCellRenderer,Serializable)
Subclasses: DefaultListCellRenderer.UIResource
| DefaultListCellRenderer.UIResource | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This class is a trivial wrapper around DefaultListCellRenderer. It implements the empty javax.swing.plaf.UIResource marker interface in order to distinguish cell renderers supplied by a look-and-feel from cell renderers supplied by the user. Like all classes that implement UIResource, this class is used by implementors of custom look-and-feels. Applications do not need to use this class.
| public static class DefaultListCellRenderer.UIResource extends DefaultListCellRenderer implements javax.swing.plaf.UIResource { | ||
| // | Public Constructors | |
| public UIResource (); | ||
| } | ||
| DefaultListModel | Java 1.2 | |
|
|
||
| javax.swing | serializable model | |
This class is a ListModel implementation that is based on AbstractListModel, with the addition of java.util.Vector methods for modifying the values contained in the list. This class is suitable for most uses of the JList component, but you may on occasion want to implement a custom ListModel, probably by subclassing AbstractListModel.
| public class DefaultListModel extends AbstractListModel { | ||
| // | Public Constructors | |
| public DefaultListModel (); | ||
| // | Property Accessor Methods (by property name) | |
| public boolean isEmpty (); | default:true | |
| public int getSize (); | Overrides:AbstractListModel default:0 | |
| public void setSize (int newSize); | ||
| // | Public Instance Methods | |
| public void add (int index, Object element); | ||
| public void addElement (Object obj); | ||
| public int capacity (); | ||
| public void clear (); | ||
| public boolean contains (Object elem); | ||
| public void copyInto (Object[ ] anArray); | ||
| public Object elementAt (int index); | ||
| public java.util.Enumeration elements (); | ||
| public void ensureCapacity (int minCapacity); | ||
| public Object firstElement (); | ||
| public Object get (int index); | ||
| public int indexOf (Object elem); | ||
| public int indexOf (Object elem, int index); | ||
| public void insertElementAt (Object obj, int index); | ||
| public Object lastElement (); | ||
| public int lastIndexOf (Object elem); | ||
| public int lastIndexOf (Object elem, int index); | ||
| public Object remove (int index); | ||
| public void removeAllElements (); | ||
| public boolean removeElement (Object obj); | ||
| public void removeElementAt (int index); | ||
| public void removeRange (int fromIndex, int toIndex); | ||
| public Object set (int index, Object element); | ||
| public void setElementAt (Object obj, int index); | ||
| public int size (); | ||
| public Object[ ] toArray (); | ||
| public void trimToSize (); | ||
| // | Public Methods Overriding AbstractListModel | |
| public Object getElementAt (int index); | ||
| // | Public Methods Overriding Object | |
| public String toString (); | ||
| } | ||
Hierarchy: Object-->AbstractListModel(ListModel,Serializable)-->DefaultListModel
| DefaultListSelectionModel | Java 1.2 | |
|
|
||
| javax.swing | cloneable serializable model | |
This class is the default implementation of the ListSelectionModel interface. It is used by JList and JTable components. Typical applications do not need to explicitly use this class or the ListSelectionModel interface.
| public class DefaultListSelectionModel implements Cloneable, ListSelectionModel, Serializable { | ||
| // | Public Constructors | |
| public DefaultListSelectionModel (); | ||
| // | Event Registration Methods (by event name) | |
| public void addListSelectionListener (javax.swing.event.ListSelectionListener l); | Implements:ListSelectionModel | |
| public void removeListSelectionListener (javax.swing.event.ListSelectionListener l); | Implements:ListSelectionModel | |
| // | Public Instance Methods | |
| public boolean isLeadAnchorNotificationEnabled (); | default:true | |
| public void setLeadAnchorNotificationEnabled (boolean flag); | ||
| // | Methods Implementing ListSelectionModel | |
| public void addListSelectionListener (javax.swing.event.ListSelectionListener l); | ||
| public void addSelectionInterval (int index0, int index1); | ||
| public void clearSelection (); | ||
| public int getAnchorSelectionIndex (); | default:-1 | |
| public int getLeadSelectionIndex (); | default:-1 | |
| public int getMaxSelectionIndex (); | default:-1 | |
| public int getMinSelectionIndex (); | default:-1 | |
| public int getSelectionMode (); | default:2 | |
| public boolean getValueIsAdjusting (); | default:false | |
| public void insertIndexInterval (int index, int length, boolean before); | ||
| public boolean isSelectedIndex (int index); | ||
| public boolean isSelectionEmpty (); | default:true | |
| public void removeIndexInterval (int index0, int index1); | ||
| public void removeListSelectionListener (javax.swing.event.ListSelectionListener l); | ||
| public void removeSelectionInterval (int index0, int index1); | ||
| public void setAnchorSelectionIndex (int anchorIndex); | ||
| public void setLeadSelectionIndex (int leadIndex); | ||
| public void setSelectionInterval (int index0, int index1); | ||
| public void setSelectionMode (int selectionMode); | ||
| public void setValueIsAdjusting (boolean isAdjusting); | ||
| // | Public Methods Overriding Object | |
| public Object clone () throws CloneNotSupportedException; | ||
| public String toString (); | ||
| // | Protected Instance Methods | |
| protected void fireValueChanged (boolean isAdjusting); | ||
| protected void fireValueChanged (int firstIndex, int lastIndex); | ||
| protected void fireValueChanged (int firstIndex, int lastIndex, boolean isAdjusting); | ||
| // | Protected Instance Fields | |
| protected boolean leadAnchorNotificationEnabled ; | ||
| protected javax.swing.event.EventListenerList listenerList ; | ||
| } | ||
Hierarchy: Object-->DefaultListSelectionModel(Cloneable,ListSelectionModel,Serializable)
Type Of: javax.swing.tree.DefaultTreeSelectionModel.listSelectionModel
| DefaultSingleSelectionModel | Java 1.2 | |
|
|
||
| javax.swing | serializable model | |
This class is the default implementation of the SingleSelectionModel interface. It is used by JMenuBar, JPopupMenu, and JTabbedPane.
| public class DefaultSingleSelectionModel implements Serializable, SingleSelectionModel { | ||
| // | Public Constructors | |
| public DefaultSingleSelectionModel (); | ||
| // | Event Registration Methods (by event name) | |
| public void addChangeListener (javax.swing.event.ChangeListener l); | Implements:SingleSelectionModel | |
| public void removeChangeListener (javax.swing.event.ChangeListener l); | Implements:SingleSelectionModel | |
| // | Methods Implementing SingleSelectionModel | |
| public void addChangeListener (javax.swing.event.ChangeListener l); | ||
| public void clearSelection (); | ||
| public int getSelectedIndex (); | default:-1 | |
| public boolean isSelected (); | default:false | |
| public void removeChangeListener (javax.swing.event.ChangeListener l); | ||
| public void setSelectedIndex (int index); | ||
| // | Protected Instance Methods | |
| protected void fireStateChanged (); | ||
| // | Protected Instance Fields | |
| protected transient javax.swing.event.ChangeEvent changeEvent ; | ||
| protected javax.swing.event.EventListenerList listenerList ; | ||
| } | ||
Hierarchy: Object-->DefaultSingleSelectionModel(Serializable,SingleSelectionModel)
| DesktopManager | Java 1.2 | |
|
|
||
| javax.swing | ||
This interface defines the methods that must be defined by a pluggable look-and-feel to manage JInternalFrame windows within a JDesktopPane container. Application programmers do not need to use this class.
| public abstract interface DesktopManager { | ||
| // | Public Instance Methods | |
| public abstract void activateFrame (JInternalFrame f); | ||
| public abstract void beginDraggingFrame (JComponent f); | ||
| public abstract void beginResizingFrame (JComponent f, int direction); | ||
| public abstract void closeFrame (JInternalFrame f); | ||
| public abstract void deactivateFrame (JInternalFrame f); | ||
| public abstract void deiconifyFrame (JInternalFrame f); | ||
| public abstract void dragFrame (JComponent f, int newX, int newY); | ||
| public abstract void endDraggingFrame (JComponent f); | ||
| public abstract void endResizingFrame (JComponent f); | ||
| public abstract void iconifyFrame (JInternalFrame f); | ||
| public abstract void maximizeFrame (JInternalFrame f); | ||
| public abstract void minimizeFrame (JInternalFrame f); | ||
| public abstract void openFrame (JInternalFrame f); | ||
| public abstract void resizeFrame (JComponent f, int newX, int newY, int newWidth, int newHeight); | ||
| public abstract void setBoundsForFrame (JComponent f, int newX, int newY, int newWidth, int newHeight); | ||
| } | ||
Implementations: DefaultDesktopManager
Passed To: JDesktopPane.setDesktopManager()
Returned By: JDesktopPane.getDesktopManager()
| FocusManager | Java 1.2 | |
|
|
||
| javax.swing | ||
This abstract class defines three instance methods that must be implemented by an object that wants to manage keyboard focus for an application. It also defines static methods that manipulate the installed focus manager. Applications that mix AWT components with Swing components should call disableSwingFocusManager() to disable Swing's focus management and rely on the AWT focus manager. Call setCurrentManager() to replace the current focus manager with a custom manager of your own.
| public abstract class FocusManager { | ||
| // | Public Constructors | |
| public FocusManager (); | ||
| // | Public Constants | |
| public static final String FOCUS_MANAGER_CLASS_PROPERTY ; | ="FocusManagerClassName" | |
| // | Public Class Methods | |
| public static void disableSwingFocusManager (); | ||
| public static FocusManager getCurrentManager (); | ||
| public static boolean isFocusManagerEnabled (); | ||
| public static void setCurrentManager (FocusManager aFocusManager); | ||
| // | Public Instance Methods | |
| public abstract void focusNextComponent (Component aComponent); | ||
| public abstract void focusPreviousComponent (Component aComponent); | ||
| public abstract void processKeyEvent (Component focusedComponent, java.awt.event.KeyEvent anEvent); | ||
| } | ||
Subclasses: DefaultFocusManager
Passed To: FocusManager.setCurrentManager()
Returned By: FocusManager.getCurrentManager()
| GrayFilter | Java 1.2 | |
|
|
||
| javax.swing | cloneable | |
This class is a java.awt.image.ImageFilter that converts a color image to a grayscale image, suitable for use as an icon that represents a disabled action or an unavailable option. In addition to the usual ImageFilter methods, GrayFilter provides the static createDisabledImage() method, which is all that most applications ever need to use. The AbstractButton and JLabel classes use GrayFilter to automatically create a grayscale version of an image, if no disabled image is explicitly provided.
| public class GrayFilter extends java.awt.image.RGBImageFilter { | ||
| // | Public Constructors | |
| public GrayFilter (boolean b, int p); | ||
| // | Public Class Methods | |
| public static java.awt.Image createDisabledImage (java.awt.Image i); | ||
| // | Public Methods Overriding RGBImageFilter | |
| public int filterRGB (int x, int y, int rgb); | ||
| } | ||
Hierarchy: Object-->java.awt.image.ImageFilter(Cloneable,java.awt.image.ImageConsumer)-->java.awt.image.RGBImageFilter-->GrayFilter
| Icon | Java 1.2 | |
|
|
||
| javax.swing | ||
This interface defines the Swing notion of an icon: an object that knows how to draw a graphic of a fixed width and height at a fixed location. Icons are most commonly implemented with images; see ImageIcon.
| public abstract interface Icon { | ||
| // | Public Instance Methods | |
| public abstract int getIconHeight (); | ||
| public abstract int getIconWidth (); | ||
| public abstract void paintIcon (Component c, java.awt.Graphics g, int x, int y); | ||
| } | ||
Implementations: ImageIcon, javax.swing.plaf.IconUIResource
Passed To: Too many methods to list.
Returned By: Too many methods to list.
Type Of: JInternalFrame.frameIcon, JOptionPane.icon, javax.swing.border.MatteBorder.tileIcon, javax.swing.tree.DefaultTreeCellEditor.editingIcon, javax.swing.tree.DefaultTreeCellRenderer.{closedIcon, leafIcon, openIcon}
| ImageIcon | Java 1.2 | |
|
|
||
| javax.swing | serializable | |
This class is an implementation of the Icon interface that uses an Image to draw the icon. The various constructors allow the image to be specified as an Image object, as a URL, as a file name, or as an array of binary data. Every ImageIcon can have a short textual description that may be used for accessibility (e.g., to describe the icon to a blind user).
| public class ImageIcon implements Icon, Serializable { | ||
| // | Public Constructors | |
| public ImageIcon (); | ||
| public ImageIcon (java.awt.Image image); | ||
| public ImageIcon (String filename); | ||
| public ImageIcon (java.net.URL location); | ||
| public ImageIcon (byte[ ] imageData); | ||
| public ImageIcon (String filename, String description); | ||
| public ImageIcon (java.net.URL location, String description); | ||
| public ImageIcon (byte[ ] imageData, String description); | ||
| public ImageIcon (java.awt.Image image, String description); | ||
| // | Protected Constants | |
| protected static final Component component ; | ||
| protected static final java.awt.MediaTracker tracker ; | ||
| // | Property Accessor Methods (by property name) | |
| public String getDescription (); | default:null | |
| public void setDescription (String description); | ||
| public int getIconHeight (); | Implements:Icon default:-1 | |
| public int getIconWidth (); | Implements:Icon default:-1 | |
| public java.awt.Image getImage (); | default:null | |
| public void setImage (java.awt.Image image); | ||
| public int getImageLoadStatus (); | default:0 | |
| public java.awt.image.ImageObserver getImageObserver (); | default:null | |
| public void setImageObserver (java.awt.image.ImageObserver observer); | ||
| // | Methods Implementing Icon | |
| public int getIconHeight (); | default:-1 | |
| public int getIconWidth (); | default:-1 | |
| public void paintIcon (Component c, java.awt.Graphics g, int x, int y); | synchronized | |
| // | Protected Instance Methods | |
| protected void loadImage (java.awt.Image image); | ||
| } | ||
Hierarchy: Object-->ImageIcon(Icon,Serializable)
| JApplet | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component bean container | |
This class is the Swing version of its superclass, java.applet.Applet. It creates a JRootPane as its sole child, and, like JFrame, JDialog, and similar classes, it implements RootPaneContainer. Calling add() or setLayout() on a JApplet raises an exception. Instead, call getContentPane() to obtain a reference to an internal container on which you can call add() and setLayout(). The default layout manager for this content pane is a BorderLayout. Because JApplet is a RootPaneContainer, it can display a Swing menubar. Use setJMenuBar() and getJMenuBar().
| public class JApplet extends java.applet.Applet implements Accessible, RootPaneContainer { | ||
| // | Public Constructors | |
| public JApplet (); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJApplet | |
| public Container getContentPane (); | Implements:RootPaneContainer default:JPanel | |
| public void setContentPane (Container contentPane); | Implements:RootPaneContainer hidden | |
| public Component getGlassPane (); | Implements:RootPaneContainer default:JPanel | |
| public void setGlassPane (Component glassPane); | Implements:RootPaneContainer hidden | |
| public JMenuBar getJMenuBar (); | default:null | |
| public void setJMenuBar (JMenuBar menuBar); | hidden | |
| public JLayeredPane getLayeredPane (); | Implements:RootPaneContainer | |
| public void setLayeredPane (JLayeredPane layeredPane); | Implements:RootPaneContainer hidden | |
| public void setLayout (java.awt.LayoutManager manager); | Overrides:Container | |
| public JRootPane getRootPane (); | Implements:RootPaneContainer | |
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJApplet | |
| // | Methods Implementing RootPaneContainer | |
| public Container getContentPane (); | default:JPanel | |
| public Component getGlassPane (); | default:JPanel | |
| public JLayeredPane getLayeredPane (); | ||
| public JRootPane getRootPane (); | ||
| public void setContentPane (Container contentPane); | hidden | |
| public void setGlassPane (Component glassPane); | hidden | |
| public void setLayeredPane (JLayeredPane layeredPane); | hidden | |
| // | Public Methods Overriding Container | |
| public void remove (Component comp); | ||
| public void update (java.awt.Graphics g); | ||
| // | Protected Methods Overriding Container | |
| protected void addImpl (Component comp, Object constraints, int index); | ||
| protected String paramString (); | ||
| // | Protected Methods Overriding Component | |
| protected void processKeyEvent (java.awt.event.KeyEvent e); | ||
| // | Protected Instance Methods | |
| protected JRootPane createRootPane (); | ||
| protected boolean isRootPaneCheckingEnabled (); | ||
| protected void setRootPane (JRootPane root); | hidden | |
| protected void setRootPaneCheckingEnabled (boolean enabled); | ||
| // | Protected Instance Fields | |
| protected AccessibleContext accessibleContext ; | ||
| protected JRootPane rootPane ; | ||
| protected boolean rootPaneCheckingEnabled ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->java.awt.Panel-->java.applet.Applet-->JApplet(Accessible,RootPaneContainer)
| JButton | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible(action,value) swing component | |
This class implements a push button. The constructors allow a textual label and/or an icon to be specified for the button. isDefaultButton() checks to see if the button is the default button registered with the setDefaultButton() method of JRootPane. A JButton generates a java.awt.event.ActionEvent when clicked. Most of the interesting properties and methods of JButton are implemented by AbstractButton. The default JButton model is DefaultButtonModel.
| public class JButton extends AbstractButton implements Accessible { | ||
| // | Public Constructors | |
| public JButton (); | ||
| public JButton (Icon icon); | ||
| public JButton (String text); | ||
| public JButton (String text, Icon icon); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJButton expert | |
| public boolean isDefaultButton (); | default:false | |
| public boolean isDefaultCapable (); | default:true | |
| public void setDefaultCapable (boolean defaultCapable); | bound | |
| public String getUIClassID (); | Overrides:JComponent default:"ButtonUI" expert | |
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJButton expert | |
| // | Public Methods Overriding AbstractButton | |
| public void updateUI (); | ||
| // | Protected Methods Overriding AbstractButton | |
| protected String paramString (); | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->AbstractButton(java.awt.ItemSelectable,SwingConstants)-->JButton(Accessible)
Passed To: JRootPane.setDefaultButton(), JToolBar.createActionChangeListener()
Returned By: JRootPane.getDefaultButton(), JToolBar.add()
Type Of: JRootPane.defaultButton
| JCheckBox | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible(action,value) swing component | |
This class implements a check button: a toggle button with default graphics that indicate that the button does not have mutually exclusive behavior. Because JCheckBox supplies its own default and selected icons, you typically do not use the constructors that take Icon arguments. The initial selection state of a JCheckBox can be specified in the call to the constructor. The state can also be set with setSelected() and queried with isSelected(). Use JRadioButton and ButtonGroup instead of JCheckBox if you want to display a set of mutually exclusive choices. The default JCheckBox model is JToggleButton.ToggleButtonModel. Note that java.awt.Checkbox is spelled with a lowercase b, while JCheckBox has an uppercase B.
| public class JCheckBox extends JToggleButton implements Accessible { | ||
| // | Public Constructors | |
| public JCheckBox (); | ||
| public JCheckBox (Icon icon); | ||
| public JCheckBox (String text); | ||
| public JCheckBox (String text, Icon icon); | ||
| public JCheckBox (Icon icon, boolean selected); | ||
| public JCheckBox (String text, boolean selected); | ||
| public JCheckBox (String text, Icon icon, boolean selected); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJCheckBox expert | |
| public String getUIClassID (); | Overrides:JToggleButton default:"CheckBoxUI" expert | |
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJCheckBox expert | |
| // | Public Methods Overriding JToggleButton | |
| public void updateUI (); | ||
| // | Protected Methods Overriding JToggleButton | |
| protected String paramString (); | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->AbstractButton(java.awt.ItemSelectable,SwingConstants)-->JToggleButton(Accessible)-->JCheckBox(Accessible)
Passed To: DefaultCellEditor.DefaultCellEditor()
| JCheckBoxMenuItem | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible(action,value) swing component | |
This class implements a check button that appears within a pulldown or popup menu. Its use is similar to that of JCheckBox. Use isSelected() to query the selection state of the menu item and setSelected() to select or deselect the item. For menu items with mutually-exclusive selection behavior, use JRadioButtonMenuItem instead. The default JCheckBoxMenuItem model is JToggleButton.ToggleButtonModel.
| public class JCheckBoxMenuItem extends JMenuItem implements Accessible, SwingConstants { | ||
| // | Public Constructors | |
| public JCheckBoxMenuItem (); | ||
| public JCheckBoxMenuItem (String text); | ||
| public JCheckBoxMenuItem (Icon icon); | ||
| public JCheckBoxMenuItem (String text, Icon icon); | ||
| public JCheckBoxMenuItem (String text, boolean b); | ||
| public JCheckBoxMenuItem (String text, Icon icon, boolean b); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJCheckBoxMenuItem | |
| public Object[ ] getSelectedObjects (); | Overrides:AbstractButton synchronized default:null | |
| public boolean getState (); | default:false | |
| public void setState (boolean b); | synchronized hidden | |
| public String getUIClassID (); | Overrides:JMenuItem | |
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJCheckBoxMenuItem | |
| // | Protected Methods Overriding JMenuItem | |
| protected String paramString (); | ||
| // | Public Methods Overriding JComponent | |
| public void requestFocus (); | empty | |
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->AbstractButton(java.awt.ItemSelectable,SwingConstants)-->JMenuItem(Accessible,MenuElement)-->JCheckBoxMenuItem(Accessible,SwingConstants)
| JColorChooser | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This component allows the user to select a color. The easiest way to use it is to call the static showDialog() method, specifying a parent Component for the dialog, a title, and an initial default color. The method creates a JColorChooser in a modal JDialog and blocks until the user dismisses the dialog. If the user dismisses the dialog with the OK button, the method returns the selected color. If the user dismisses the dialog with the Cancel button, or in any other way, showDialog() returns null.
If you need more control over the color selection dialog, you can call createDialog(). This static method creates a JDialog that contains the JColorChooser component you specify. It allows you to specify java.awt.event.ActionListener objects to respond to the OK and Cancel buttons. It does not automatically display the dialog for you, nor does it wait for the user to make a selection.
You can also create and manipulate a JColorChooser on your own, placing it in any dialog or other container. You can register a java.beans.PropertyChangeListener object (with the inherited addPropertyChangeListener() method) to receive notification when the color property changes.
JColorChooser is highly customizable. You can specify how colors are selected by specifying a custom subclass of javax.swing.colorchooser.AbstractColorChooserPanel to addChooserPanel() or setChooserPanels(). And you can customize the way that colors are previewed by specifying an appropriate component to setPreviewPanel(). The default JColorChooser model is a javax.swing.colorchooser.DefaultColorSelectionModel.
| public class JColorChooser extends JComponent implements Accessible { | ||
| // | Public Constructors | |
| public JColorChooser (); | ||
| public JColorChooser (java.awt.Color initialColor); | ||
| public JColorChooser (javax.swing.colorchooser.ColorSelectionModel model); | ||
| // | Public Constants | |
| public static final String CHOOSER_PANELS_PROPERTY ; | ="chooserPanels" | |
| public static final String PREVIEW_PANEL_PROPERTY ; | ="previewPanel" | |
| public static final String SELECTION_MODEL_PROPERTY ; | ="selectionModel" | |
| // | Inner Classes | |
| ; | ||
| // | Public Class Methods | |
| public static JDialog createDialog (Component c, String title, boolean modal, JColorChooser chooserPane, java.awt.event.ActionListener okListener, java.awt.event.ActionListener cancelListener); | ||
| public static java.awt.Color showDialog (Component component, String title, java.awt.Color initialColor); | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJColorChooser | |
| public javax.swing.colorchooser.AbstractColorChooserPanel[ ] getChooserPanels (); | ||
| public void setChooserPanels (javax.swing.colorchooser.AbstractColorChooserPanel[ ] panels); | bound hidden | |
| public java.awt.Color getColor (); | ||
| public void setColor (int c); | ||
| public void setColor (java.awt.Color color); | ||
| public void setColor (int r, int g, int b); | ||
| public JComponent getPreviewPanel (); | default:null | |
| public void setPreviewPanel (JComponent preview); | bound hidden | |
| public javax.swing.colorchooser.ColorSelectionModel getSelectionModel (); | default:DefaultColorSelectionModel | |
| public void setSelectionModel (javax.swing.colorchooser.ColorSelectionModel newModel); | bound hidden | |
| public javax.swing.plaf.ColorChooserUI getUI (); | ||
| public void setUI (javax.swing.plaf.ColorChooserUI ui); | bound hidden | |
| public String getUIClassID (); | Overrides:JComponent default:"ColorChooserUI" | |
| // | Public Instance Methods | |
| public void addChooserPanel (javax.swing.colorchooser.AbstractColorChooserPanel panel); | ||
| public javax.swing.colorchooser.AbstractColorChooserPanel removeChooserPanel (javax.swing.colorchooser.AbstractColorChooserPanel panel); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJColorChooser | |
| // | Public Methods Overriding JComponent | |
| public void updateUI (); | ||
| // | Protected Methods Overriding JComponent | |
| protected String paramString (); | ||
| // | Protected Instance Fields | |
| protected AccessibleContext accessibleContext ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->JColorChooser(Accessible)
Passed To: JColorChooser.createDialog(), javax.swing.colorchooser.AbstractColorChooserPanel.{installChooserPanel(), uninstallChooserPanel()}
| JComboBox | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible(action) swing component | |
This class implements a combo box: a combination of a popup list of selectable items and an item editor that displays the selected value and, optionally, allows the user to enter an item that does not appear on the list. The editor is usually a text field, but a JComboBox can be configured to use another component as its ComboBoxEditor.
Typically, you create a JComboBox by passing a Vector or array of objects to a constructor. Alternatively, you can create an empty JComboBox and add items to it with addItem(). You can set and query the selection with setSelectedItem(), setSelectedIndex(), getSelectedItem(), and getSelectedIndex(). The JComboBox generates a java.awt.event.ActionEvent when the selection changes. The default JComboBox model is a private implementation of the ComboBoxModel interface. If you want to implement keyboard shortcuts for a JComboBox, implement the JComboBox.KeySelectionManager interface and pass an instance to the setKeySelectionManager() method.
| public class JComboBox extends JComponent implements Accessible, java.awt.event.ActionListener, java.awt.ItemSelectable, javax.swing.event.ListDataListener { | ||
| // | Public Constructors | |
| public JComboBox (); | ||
| public JComboBox (java.util.Vector items); | ||
| public JComboBox (ComboBoxModel aModel); | ||
| public JComboBox (Object[ ] items); | ||
| // | Inner Classes | |
| ; | ||
| ; | ||
| // | Event Registration Methods (by event name) | |
| public void addActionListener (java.awt.event.ActionListener l); | ||
| public void removeActionListener (java.awt.event.ActionListener l); | ||
| public void addItemListener (java.awt.event.ItemListener aListener); | Implements:ItemSelectable | |
| public void removeItemListener (java.awt.event.ItemListener aListener); | Implements:ItemSelectable | |
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJComboBox | |
| public String getActionCommand (); | default:"comboBoxChanged" | |
| public void setActionCommand (String aCommand); | ||
| public boolean isEditable (); | default:false | |
| public void setEditable (boolean aFlag); | preferred | |
| public ComboBoxEditor getEditor (); | ||
| public void setEditor (ComboBoxEditor anEditor); | expert | |
| public boolean isFocusTraversable (); | Overrides:JComponent default:false | |
| public int getItemCount (); | default:0 | |
| public JComboBox.KeySelectionManager getKeySelectionManager (); | default:null | |
| public void setKeySelectionManager (JComboBox.KeySelectionManager aManager); | expert | |
| public boolean isLightWeightPopupEnabled (); | default:true | |
| public void setLightWeightPopupEnabled (boolean aFlag); | expert | |
| public int getMaximumRowCount (); | default:8 | |
| public void setMaximumRowCount (int count); | preferred | |
| public ComboBoxModel getModel (); | default:DefaultComboBoxModel | |
| public void setModel (ComboBoxModel aModel); | bound | |
| public boolean isPopupVisible (); | default:false | |
| public void setPopupVisible (boolean v); | ||
| public ListCellRenderer getRenderer (); | ||
| public void setRenderer (ListCellRenderer aRenderer); | expert | |
| public int getSelectedIndex (); | default:-1 | |
| public void setSelectedIndex (int anIndex); | preferred | |
| public Object getSelectedItem (); | default:null | |
| public void setSelectedItem (Object anObject); | preferred | |
| public Object[ ] getSelectedObjects (); | Implements:ItemSelectable | |
| public javax.swing.plaf.ComboBoxUI getUI (); | ||
| public void setUI (javax.swing.plaf.ComboBoxUI ui); | expert | |
| public String getUIClassID (); | Overrides:JComponent default:"ComboBoxUI" | |
| // | Public Instance Methods | |
| public void addItem (Object anObject); | ||
| public void configureEditor (ComboBoxEditor anEditor, Object anItem); | ||
| public Object getItemAt (int index); | ||
| public void hidePopup (); | ||
| public void insertItemAt (Object anObject, int index); | ||
| public void removeAllItems (); | ||
| public void removeItem (Object anObject); | ||
| public void removeItemAt (int anIndex); | ||
| public boolean selectWithKeyChar (char keyChar); | ||
| public void showPopup (); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJComboBox | |
| // | Methods Implementing ActionListener | |
| public void actionPerformed (java.awt.event.ActionEvent e); | ||
| // | Methods Implementing ItemSelectable | |
| public void addItemListener (java.awt.event.ItemListener aListener); | ||
| public Object[ ] getSelectedObjects (); | ||
| public void removeItemListener (java.awt.event.ItemListener aListener); | ||
| // | Methods Implementing ListDataListener | |
| public void contentsChanged (javax.swing.event.ListDataEvent e); | ||
| public void intervalAdded (javax.swing.event.ListDataEvent e); | ||
| public void intervalRemoved (javax.swing.event.ListDataEvent e); | ||
| // | Public Methods Overriding JComponent | |
| public void processKeyEvent (java.awt.event.KeyEvent e); | ||
| public void setEnabled (boolean b); | preferred | |
| public void updateUI (); | ||
| // | Protected Methods Overriding JComponent | |
| protected String paramString (); | ||
| // | Protected Instance Methods | |
| protected JComboBox.KeySelectionManager createDefaultKeySelectionManager (); | ||
| protected void fireActionEvent (); | ||
| protected void fireItemStateChanged (java.awt.event.ItemEvent e); | ||
| protected void installAncestorListener (); | ||
| protected void selectedItemChanged (); | ||
| // | Protected Instance Fields | |
| protected String actionCommand ; | ||
| protected ComboBoxModel dataModel ; | ||
| protected ComboBoxEditor editor ; | ||
| protected boolean isEditable ; | ||
| protected JComboBox.KeySelectionManager keySelectionManager ; | ||
| protected boolean lightWeightPopupEnabled ; | ||
| protected int maximumRowCount ; | ||
| protected ListCellRenderer renderer ; | ||
| protected Object selectedItemReminder ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->JComboBox(Accessible,java.awt.event.ActionListener(java.util.EventListener),java.awt.ItemSelectable,javax.swing.event.ListDataListener(java.util.EventListener))
Passed To: DefaultCellEditor.DefaultCellEditor(), javax.swing.plaf.ComboBoxUI.{isFocusTraversable(), isPopupVisible(), setPopupVisible()}
| JComboBox.KeySelectionManager | Java 1.2 | |
|
|
||
| javax.swing | ||
This interface defines the method that must be implemented to bind characters to items in a JComboBox. Given a character, selectionForKey() should return the index of the item that should be selected or -1 if the character does not correspond to an item in the list.
| public abstract static interface JComboBox.KeySelectionManager { | ||
| // | Public Instance Methods | |
| public abstract int selectionForKey (char aKey, ComboBoxModel aModel); | ||
| } | ||
Passed To: JComboBox.setKeySelectionManager()
Returned By: JComboBox.{createDefaultKeySelectionManager(), getKeySelectionManager()}
Type Of: JComboBox.keySelectionManager
| JComponent | Java 1.2 | |
|
|
||
| javax.swing | serializable swing component | |
JComponent is the root of the Swing component hierarchy. It inherits the properties and methods of java.awt.Component and java.awt.Container, including such commonly used properties as foreground, background, font, cursor, enabled, and visible.
In addition to these inherited properties, JComponent defines a number of new properties that are commonly used. The border property specifies a Border object that displays a border (or a blank space) around the component. doubleBuffered specifies whether the JComponent should automatically use double-buffering to reduce flickering during redraws. opaque specifies whether the component draws its background or lets its parent' background show through. toolTipText specifies the text to appear in a tooltip when the mouse pointer lingers over the component.
In addition to the standard get/set property accessor methods, JComponent also defines getClientProperty() and putClientProperty(). In effect, every JComponent maintains a hashtable that maps arbitrary property names to values. You can use this to associate arbitrary data with any Swing component. It is also occasionally used to specify properties that are specific to certain look-and-feels.
| public abstract class JComponent extends Container implements Serializable { | ||
| // | Public Constructors | |
| public JComponent (); | ||
| // | Public Constants | |
| public static final String TOOL_TIP_TEXT_KEY ; | ="ToolTipText" | |
| public static final int UNDEFINED_CONDITION ; | =-1 | |
| public static final int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ; | =1 | |
| public static final int WHEN_FOCUSED ; | =0 | |
| public static final int WHEN_IN_FOCUSED_WINDOW ; | =2 | |
| // | Inner Classes | |
| ; | ||
| // | Public Class Methods | |
| public static boolean isLightweightComponent (Component c); | ||
| // | Event Registration Methods (by event name) | |
| public void addAncestorListener (javax.swing.event.AncestorListener listener); | ||
| public void removeAncestorListener (javax.swing.event.AncestorListener listener); | ||
| public void addPropertyChangeListener (java.beans.PropertyChangeListener listener); | Overrides:Component synchronized | |
| public void removePropertyChangeListener (java.beans.PropertyChangeListener listener); | Overrides:Component synchronized | |
| public void addVetoableChangeListener (java.beans.VetoableChangeListener listener); | synchronized | |
| public void removeVetoableChangeListener (java.beans.VetoableChangeListener listener); | synchronized | |
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | ||
| public float getAlignmentX (); | Overrides:Container | |
| public void setAlignmentX (float alignmentX); | ||
| public float getAlignmentY (); | Overrides:Container | |
| public void setAlignmentY (float alignmentY); | ||
| public boolean getAutoscrolls (); | ||
| public void setAutoscrolls (boolean autoscrolls); | expert | |
| public void setBackground (java.awt.Color bg); | Overrides:Component bound preferred | |
| public javax.swing.border.Border getBorder (); | ||
| public void setBorder (javax.swing.border.Border border); | bound preferred | |
| public int getDebugGraphicsOptions (); | ||
| public void setDebugGraphicsOptions (int debugOptions); | preferred | |
| public boolean isDoubleBuffered (); | Overrides:Component | |
| public void setDoubleBuffered (boolean aFlag); | ||
| public void setEnabled (boolean enabled); | Overrides:Component bound preferred | |
| public boolean isFocusCycleRoot (); | constant | |
| public boolean isFocusTraversable (); | Overrides:Component | |
| public void setForeground (java.awt.Color fg); | Overrides:Component bound preferred | |
| public java.awt.Graphics getGraphics (); | Overrides:Component | |
| public int getHeight (); | Overrides:Component | |
| public java.awt.Insets getInsets (); | Overrides:Container | |
| public java.awt.Insets getInsets (java.awt.Insets insets); | expert | |
| public boolean isManagingFocus (); | constant | |
| public java.awt.Dimension getMaximumSize (); | Overrides:Container | |
| public void setMaximumSize (java.awt.Dimension maximumSize); | bound | |
| public java.awt.Dimension getMinimumSize (); | Overrides:Container | |
| public void setMinimumSize (java.awt.Dimension minimumSize); | bound | |
| public Component getNextFocusableComponent (); | ||
| public void setNextFocusableComponent (Component aComponent); | expert | |
| public boolean isOpaque (); | Overrides:Component | |
| public void setOpaque (boolean isOpaque); | ||
| public boolean isOptimizedDrawingEnabled (); | constant | |
| public boolean isPaintingTile (); | ||
| public java.awt.Dimension getPreferredSize (); | Overrides:Container | |
| public void setPreferredSize (java.awt.Dimension preferredSize); | bound preferred | |
| public KeyStroke[ ] getRegisteredKeyStrokes (); | ||
| public boolean isRequestFocusEnabled (); | ||
| public void setRequestFocusEnabled (boolean aFlag); | expert | |
| public JRootPane getRootPane (); | ||
| public String getToolTipText (); | ||
| public String getToolTipText (java.awt.event.MouseEvent event); | ||
| public void setToolTipText (String text); | preferred | |
| public Container getTopLevelAncestor (); | ||
| public String getUIClassID (); | expert | |
| public boolean isValidateRoot (); | constant | |
| public void setVisible (boolean aFlag); | Overrides:Component | |
| public java.awt.Rectangle getVisibleRect (); | ||
| public int getWidth (); | Overrides:Component | |
| public int getX (); | Overrides:Component | |
| public int getY (); | Overrides:Component | |
| // | Public Instance Methods | |
| public void computeVisibleRect (java.awt.Rectangle visibleRect); | ||
| public JToolTip createToolTip (); | ||
| public void firePropertyChange (String propertyName, long oldValue, long newValue); | ||
| public void firePropertyChange (String propertyName, int oldValue, int newValue); | ||
| public void firePropertyChange (String propertyName, boolean oldValue, boolean newValue); | ||
| public void firePropertyChange (String propertyName, short oldValue, short newValue); | ||
| public void firePropertyChange (String propertyName, char oldValue, char newValue); | ||
| public void firePropertyChange (String propertyName, byte oldValue, byte newValue); | ||
| public void firePropertyChange (String propertyName, float oldValue, float newValue); | ||
| public void firePropertyChange (String propertyName, double oldValue, double newValue); | ||
| public java.awt.event.ActionListener getActionForKeyStroke (KeyStroke aKeyStroke); | ||
| public final Object getClientProperty (Object key); | ||
| public int getConditionForKeyStroke (KeyStroke aKeyStroke); | ||
| public java.awt.Point getToolTipLocation (java.awt.event.MouseEvent event); | constant | |
| public void grabFocus (); | ||
| public void paintImmediately (java.awt.Rectangle r); | ||
| public void paintImmediately (int x, int y, int w, int h); | ||
| public final void putClientProperty (Object key, Object value); | ||
| public void registerKeyboardAction (java.awt.event.ActionListener anAction, KeyStroke aKeyStroke, int aCondition); | ||
| public void registerKeyboardAction (java.awt.event.ActionListener anAction, String aCommand, KeyStroke aKeyStroke, int aCondition); | ||
| public void repaint (java.awt.Rectangle r); | ||
| public boolean requestDefaultFocus (); | ||
| public void resetKeyboardActions (); | ||
| public void revalidate (); | ||
| public void scrollRectToVisible (java.awt.Rectangle aRect); | ||
| public void setFont (java.awt.Font font); | bound preferred | |
| public void unregisterKeyboardAction (KeyStroke aKeyStroke); | ||
| public void updateUI (); | empty | |
| // | Public Methods Overriding Container | |
| public void addNotify (); | ||
| public void paint (java.awt.Graphics g); | ||
| public void removeNotify (); | ||
| public void update (java.awt.Graphics g); | ||
| // | Protected Methods Overriding Container | |
| protected String paramString (); | ||
| // | Public Methods Overriding Component | |
| public void addPropertyChangeListener (String propertyName, java.beans.PropertyChangeListener listener); | synchronized | |
| public boolean contains (int x, int y); | ||
| public java.awt.Rectangle getBounds (java.awt.Rectangle rv); | ||
| public java.awt.Point getLocation (java.awt.Point rv); | ||
| public java.awt.Dimension getSize (java.awt.Dimension rv); | ||
| public boolean hasFocus (); | ||
| public void removePropertyChangeListener (String propertyName, java.beans.PropertyChangeListener listener); | synchronized | |
| public void repaint (long tm, int x, int y, int width, int height); | ||
| public void requestFocus (); | ||
| public void reshape (int x, int y, int w, int h); | ||
| // | Protected Methods Overriding Component | |
| protected void firePropertyChange (String propertyName, Object oldValue, Object newValue); | ||
| protected void processFocusEvent (java.awt.event.FocusEvent e); | ||
| protected void processKeyEvent (java.awt.event.KeyEvent e); | ||
| protected void processMouseMotionEvent (java.awt.event.MouseEvent e); | ||
| // | Protected Instance Methods | |
| protected void fireVetoableChange (String propertyName, Object oldValue, Object newValue) throws java.beans.PropertyVetoException; | ||
| protected java.awt.Graphics getComponentGraphics (java.awt.Graphics g); | ||
| protected void paintBorder (java.awt.Graphics g); | ||
| protected void paintChildren (java.awt.Graphics g); | ||
| protected void paintComponent (java.awt.Graphics g); | ||
| protected void processComponentKeyEvent (java.awt.event.KeyEvent e); | empty | |
| protected void setUI (javax.swing.plaf.ComponentUI newUI); | bound | |
| // | Protected Instance Fields | |
| protected AccessibleContext accessibleContext ; | ||
| protected javax.swing.event.EventListenerList listenerList ; | ||
| protected transient javax.swing.plaf.ComponentUI ui ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)
Subclasses: Too many classes to list.
Passed To: Too many methods to list.
Returned By: JColorChooser.getPreviewPanel(), JFileChooser.getAccessory(), JToolTip.getComponent(), javax.swing.colorchooser.ColorChooserComponentFactory.getPreviewPanel(), javax.swing.event.AncestorEvent.getComponent()
Type Of: DefaultCellEditor.editorComponent
| JComponent.AccessibleJComponent | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible context | |
This class provides default accessibility support for Swing components. It is typically subclassed by component developers; application programmers never need to use it.
| public abstract class JComponent.AccessibleJComponent extends AccessibleContext implements AccessibleComponent, Serializable { | ||
| // | Protected Constructors | |
| protected AccessibleJComponent (); | ||
| // | Inner Classes | |
| ; | ||
| // | Event Registration Methods (by event name) | |
| public void addFocusListener (java.awt.event.FocusListener l); | Implements:AccessibleComponent | |
| public void removeFocusListener (java.awt.event.FocusListener l); | Implements:AccessibleComponent | |
| public void addPropertyChangeListener (java.beans.PropertyChangeListener listener); | Overrides:AccessibleContext | |
| public void removePropertyChangeListener (java.beans.PropertyChangeListener listener); | Overrides:AccessibleContext | |
| // | Methods Implementing AccessibleComponent | |
| public void addFocusListener (java.awt.event.FocusListener l); | ||
| public boolean contains (java.awt.Point p); | ||
| public Accessible getAccessibleAt (java.awt.Point p); | ||
| public java.awt.Color getBackground (); | ||
| public java.awt.Rectangle getBounds (); | ||
| public java.awt.Cursor getCursor (); | ||
| public java.awt.Font getFont (); | ||
| public java.awt.FontMetrics getFontMetrics (java.awt.Font f); | ||
| public java.awt.Color getForeground (); | ||
| public java.awt.Point getLocation (); | ||
| public java.awt.Point getLocationOnScreen (); | ||
| public java.awt.Dimension getSize (); | ||
| public boolean isEnabled (); | ||
| public boolean isFocusTraversable (); | ||
| public boolean isShowing (); | ||
| public boolean isVisible (); | ||
| public void removeFocusListener (java.awt.event.FocusListener l); | ||
| public void requestFocus (); | ||
| public void setBackground (java.awt.Color c); | ||
| public void setBounds (java.awt.Rectangle r); | ||
| public void setCursor (java.awt.Cursor cursor); | ||
| public void setEnabled (boolean b); | ||
| public void setFont (java.awt.Font f); | ||
| public void setForeground (java.awt.Color c); | ||
| public void setLocation (java.awt.Point p); | ||
| public void setSize (java.awt.Dimension d); | ||
| public void setVisible (boolean b); | ||
| // | Public Methods Overriding AccessibleContext | |
| public Accessible getAccessibleChild (int i); | ||
| public int getAccessibleChildrenCount (); | ||
| public AccessibleComponent getAccessibleComponent (); | ||
| public String getAccessibleDescription (); | ||
| public int getAccessibleIndexInParent (); | ||
| public String getAccessibleName (); | ||
| public Accessible getAccessibleParent (); | ||
| public AccessibleRole getAccessibleRole (); | ||
| public AccessibleStateSet getAccessibleStateSet (); | ||
| public java.util.Locale getLocale (); | ||
| // | Protected Instance Methods | |
| protected String getBorderTitle (javax.swing.border.Border b); | ||
| // | Protected Instance Fields | |
| protected java.awt.event.ContainerListener accessibleContainerHandler ; | ||
| } | ||
Subclasses: Too many classes to list.
| JDesktopPane | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This class is a container for JInternalFrame windows. It provides window management functionality appropriate for the currently installed look-and-feel.
| public class JDesktopPane extends JLayeredPane implements Accessible { | ||
| // | Public Constructors | |
| public JDesktopPane (); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJDesktopPane | |
| public JInternalFrame[ ] getAllFrames (); | ||
| public DesktopManager getDesktopManager (); | default:DefaultDesktopManager | |
| public void setDesktopManager (DesktopManager d); | ||
| public boolean isOpaque (); | Overrides:JComponent constant default:true | |
| public javax.swing.plaf.DesktopPaneUI getUI (); | ||
| public void setUI (javax.swing.plaf.DesktopPaneUI ui); | ||
| public String getUIClassID (); | Overrides:JComponent default:"DesktopPaneUI" | |
| // | Public Instance Methods | |
| public JInternalFrame[ ] getAllFramesInLayer (int layer); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJDesktopPane | |
| // | Protected Methods Overriding JLayeredPane | |
| protected String paramString (); | ||
| // | Public Methods Overriding JComponent | |
| public void updateUI (); | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->JLayeredPane(Accessible)-->JDesktopPane(Accessible)
Returned By: JInternalFrame.getDesktopPane(), JInternalFrame.JDesktopIcon.getDesktopPane(), JOptionPane.getDesktopPaneForComponent()
| JDialog | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component bean container | |
This class is used to display Swing dialog boxes. Every JDialog component has an automatically created JRootPane as its single child. Components must not be added directly to the JDialog component. Instead, they should be added to the container returned by getContentPane() method. The default layout manager of this content pane is java.awt.BorderLayout. Unlike its java.awt.Dialog superclass, JDialog can display a menubar. Specify one with setJMenuBar(). setDefaultCloseOperation() specifies how the JDialog should behave when the user attempts to close it. The argument should be one of the constants defined by the WindowConstants interface. The default is HIDE_ON_CLOSE. JDialog uses a native window. Use JInternalFrame for lightweight dialogs.
| public class JDialog extends java.awt.Dialog implements Accessible, RootPaneContainer, WindowConstants { | ||
| // | Public Constructors | |
| public JDialog (); | ||
| public JDialog (java.awt.Dialog owner); | ||
| public JDialog (java.awt.Frame owner); | ||
| public JDialog (java.awt.Dialog owner, String title); | ||
| public JDialog (java.awt.Frame owner, boolean modal); | ||
| public JDialog (java.awt.Frame owner, String title); | ||
| public JDialog (java.awt.Dialog owner, boolean modal); | ||
| public JDialog (java.awt.Frame owner, String title, boolean modal); | ||
| public JDialog (java.awt.Dialog owner, String title, boolean modal); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJDialog | |
| public Container getContentPane (); | Implements:RootPaneContainer default:JPanel | |
| public void setContentPane (Container contentPane); | Implements:RootPaneContainer hidden | |
| public int getDefaultCloseOperation (); | default:1 | |
| public void setDefaultCloseOperation (int operation); | preferred | |
| public Component getGlassPane (); | Implements:RootPaneContainer default:JPanel | |
| public void setGlassPane (Component glassPane); | Implements:RootPaneContainer hidden | |
| public JMenuBar getJMenuBar (); | default:null | |
| public void setJMenuBar (JMenuBar menu); | hidden | |
| public JLayeredPane getLayeredPane (); | Implements:RootPaneContainer | |
| public void setLayeredPane (JLayeredPane layeredPane); | Implements:RootPaneContainer hidden | |
| public void setLayout (java.awt.LayoutManager manager); | Overrides:Container | |
| public JRootPane getRootPane (); | Implements:RootPaneContainer | |
| // | Public Instance Methods | |
| public void setLocationRelativeTo (Component c); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJDialog | |
| // | Methods Implementing RootPaneContainer | |
| public Container getContentPane (); | default:JPanel | |
| public Component getGlassPane (); | default:JPanel | |
| public JLayeredPane getLayeredPane (); | ||
| public JRootPane getRootPane (); | ||
| public void setContentPane (Container contentPane); | hidden | |
| public void setGlassPane (Component glassPane); | hidden | |
| public void setLayeredPane (JLayeredPane layeredPane); | hidden | |
| // | Protected Methods Overriding Dialog | |
| protected String paramString (); | ||
| // | Protected Methods Overriding Window | |
| protected void processWindowEvent (java.awt.event.WindowEvent e); | ||
| // | Public Methods Overriding Container | |
| public void remove (Component comp); | ||
| public void update (java.awt.Graphics g); | ||
| // | Protected Methods Overriding Container | |
| protected void addImpl (Component comp, Object constraints, int index); | ||
| // | Protected Methods Overriding Component | |
| protected void processKeyEvent (java.awt.event.KeyEvent e); | ||
| // | Protected Instance Methods | |
| protected JRootPane createRootPane (); | ||
| protected void dialogInit (); | ||
| protected boolean isRootPaneCheckingEnabled (); | ||
| protected void setRootPane (JRootPane root); | hidden | |
| protected void setRootPaneCheckingEnabled (boolean enabled); | hidden | |
| // | Protected Instance Fields | |
| protected AccessibleContext accessibleContext ; | ||
| protected JRootPane rootPane ; | ||
| protected boolean rootPaneCheckingEnabled ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->java.awt.Window-->java.awt.Dialog-->JDialog(Accessible,RootPaneContainer,WindowConstants)
Returned By: JColorChooser.createDialog(), JOptionPane.createDialog()
| JEditorPane | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible(text,hypertext) swing component | |
This class is a subclass of javax.swing.text.JTextComponent that can be easily configured to display and edit different formatted-text content types using a javax.swing.text.EditorKit object. To configure a JEditorPane, call setEditorKit() to specify an appropriate editor kit for the desired content type. Alternatively, use the static registerEditorKitForContentType() to register a mapping between content types and their corresponding editor kits and then call setContentType(). With such a mapping in place, you may also use setPage() to specify a URL to be displayed. The JEditorPane determines the content type of the URL, installs an appropriate EditorKit, and loads the contents of the URL into the JEditorPane. Swing comes with two predefined EditorKit subclasses: javax.swing.text.html.HTMLEditorKit and javax.swing.text.rtf.RTFEditorKit.
| public class JEditorPane extends javax.swing.text.JTextComponent { | ||
| // | Public Constructors | |
| public JEditorPane (); | ||
| public JEditorPane (String url) throws java.io.IOException; | ||
| public JEditorPane (java.net.URL initialPage) throws java.io.IOException; | ||
| public JEditorPane (String type, String text); | ||
| // | Inner Classes | |
| ; | ||
| ; | ||
| ; | ||
| // | Public Class Methods | |
| public static javax.swing.text.EditorKit createEditorKitForContentType (String type); | ||
| public static void registerEditorKitForContentType (String type, String classname); | ||
| public static void registerEditorKitForContentType (String type, String classname, ClassLoader loader); | ||
| // | Event Registration Methods (by event name) | |
| public void addHyperlinkListener (javax.swing.event.HyperlinkListener listener); | synchronized | |
| public void removeHyperlinkListener (javax.swing.event.HyperlinkListener listener); | synchronized | |
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Overrides:JTextComponent default:AccessibleJEditorPane | |
| public final String getContentType (); | default:"text/plain" | |
| public final void setContentType (String type); | ||
| public final javax.swing.text.EditorKit getEditorKit (); | ||
| public void setEditorKit (javax.swing.text.EditorKit kit); | bound expert | |
| public boolean isManagingFocus (); | Overrides:JComponent constant default:true | |
| public java.net.URL getPage (); | default:null | |
| public void setPage (java.net.URL page) throws java.io.IOException; | bound expert | |
| public void setPage (String url) throws java.io.IOException; | ||
| public java.awt.Dimension getPreferredSize (); | Overrides:JComponent | |
| public boolean getScrollableTracksViewportHeight (); | Overrides:JTextComponent default:false | |
| public boolean getScrollableTracksViewportWidth (); | Overrides:JTextComponent default:false | |
| public String getText (); | Overrides:JTextComponent default:"" | |
| public void setText (String t); | Overrides:JTextComponent | |
| public String getUIClassID (); | Overrides:JComponent default:"EditorPaneUI" | |
| // | Public Instance Methods | |
| public void fireHyperlinkUpdate (javax.swing.event.HyperlinkEvent e); | ||
| public javax.swing.text.EditorKit getEditorKitForContentType (String type); | ||
| public void read (java.io.InputStream in, Object desc) throws java.io.IOException; | ||
| public void setEditorKitForContentType (String type, javax.swing.text.EditorKit k); | ||
| // | Public Methods Overriding JTextComponent | |
| public void replaceSelection (String content); | ||
| // | Protected Methods Overriding JTextComponent | |
| protected String paramString (); | ||
| protected void processComponentKeyEvent (java.awt.event.KeyEvent e); | ||
| // | Protected Instance Methods | |
| protected javax.swing.text.EditorKit createDefaultEditorKit (); | ||
| protected java.io.InputStream getStream (java.net.URL page) throws java.io.IOException; | ||
| protected void scrollToReference (String reference); | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->javax.swing.text.JTextComponent(Accessible,Scrollable)-->JEditorPane
Subclasses: JTextPane
Passed To: javax.swing.text.EditorKit.{deinstall(), install()}, javax.swing.text.StyledEditorKit.{deinstall(), install()}, javax.swing.text.StyledEditorKit.StyledTextAction.{getStyledDocument(), getStyledEditorKit(), setCharacterAttributes(), setParagraphAttributes()}, javax.swing.text.html.HTMLEditorKit.{deinstall(), install()}, javax.swing.text.html.HTMLEditorKit.HTMLTextAction.{getHTMLDocument(), getHTMLEditorKit()}, javax.swing.text.html.HTMLEditorKit.InsertHTMLTextAction.{insertAtBoundry(), insertHTML()}, javax.swing.text.html.HTMLEditorKit.LinkController.activateLink()
Returned By: javax.swing.text.StyledEditorKit.StyledTextAction.getEditor()
| JFileChooser | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This component allows the user to select a file. After creating a JFileChooser component, and setting any desired properties, the easiest way to use it is to call showOpenDialog() or showSaveDialog(). These methods display the JFileChooser in a modal dialog box, using the component you specify as its parent. They also customize the "Okay" button to read Open or Save (or locale-appropriate equivalents). You can also call showDialog() and explicitly specify the text to appear in the "Okay" button. The methods return APPROVE_OPTION if the user selects a file and clicks the Save or Open button. They return CANCEL_OPTION if the user clicks the Cancel button or otherwise dismisses the dialog. They return ERROR_OPTION if some sort of error or exception occurs during file selection. When the return value is APPROVE_OPTION, you can call getSelectedFile() to obtain a File object that represents the file the user selected.
Other commonly used JFileChooser properties are currentDirectory, which specifies the initial or most recently selected directory displayed by the JFileChooser, and fileSelectionMode, which specifies whether the JFileChooser should allow the user to choose a file, a directory, or either. The legal values for the fileSelectionMode property are FILES_ONLY, DIRECTORIES_ONLY, and FILES_AND_DIRECTORIES.
You can selectively filter files, so that only certain choices are displayed to the user, by passing a javax.swing.filechooser.FileFilter object to setFileFilter(). This allows you, for example, to tell the JFileChooser to display only files that have an extension of .htm or .html. The default FileFilter is one that display all files. You can obtain an instance of it by calling getAcceptAllFileFilter(). You can provide a set of file filters for the user to choose from by setting the choosableFileFilters property to an array of FileFilter objects.
In addition to file filters, JFileChooser provides another powerful way to customize the file selection dialog. The accessory property allows you to specify a JComponent file selection accessory to be displayed within the JFileChooser. Such accessories are typically used as file previewers. For example, you might write an accessory to display a thumbnail version of a selected image file. The accessory object must register a PropertyChangeListener on the JFileChooser, so that it can receive notification of changes in the selectedFile property.
| public class JFileChooser extends JComponent implements Accessible { | ||
| // | Public Constructors | |
| public JFileChooser (); | ||
| public JFileChooser (javax.swing.filechooser.FileSystemView fsv); | ||
| public JFileChooser (java.io.File currentDirectory); | ||
| public JFileChooser (String currentDirectoryPath); | ||
| public JFileChooser (java.io.File currentDirectory, javax.swing.filechooser.FileSystemView fsv); | ||
| public JFileChooser (String currentDirectoryPath, javax.swing.filechooser.FileSystemView fsv); | ||
| // | Public Constants | |
| public static final String ACCESSORY_CHANGED_PROPERTY ; | ="AccessoryChangedProperty" | |
| public static final String APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY ; | ="ApproveButtonMnemonicChangedProperty" | |
| public static final String APPROVE_BUTTON_TEXT_CHANGED_PROPERTY ; | ="ApproveButtonTextChangedProperty" | |
| public static final String APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY ; | ="ApproveButtonToolTipTextChangedProperty" | |
| public static final int APPROVE_OPTION ; | =0 | |
| public static final String APPROVE_SELECTION ; | ="ApproveSelection" | |
| public static final int CANCEL_OPTION ; | =1 | |
| public static final String CANCEL_SELECTION ; | ="CancelSelection" | |
| public static final String CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY ; | ="ChoosableFileFilterChangedProperty" | |
| public static final int CUSTOM_DIALOG ; | =2 | |
| public static final String DIALOG_TITLE_CHANGED_PROPERTY ; | ="DialogTitleChangedProperty" | |
| public static final String DIALOG_TYPE_CHANGED_PROPERTY ; | ="DialogTypeChangedProperty" | |
| public static final int DIRECTORIES_ONLY ; | =1 | |
| public static final String DIRECTORY_CHANGED_PROPERTY ; | ="directoryChanged" | |
| public static final int ERROR_OPTION ; | =-1 | |
| public static final String FILE_FILTER_CHANGED_PROPERTY ; | ="fileFilterChanged" | |
| public static final String FILE_HIDING_CHANGED_PROPERTY ; | ="FileHidingChanged" | |
| public static final String FILE_SELECTION_MODE_CHANGED_PROPERTY ; | ="fileSelectionChanged" | |
| public static final String FILE_SYSTEM_VIEW_CHANGED_PROPERTY ; | ="FileSystemViewChanged" | |
| public static final String FILE_VIEW_CHANGED_PROPERTY ; | ="fileViewChanged" | |
| public static final int FILES_AND_DIRECTORIES ; | =2 | |
| public static final int FILES_ONLY ; | =0 | |
| public static final String MULTI_SELECTION_ENABLED_CHANGED_PROPERTY ; | ="fileFilterChanged" | |
| public static final int OPEN_DIALOG ; | =0 | |
| public static final int SAVE_DIALOG ; | =1 | |
| public static final String SELECTED_FILE_CHANGED_PROPERTY ; | ="SelectedFileChangedProperty" | |
| public static final String SELECTED_FILES_CHANGED_PROPERTY ; | ="SelectedFilesChangedProperty" | |
| // | Inner Classes | |
| ; | ||
| // | Event Registration Methods (by event name) | |
| public void addActionListener (java.awt.event.ActionListener l); | ||
| public void removeActionListener (java.awt.event.ActionListener l); | ||
| // | Property Accessor Methods (by property name) | |
| public javax.swing.filechooser.FileFilter getAcceptAllFileFilter (); | ||
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJFileChooser | |
| public JComponent getAccessory (); | default:null | |
| public void setAccessory (JComponent newAccessory); | bound preferred | |
| public int getApproveButtonMnemonic (); | default:0 | |
| public void setApproveButtonMnemonic (int mnemonic); | bound preferred | |
| public void setApproveButtonMnemonic (char mnemonic); | ||
| public String getApproveButtonText (); | default:null | |
| public void setApproveButtonText (String approveButtonText); | bound preferred | |
| public String getApproveButtonToolTipText (); | default:null | |
| public void setApproveButtonToolTipText (String toolTipText); | bound preferred | |
| public javax.swing.filechooser.FileFilter[ ] getChoosableFileFilters (); | ||
| public java.io.File getCurrentDirectory (); | ||
| public void setCurrentDirectory (java.io.File dir); | bound preferred | |
| public String getDialogTitle (); | default:null | |
| public void setDialogTitle (String dialogTitle); | bound preferred | |
| public int getDialogType (); | default:0 | |
| public void setDialogType (int dialogType); | bound preferred | |
| public boolean isDirectorySelectionEnabled (); | default:false | |
| public javax.swing.filechooser.FileFilter getFileFilter (); | ||
| public void setFileFilter (javax.swing.filechooser.FileFilter filter); | bound preferred | |
| public boolean isFileHidingEnabled (); | default:true | |
| public void setFileHidingEnabled (boolean b); | bound preferred | |
| public boolean isFileSelectionEnabled (); | default:true | |
| public int getFileSelectionMode (); | default:0 | |
| public void setFileSelectionMode (int mode); | bound preferred | |
| public javax.swing.filechooser.FileSystemView getFileSystemView (); | ||
| public void setFileSystemView (javax.swing.filechooser.FileSystemView fsv); | bound expert | |
| public javax.swing.filechooser.FileView getFileView (); | default:null | |
| public void setFileView (javax.swing.filechooser.FileView fileView); | bound preferred | |
| public boolean isMultiSelectionEnabled (); | default:false | |
| public void setMultiSelectionEnabled (boolean b); | bound | |
| public java.io.File getSelectedFile (); | default:null | |
| public void setSelectedFile (java.io.File file); | bound preferred | |
| public java.io.File[ ] getSelectedFiles (); | ||
| public void setSelectedFiles (java.io.File[ ] selectedFiles); | bound | |
| public javax.swing.plaf.FileChooserUI getUI (); | ||
| public String getUIClassID (); | Overrides:JComponent default:"FileChooserUI" expert | |
| // | Public Instance Methods | |
| public boolean accept (java.io.File f); | ||
| public void addChoosableFileFilter (javax.swing.filechooser.FileFilter filter); | bound preferred | |
| public void approveSelection (); | ||
| public void cancelSelection (); | ||
| public void changeToParentDirectory (); | ||
| public void ensureFileIsVisible (java.io.File f); | ||
| public String getDescription (java.io.File f); | ||
| public Icon getIcon (java.io.File f); | ||
| public String getName (java.io.File f); | ||
| public String getTypeDescription (java.io.File f); | ||
| public boolean isTraversable (java.io.File f); | ||
| public boolean removeChoosableFileFilter (javax.swing.filechooser.FileFilter f); | ||
| public void rescanCurrentDirectory (); | ||
| public void resetChoosableFileFilters (); | ||
| public int showDialog (Component parent, String approveButtonText); | ||
| public int showOpenDialog (Component parent); | ||
| public int showSaveDialog (Component parent); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJFileChooser | |
| // | Public Methods Overriding JComponent | |
| public void updateUI (); | ||
| // | Protected Methods Overriding JComponent | |
| protected String paramString (); | ||
| // | Protected Instance Methods | |
| protected void fireActionPerformed (String command); | ||
| protected void setup (javax.swing.filechooser.FileSystemView view); | ||
| // | Protected Instance Fields | |
| protected AccessibleContext accessibleContext ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->JFileChooser(Accessible)
Passed To: javax.swing.plaf.FileChooserUI.{ensureFileIsVisible(), getAcceptAllFileFilter(), getApproveButtonText(), getDialogTitle(), getFileView(), rescanCurrentDirectory()}
| JFrame | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component bean container | |
This class is used to display the main window (or windows) of a Swing application. Every JFrame has a single automatically created JRootPane child. You should not add children directly to the JFrame, but instead call getContentPane() and add children to the container returned by that method. Similarly, if you set a layout manager, you should do so on the container returned by getContentPane(). The default layout manager for this container is an instance of java.awt.BorderLayout.
The JFrame has two other features of interest. First, setJMenuBar() automatically places a specified menubar at the top of the window, leaving the content pane free for other application content. Second, setDefaultCloseOperation() specifies how the window should respond when the user attempts to close it (e.g., by typing Alt-F4 in Windows). The argument to this method should be one of the constants defined by javax.swing.WindowConstants. The default is HIDE_ON_CLOSE. In addition to these features, JFrame also inherits useful methods from java.awt.Frame, including setCursor(), setIconImage(), setResizable(), and setTitle().
JFrame uses a heavyweight native window. To create a lightweight window that appears entirely within the confines of a containing window, you can use JInternalFrame.
| public class JFrame extends java.awt.Frame implements Accessible, RootPaneContainer, WindowConstants { | ||
| // | Public Constructors | |
| public JFrame (); | ||
| public JFrame (String title); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJFrame | |
| public Container getContentPane (); | Implements:RootPaneContainer default:JPanel | |
| public void setContentPane (Container contentPane); | Implements:RootPaneContainer hidden | |
| public int getDefaultCloseOperation (); | default:1 | |
| public void setDefaultCloseOperation (int operation); | preferred | |
| public Component getGlassPane (); | Implements:RootPaneContainer default:JPanel | |
| public void setGlassPane (Component glassPane); | Implements:RootPaneContainer hidden | |
| public JMenuBar getJMenuBar (); | default:null | |
| public void setJMenuBar (JMenuBar menubar); | hidden | |
| public JLayeredPane getLayeredPane (); | Implements:RootPaneContainer | |
| public void setLayeredPane (JLayeredPane layeredPane); | Implements:RootPaneContainer hidden | |
| public void setLayout (java.awt.LayoutManager manager); | Overrides:Container | |
| public JRootPane getRootPane (); | Implements:RootPaneContainer | |
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJFrame | |
| // | Methods Implementing RootPaneContainer | |
| public Container getContentPane (); | default:JPanel | |
| public Component getGlassPane (); | default:JPanel | |
| public JLayeredPane getLayeredPane (); | ||
| public JRootPane getRootPane (); | ||
| public void setContentPane (Container contentPane); | hidden | |
| public void setGlassPane (Component glassPane); | hidden | |
| public void setLayeredPane (JLayeredPane layeredPane); | hidden | |
| // | Protected Methods Overriding Frame | |
| protected String paramString (); | ||
| // | Protected Methods Overriding Window | |
| protected void processWindowEvent (java.awt.event.WindowEvent e); | ||
| // | Public Methods Overriding Container | |
| public void remove (Component comp); | ||
| public void update (java.awt.Graphics g); | ||
| // | Protected Methods Overriding Container | |
| protected void addImpl (Component comp, Object constraints, int index); | ||
| // | Protected Methods Overriding Component | |
| protected void processKeyEvent (java.awt.event.KeyEvent e); | ||
| // | Protected Instance Methods | |
| protected JRootPane createRootPane (); | ||
| protected void frameInit (); | ||
| protected boolean isRootPaneCheckingEnabled (); | ||
| protected void setRootPane (JRootPane root); | hidden | |
| protected void setRootPaneCheckingEnabled (boolean enabled); | hidden | |
| // | Protected Instance Fields | |
| protected AccessibleContext accessibleContext ; | ||
| protected JRootPane rootPane ; | ||
| protected boolean rootPaneCheckingEnabled ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->java.awt.Window-->java.awt.Frame(java.awt.MenuContainer)-->JFrame(Accessible,RootPaneContainer,WindowConstants)
| JInternalFrame | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible(value) swing component bean container | |
This class is a lightweight Swing component that simulates a heavyweight native window, complete with titlebar and other window decorations appropriate to the installed look-and-feel. Because it is a lightweight component, with no native window of its own, a JInternalFrame is constrained to stay within the bounds of its container. This container is typically a JDesktopPane. Within a JDesktopPane, a JInternalFrame can be moved, resized, iconified, and maximized, much like a JFrame can be.
JInternalFrame is like JFrame in many ways. A JInternalFrame has a JRootPane as its only child. Components should not be added directly to a JInternalFrame, but rather to the container returned by getContentPane(). setJMenuBar() specifies a menubar for the lightweight window, and setDefaultCloseOperation() specifies how it should respond when the user closes it. See JFrame for more on these two methods.
setTitle() sets the title displayed in the internal frame's titlebar. setFrameIcon() specifies a small image to be displayed in the titlebar and possibly also in the iconified representation of the JInternalFrame. setIconifiable() specifies whether the user is allowed to iconify the window, setIcon() actually iconifies or deiconifies the window, and isIcon() queries whether the window is currently iconified. setDesktopIcon() specifies the internal JInternalFrame.JDesktopIcon object used to represent the iconified version of the JInternalFrame. This last method should not be used by application-level code.
Similarly, setMaximizable() specifies whether the user can maximize the window, and setMaximum() maximizes the window. setResizable() specifies whether the window can be resized. setSelected() selects or deselects the window, and toFront() and toBack() move the window to the top and bottom of the stacking order relative to other JInternalFrame windows. Finally, as with all components, setVisible() makes the window visible or invisible.
| public class JInternalFrame extends JComponent implements Accessible, RootPaneContainer, WindowConstants { | ||
| // | Public Constructors | |
| public JInternalFrame (); | ||
| public JInternalFrame (String title); | ||
| public JInternalFrame (String title, boolean resizable); | ||
| public JInternalFrame (String title, boolean resizable, boolean closable); | ||
| public JInternalFrame (String title, boolean resizable, boolean closable, boolean maximizable); | ||
| public JInternalFrame (String title, boolean resizable, boolean closable, boolean maximizable, boolean iconifiable); | ||
| // | Public Constants | |
| public static final String CONTENT_PANE_PROPERTY ; | ="contentPane" | |
| public static final String FRAME_ICON_PROPERTY ; | ="frameIcon" | |
| public static final String GLASS_PANE_PROPERTY ; | ="glassPane" | |
| public static final String IS_CLOSED_PROPERTY ; | ="closed" | |
| public static final String IS_ICON_PROPERTY ; | ="icon" | |
| public static final String IS_MAXIMUM_PROPERTY ; | ="maximum" | |
| public static final String IS_SELECTED_PROPERTY ; | ="selected" | |
| public static final String LAYERED_PANE_PROPERTY ; | ="layeredPane" | |
| public static final String MENU_BAR_PROPERTY ; | ="menuBar" | |
| public static final String ROOT_PANE_PROPERTY ; | ="rootPane" | |
| public static final String TITLE_PROPERTY ; | ="title" | |
| // | Inner Classes | |
| ; | ||
| ; | ||
| // | Event Registration Methods (by event name) | |
| public void addInternalFrameListener (javax.swing.event.InternalFrameListener l); | ||
| public void removeInternalFrameListener (javax.swing.event.InternalFrameListener l); | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJInternalFrame | |
| public boolean isClosable (); | default:false | |
| public void setClosable (boolean b); | bound preferred | |
| public boolean isClosed (); | default:false | |
| public void setClosed (boolean b) throws java.beans.PropertyVetoException; | bound constrained | |
| public Container getContentPane (); | Implements:RootPaneContainer default:JPanel | |
| public void setContentPane (Container c); | Implements:RootPaneContainer bound hidden | |
| public int getDefaultCloseOperation (); | default:1 | |
| public void setDefaultCloseOperation (int operation); | ||
| public JInternalFrame.JDesktopIcon getDesktopIcon (); | ||
| public void setDesktopIcon (JInternalFrame.JDesktopIcon d); | bound | |
| public JDesktopPane getDesktopPane (); | default:null | |
| public Icon getFrameIcon (); | ||
| public void setFrameIcon (Icon icon); | bound | |
| public Component getGlassPane (); | Implements:RootPaneContainer default:JPanel | |
| public void setGlassPane (Component glass); | Implements:RootPaneContainer hidden | |
| public boolean isIcon (); | default:false | |
| public void setIcon (boolean b) throws java.beans.PropertyVetoException; | bound constrained | |
| public boolean isIconifiable (); | default:false | |
| public void setIconifiable (boolean b); | ||
| public JMenuBar getJMenuBar (); | default:null | |
| public void setJMenuBar (JMenuBar m); | preferred | |
| public int getLayer (); | default:0 | |
| public void setLayer (Integer layer); | expert | |
| public JLayeredPane getLayeredPane (); | Implements:RootPaneContainer | |
| public void setLayeredPane (JLayeredPane layered); | Implements:RootPaneContainer bound hidden | |
| public void setLayout (java.awt.LayoutManager manager); | Overrides:Container | |
| public boolean isMaximizable (); | default:false | |
| public void setMaximizable (boolean b); | bound preferred | |
| public boolean isMaximum (); | default:false | |
| public void setMaximum (boolean b) throws java.beans.PropertyVetoException; | constrained | |
| public boolean isResizable (); | default:false | |
| public void setResizable (boolean b); | bound preferred | |
| public JRootPane getRootPane (); | Implements:RootPaneContainer | |
| public boolean isSelected (); | default:false | |
| public void setSelected (boolean selected) throws java.beans.PropertyVetoException; | bound constrained | |
| public String getTitle (); | default:"" | |
| public void setTitle (String title); | ||
| public javax.swing.plaf.InternalFrameUI getUI (); | ||
| public void setUI (javax.swing.plaf.InternalFrameUI ui); | expert | |
| public String getUIClassID (); | Overrides:JComponent default:"InternalFrameUI" | |
| public final String getWarningString (); | constant default:null | |
| // | Public Instance Methods | |
| public void dispose (); | ||
| public void moveToBack (); | ||
| public void moveToFront (); | ||
| public void pack (); | ||
| public void toBack (); | ||
| public void toFront (); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJInternalFrame | |
| // | Methods Implementing RootPaneContainer | |
| public Container getContentPane (); | default:JPanel | |
| public Component getGlassPane (); | default:JPanel | |
| public JLayeredPane getLayeredPane (); | ||
| public JRootPane getRootPane (); | ||
| public void setContentPane (Container c); | bound hidden | |
| public void setGlassPane (Component glass); | hidden | |
| public void setLayeredPane (JLayeredPane layered); | bound hidden | |
| // | Public Methods Overriding JComponent | |
| public void reshape (int x, int y, int width, int height); | ||
| public void setVisible (boolean b); | ||
| public void updateUI (); | ||
| // | Protected Methods Overriding JComponent | |
| protected void paintComponent (java.awt.Graphics g); | ||
| protected String paramString (); | ||
| // | Public Methods Overriding Container | |
| public void remove (Component comp); | ||
| // | Protected Methods Overriding Container | |
| protected void addImpl (Component comp, Object constraints, int index); | ||
| // | Public Methods Overriding Component | |
| public void show (); | ||
| // | Protected Instance Methods | |
| protected JRootPane createRootPane (); | ||
| protected void fireInternalFrameEvent (int id); | ||
| protected boolean isRootPaneCheckingEnabled (); | ||
| protected void setRootPane (JRootPane root); | hidden | |
| protected void setRootPaneCheckingEnabled (boolean enabled); | ||
| // | Protected Instance Fields | |
| protected boolean closable ; | ||
| protected JInternalFrame.JDesktopIcon desktopIcon ; | ||
| protected Icon frameIcon ; | ||
| protected boolean iconable ; | ||
| protected boolean isClosed ; | ||
| protected boolean isIcon ; | ||
| protected boolean isMaximum ; | ||
| protected boolean isSelected ; | ||
| protected boolean maximizable ; | ||
| protected boolean resizable ; | ||
| protected JRootPane rootPane ; | ||
| protected boolean rootPaneCheckingEnabled ; | ||
| protected String title ; | ||
| // | Deprecated Public Methods | |
| # | public JMenuBar getMenuBar (); | default:null |
| # | public void setMenuBar (JMenuBar m); | |
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->JInternalFrame(Accessible,RootPaneContainer,WindowConstants)
Passed To: Too many methods to list.
Returned By: JDesktopPane.{getAllFrames(), getAllFramesInLayer()}, JInternalFrame.JDesktopIcon.getInternalFrame(), JOptionPane.createInternalFrame()
| JInternalFrame.JDesktopIcon | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This inner class represents an iconified version of a JInternalFrame to be displayed by a JDesktopPane. The appearance of the JDesktopIcon is left entirely to the current look-and-feel, and JDesktopIcon does not define any properties you can set to change its appearance. JDesktopIcon may be removed in future versions of Swing; it should not be used by application-level code.
| public static class JInternalFrame.JDesktopIcon extends JComponent implements Accessible { | ||
| // | Public Constructors | |
| public JDesktopIcon (JInternalFrame f); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible | |
| public JDesktopPane getDesktopPane (); | ||
| public JInternalFrame getInternalFrame (); | ||
| public void setInternalFrame (JInternalFrame f); | ||
| public javax.swing.plaf.DesktopIconUI getUI (); | ||
| public void setUI (javax.swing.plaf.DesktopIconUI ui); | ||
| public String getUIClassID (); | Overrides:JComponent | |
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | ||
| // | Public Methods Overriding JComponent | |
| public void updateUI (); | ||
| } | ||
Passed To: JInternalFrame.setDesktopIcon()
Returned By: JInternalFrame.getDesktopIcon()
Type Of: JInternalFrame.desktopIcon
| JLabel | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This class displays a short string of text and/or an Icon. JLabel is a display-only component with no behavior, so the displayed text and/or icon does not respond to any input events. JLabel does not maintain any state and therefore does not use a model. By default, a JLabel displays a single line of text in a single font. However, as of Swing 1.1.1 and Java 1.2.2, if the text property begins with "<html>", the label is formatted as HTML text and may contain multiple fonts and multiple lines.
The icon, text, and font properties need no explanation. disabledIcon specifies an alternate icon to display when the JLabel is disabled. By default, a grayscale version of the regular icon is used. horizontalAlignment and verticalAlignment specify the justification of the label, and horizontalTextPosition and verticalTextPosition specify the position of the text relative to the icon. Each of these properties should be set to one of the LEFT, CENTER, RIGHT, TOP, or BOTTOM constants defined by the SwingConstants interface. The iconTextGap property specifies the number of pixels between the text and the icon.
Although JLabel does not have any behavior of its own, it can display a mnemonic character. If the displayedMnemonic property is set, the specified character is underlined in the label. If the labelFor property refers to another component, the JLabel requests keyboard focus for that component when the mnemonic is used. This is useful for labeling JTextField components, for example.
| public class JLabel extends JComponent implements Accessible, SwingConstants { | ||
| // | Public Constructors | |
| public JLabel (); | ||
| public JLabel (Icon image); | ||
| public JLabel (String text); | ||
| public JLabel (Icon image, int horizontalAlignment); | ||
| public JLabel (String text, int horizontalAlignment); | ||
| public JLabel (String text, Icon icon, int horizontalAlignment); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJLabel expert | |
| public Icon getDisabledIcon (); | default:null | |
| public void setDisabledIcon (Icon disabledIcon); | bound | |
| public int getDisplayedMnemonic (); | default:0 | |
| public void setDisplayedMnemonic (int key); | bound | |
| public void setDisplayedMnemonic (char aChar); | ||
| public int getHorizontalAlignment (); | default:10 | |
| public void setHorizontalAlignment (int alignment); | bound | |
| public int getHorizontalTextPosition (); | default:11 | |
| public void setHorizontalTextPosition (int textPosition); | bound expert | |
| public Icon getIcon (); | default:null | |
| public void setIcon (Icon icon); | bound preferred | |
| public int getIconTextGap (); | default:4 | |
| public void setIconTextGap (int iconTextGap); | bound | |
| public Component getLabelFor (); | default:null | |
| public void setLabelFor (Component c); | bound | |
| public String getText (); | default:"" | |
| public void setText (String text); | bound preferred | |
| public javax.swing.plaf.LabelUI getUI (); | ||
| public void setUI (javax.swing.plaf.LabelUI ui); | expert | |
| public String getUIClassID (); | Overrides:JComponent default:"LabelUI" | |
| public int getVerticalAlignment (); | default:0 | |
| public void setVerticalAlignment (int alignment); | bound | |
| public int getVerticalTextPosition (); | default:0 | |
| public void setVerticalTextPosition (int textPosition); | bound expert | |
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJLabel expert | |
| // | Public Methods Overriding JComponent | |
| public void updateUI (); | ||
| // | Protected Methods Overriding JComponent | |
| protected String paramString (); | ||
| // | Protected Instance Methods | |
| protected int checkHorizontalKey (int key, String message); | ||
| protected int checkVerticalKey (int key, String message); | ||
| // | Protected Instance Fields | |
| protected Component labelFor ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->JLabel(Accessible,SwingConstants)
Subclasses: DefaultListCellRenderer, javax.swing.table.DefaultTableCellRenderer, javax.swing.tree.DefaultTreeCellRenderer
| JLayeredPane | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component | |
This class is a Swing container that layers its children according to a specified stacking order. When you add a child to a JLayeredPane, you specify an Integer as the constraints argument to the add() methods. This Integer object specifies the layer number for the child, where higher numbers are nearer the top of the stack. JLayeredPane defines a number of _LAYER constants as predefined layers. The layer of a child can also be set with setLayer(). If multiple children are in the same layer, their relative stacking order is determined by their insertion order. This position within a layer can be modified with setPosition(), moveToFront(), and moveToBack(). JLayeredPane is typically used without a layout manager; children have their size and position explicitly set.
All JFrame, JDialog, JApplet, and JInternalFrame objects contain a JRootPane which, in turn, contains a JLayeredPane. This internal JLayeredPane is used to correctly layer lightweight menus, dialogs, floating palettes, internal frames, and so forth.
| public class JLayeredPane extends JComponent implements Accessible { | ||
| // | Public Constructors | |
| public JLayeredPane (); | ||
| // | Public Constants | |
| public static final Integer DEFAULT_LAYER ; | ||
| public static final Integer DRAG_LAYER ; | ||
| public static final Integer FRAME_CONTENT_LAYER ; | ||
| public static final String LAYER_PROPERTY ; | ="layeredContainerLayer" | |
| public static final Integer MODAL_LAYER ; | ||
| public static final Integer PALETTE_LAYER ; | ||
| public static final Integer POPUP_LAYER ; | ||
| // | Inner Classes | |
| ; | ||
| // | Public Class Methods | |
| public static int getLayer (JComponent c); | ||
| public static JLayeredPane getLayeredPaneAbove (Component c); | ||
| public static void putLayer (JComponent c, int layer); | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJLayeredPane | |
| public boolean isOptimizedDrawingEnabled (); | Overrides:JComponent default:true | |
| // | Public Instance Methods | |
| public int getComponentCountInLayer (int layer); | ||
| public Component[ ] getComponentsInLayer (int layer); | ||
| public int getIndexOf (Component c); | ||
| public int getLayer (Component c); | ||
| public int getPosition (Component c); | ||
| public int highestLayer (); | ||
| public int lowestLayer (); | ||
| public void moveToBack (Component c); | ||
| public void moveToFront (Component c); | ||
| public void setLayer (Component c, int layer); | ||
| public void setLayer (Component c, int layer, int position); | ||
| public void setPosition (Component c, int position); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJLayeredPane | |
| // | Public Methods Overriding JComponent | |
| public void paint (java.awt.Graphics g); | ||
| // | Protected Methods Overriding JComponent | |
| protected String paramString (); | ||
| // | Public Methods Overriding Container | |
| public void remove (int index); | ||
| // | Protected Methods Overriding Container | |
| protected void addImpl (Component comp, Object constraints, int index); | ||
| // | Protected Instance Methods | |
| protected java.util.Hashtable getComponentToLayer (); | ||
| protected Integer getObjectForLayer (int layer); | ||
| protected int insertIndexForLayer (int layer, int position); | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->JLayeredPane(Accessible)
Subclasses: JDesktopPane
Passed To: JApplet.setLayeredPane(), JDialog.setLayeredPane(), JFrame.setLayeredPane(), JInternalFrame.setLayeredPane(), JRootPane.setLayeredPane(), JWindow.setLayeredPane(), RootPaneContainer.setLayeredPane()
Returned By: JApplet.getLayeredPane(), JDialog.getLayeredPane(), JFrame.getLayeredPane(), JInternalFrame.getLayeredPane(), JLayeredPane.getLayeredPaneAbove(), JRootPane.{createLayeredPane(), getLayeredPane()}, JWindow.getLayeredPane(), RootPaneContainer.getLayeredPane()
Type Of: JRootPane.layeredPane
| JList | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible(selection) swing component | |
This class displays a list of items (typically strings) and allows the user to select one or more of them. The objects to be displayed are stored in a ListModel object. Two JList constructors allow list items to be specified as a static array or Vector of objects, however. For a dynamic list of elements, you may want to use your own instance of DefaultListModel, which maintains a Vector-like list of objects. By default, JList displays lists of strings. To display other types of list items, define an appropriate ListCellRenderer class and pass an instance of it to setCellRenderer().
The selection state of the JList is maintained by a ListSelectionModel object. By default, JList uses a DefaultListSelectionModel object. Application programmers rarely need to work with the ListSelectionModel directly because JList provides a number of methods to query and set the selection state. setSelectionMode() specifies the types of selections allowed by the JList. Its argument should be one of the three constants defined by ListSelectionModel. SINGLE_SELECTION allows only a single item to be selected, while SINGLE_INTERVAL_SELECTION allows multiple items in a single contiguous block to be selected and MULTIPLE_INTERVAL_SELECTION allows any number of items, contiguous or not, to be selected.
JList generates a javax.swing.event.ListSelectionEvent when the selection state changes and sends it to the valueChanged() methods of any registered javax.swing.event.ListSelectionListener objects.
| public class JList extends JComponent implements Accessible, Scrollable { | ||
| // | Public Constructors | |
| public JList (); | ||
| public JList (Object[ ] listData); | ||
| public JList (ListModel dataModel); | ||
| public JList (java.util.Vector listData); | ||
| // | Inner Classes | |
| ; | ||
| // | Event Registration Methods (by event name) | |
| public void addListSelectionListener (javax.swing.event.ListSelectionListener listener); | ||
| public void removeListSelectionListener (javax.swing.event.ListSelectionListener listener); | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJList | |
| public int getAnchorSelectionIndex (); | default:-1 | |
| public ListCellRenderer getCellRenderer (); | default:DefaultListCellRenderer.UIResource | |
| public void setCellRenderer (ListCellRenderer cellRenderer); | bound | |
| public int getFirstVisibleIndex (); | default:-1 | |
| public int getFixedCellHeight (); | default:-1 | |
| public void setFixedCellHeight (int height); | bound | |
| public int getFixedCellWidth (); | default:-1 | |
| public void setFixedCellWidth (int width); | bound | |
| public int getLastVisibleIndex (); | default:-1 | |
| public int getLeadSelectionIndex (); | default:-1 | |
| public int getMaxSelectionIndex (); | default:-1 | |
| public int getMinSelectionIndex (); | default:-1 | |
| public ListModel getModel (); | ||
| public void setModel (ListModel model); | bound | |
| public java.awt.Dimension getPreferredScrollableViewportSize (); | Implements:Scrollable | |
| public Object getPrototypeCellValue (); | default:null | |
| public void setPrototypeCellValue (Object prototypeCellValue); | bound | |
| public boolean getScrollableTracksViewportHeight (); | Implements:Scrollable default:false | |
| public boolean getScrollableTracksViewportWidth (); | Implements:Scrollable default:false | |
| public int getSelectedIndex (); | default:-1 | |
| public void setSelectedIndex (int index); | ||
| public int[ ] getSelectedIndices (); | ||
| public void setSelectedIndices (int[ ] indices); | ||
| public Object getSelectedValue (); | default:null | |
| public Object[ ] getSelectedValues (); | ||
| public java.awt.Color getSelectionBackground (); | default:ColorUIResource | |
| public void setSelectionBackground (java.awt.Color selectionBackground); | bound | |
| public boolean isSelectionEmpty (); | default:true | |
| public java.awt.Color getSelectionForeground (); | default:ColorUIResource | |
| public void setSelectionForeground (java.awt.Color selectionForeground); | bound | |
| public int getSelectionMode (); | default:2 | |
| public void setSelectionMode (int selectionMode); | ||
| public ListSelectionModel getSelectionModel (); | default:DefaultListSelectionModel | |
| public void setSelectionModel (ListSelectionModel selectionModel); | bound | |
| public javax.swing.plaf.ListUI getUI (); | ||
| public void setUI (javax.swing.plaf.ListUI ui); | ||
| public String getUIClassID (); | Overrides:JComponent default:"ListUI" | |
| public boolean getValueIsAdjusting (); | default:false | |
| public void setValueIsAdjusting (boolean b); | ||
| public int getVisibleRowCount (); | default:8 | |
| public void setVisibleRowCount (int visibleRowCount); | bound | |
| // | Public Instance Methods | |
| public void addSelectionInterval (int anchor, int lead); | ||
| public void clearSelection (); | ||
| public void ensureIndexIsVisible (int index); | ||
| public java.awt.Rectangle getCellBounds (int index1, int index2); | ||
| public java.awt.Point indexToLocation (int index); | ||
| public boolean isSelectedIndex (int index); | ||
| public int locationToIndex (java.awt.Point location); | ||
| public void removeSelectionInterval (int index0, int index1); | ||
| public void setListData (Object[ ] listData); | ||
| public void setListData (java.util.Vector listData); | ||
| public void setSelectedValue (Object anObject, boolean shouldScroll); | ||
| public void setSelectionInterval (int anchor, int lead); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJList | |
| // | Methods Implementing Scrollable | |
| public java.awt.Dimension getPreferredScrollableViewportSize (); | ||
| public int getScrollableBlockIncrement (java.awt.Rectangle visibleRect, int orientation, int direction); | ||
| public boolean getScrollableTracksViewportHeight (); | default:false | |
| public boolean getScrollableTracksViewportWidth (); | default:false | |
| public int getScrollableUnitIncrement (java.awt.Rectangle visibleRect, int orientation, int direction); | ||
| // | Public Methods Overriding JComponent | |
| public void updateUI (); | ||
| // | Protected Methods Overriding JComponent | |
| protected String paramString (); | ||
| // | Protected Instance Methods | |
| protected ListSelectionModel createSelectionModel (); | ||
| protected void fireSelectionValueChanged (int firstIndex, int lastIndex, boolean isAdjusting); | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->JList(Accessible,Scrollable)
Passed To: DefaultListCellRenderer.getListCellRendererComponent(), JList.AccessibleJList.AccessibleJListChild.AccessibleJListChild(), ListCellRenderer.getListCellRendererComponent(), javax.swing.plaf.ListUI.{getCellBounds(), indexToLocation(), locationToIndex()}
| JMenu | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible(action,selection,value) swing component | |
This class implements a pulldown menu in a menubar or a pull-right menu nested within another menu. As a subclass of JMenuItem, JMenu is effectively a menu button with an associated JPopupMenu that appears when the button is activated. Menu items can be added to a JMenu with the add(), insert(), addSeparator(), and insertSeparator() methods. Note that you can add String and Action objects in addition to regular JMenuItem objects. In these cases, an appropriate JMenuItem is automatically created for the String or Action. JMenu generates a javax.swing.event.MenuEvent when it is selected and when its menu is popped up or down. The default JMenu model is DefaultButtonModel.
| public class JMenu extends JMenuItem implements Accessible, MenuElement { | ||
| // | Public Constructors | |
| public JMenu (); | ||
| public JMenu (String s); | ||
| public JMenu (String s, boolean b); | ||
| // | Inner Classes | |
| ; | ||
| ; | ||
| // | Event Registration Methods (by event name) | |
| public void addMenuListener (javax.swing.event.MenuListener l); | ||
| public void removeMenuListener (javax.swing.event.MenuListener l); | ||
| // | Property Accessor Methods (by property name) | |
| public void setAccelerator (KeyStroke keyStroke); | Overrides:JMenuItem hidden | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJMenu | |
| public Component getComponent (); | Implements:MenuElement default:JMenu | |
| public int getDelay (); | default:200 | |
| public void setDelay (int d); | expert | |
| public int getItemCount (); | default:0 | |
| public int getMenuComponentCount (); | default:0 | |
| public Component[ ] getMenuComponents (); | ||
| public void setModel (ButtonModel newModel); | Overrides:AbstractButton bound expert hidden | |
| public JPopupMenu getPopupMenu (); | ||
| public boolean isPopupMenuVisible (); | default:false | |
| public void setPopupMenuVisible (boolean b); | expert hidden | |
| public boolean isSelected (); | Overrides:AbstractButton default:false | |
| public void setSelected (boolean b); | Overrides:AbstractButton expert hidden | |
| public MenuElement[ ] getSubElements (); | Implements:MenuElement | |
| public boolean isTearOff (); | ||
| public boolean isTopLevelMenu (); | default:false | |
| public String getUIClassID (); | Overrides:JMenuItem default:"MenuUI" | |
| // | Public Instance Methods | |
| public JMenuItem add (String s); | ||
| public JMenuItem add (JMenuItem menuItem); | ||
| public JMenuItem add (Action a); | ||
| public void addSeparator (); | ||
| public JMenuItem getItem (int pos); | ||
| public Component getMenuComponent (int n); | ||
| public void insert (String s, int pos); | ||
| public JMenuItem insert (JMenuItem mi, int pos); | ||
| public JMenuItem insert (Action a, int pos); | ||
| public void insertSeparator (int index); | ||
| public boolean isMenuComponent (Component c); | ||
| public void remove (JMenuItem item); | ||
| public void setMenuLocation (int x, int y); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJMenu | |
| // | Methods Implementing MenuElement | |
| public Component getComponent (); | default:JMenu | |
| public MenuElement[ ] getSubElements (); | ||
| public void menuSelectionChanged (boolean isIncluded); | ||
| // | Public Methods Overriding JMenuItem | |
| public void updateUI (); | ||
| // | Protected Methods Overriding JMenuItem | |
| protected String paramString (); | ||
| // | Public Methods Overriding AbstractButton | |
| public void doClick (int pressTime); | ||
| // | Protected Methods Overriding JComponent | |
| protected void processKeyEvent (java.awt.event.KeyEvent e); | ||
| // | Public Methods Overriding Container | |
| public Component add (Component c); | ||
| public void remove (Component c); | ||
| public void remove (int pos); | ||
| public void removeAll (); | ||
| // | Protected Instance Methods | |
| protected java.beans.PropertyChangeListener createActionChangeListener (JMenuItem b); | ||
| protected JMenu.WinListener createWinListener (JPopupMenu p); | ||
| protected void fireMenuCanceled (); | ||
| protected void fireMenuDeselected (); | ||
| protected void fireMenuSelected (); | ||
| // | Protected Instance Fields | |
| protected JMenu.WinListener popupListener ; | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->AbstractButton(java.awt.ItemSelectable,SwingConstants)-->JMenuItem(Accessible,MenuElement)-->JMenu(Accessible,MenuElement)
Passed To: JMenuBar.{add(), setHelpMenu()}
Returned By: JMenuBar.{add(), getHelpMenu(), getMenu()}
| JMenu.WinListener | Java 1.2 | |
|
|
||
| javax.swing | serializable | |
This protected inner class is a java.awt.event.WindowListener that is used internally by JMenu to determine when the popup window containing the menu items closes. Application-level code never needs to use this class.
| protected class JMenu.WinListener extends java.awt.event.WindowAdapter implements Serializable { | ||
| // | Public Constructors | |
| public WinListener (JPopupMenu p); | ||
| // | Public Methods Overriding WindowAdapter | |
| public void windowClosing (java.awt.event.WindowEvent e); | ||
| } | ||
Returned By: JMenu.createWinListener()
Type Of: JMenu.popupListener
| JMenuBar | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible(selection) swing component | |
This class implements a menu bar. JMenu objects are placed in a JMenuBar with the add() method and can be removed with the remove() methods. A Help menu should be singled out for special treatment (typically by placing it at the right-hand edge of the menu bar) with setHelpMenu(). JMenuBar uses a SingleSelectionModel object to keep track of which of its JMenuItem children (if any) is currently selected. By default, JMenuBar uses a DefaultSingleSelectionModel model object.
In AWT, the MenuBar class is not a Component. In Swing, JMenuBar is a JComponent and can be laid out in an application like any other component. Note, however, that JFrame, JDialog, JApplet, and JInternalFrame all have setJMenuBar() methods that automatically position a JMenuBar at the top of the window. This is the easiest and most common way to lay out a menu bar.
| public class JMenuBar extends JComponent implements Accessible, MenuElement { | ||
| // | Public Constructors | |
| public JMenuBar (); | ||
| // | Inner Classes | |
| ; | ||
| // | Property Accessor Methods (by property name) | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJMenuBar | |
| public boolean isBorderPainted (); | default:true | |
| public void setBorderPainted (boolean b); | bound | |
| public Component getComponent (); | Implements:MenuElement default:JMenuBar | |
| public JMenu getHelpMenu (); | ||
| public void setHelpMenu (JMenu menu); | ||
| public boolean isManagingFocus (); | Overrides:JComponent constant default:true | |
| public java.awt.Insets getMargin (); | ||
| public void setMargin (java.awt.Insets m); | bound | |
| public int getMenuCount (); | default:0 | |
| public boolean isSelected (); | default:false | |
| public void setSelected (Component sel); | ||
| public SingleSelectionModel getSelectionModel (); | default:DefaultSingleSelectionModel | |
| public void setSelectionModel (SingleSelectionModel model); | bound | |
| public MenuElement[ ] getSubElements (); | Implements:MenuElement | |
| public javax.swing.plaf.MenuBarUI getUI (); | ||
| public void setUI (javax.swing.plaf.MenuBarUI ui); | ||
| public String getUIClassID (); | Overrides:JComponent default:"MenuBarUI" | |
| // | Public Instance Methods | |
| public JMenu add (JMenu c); | ||
| public Component getComponentAtIndex (int i); | ||
| public int getComponentIndex (Component c); | ||
| public JMenu getMenu (int index); | ||
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJMenuBar | |
| // | Methods Implementing MenuElement | |
| public Component getComponent (); | default:JMenuBar | |
| public MenuElement[ ] getSubElements (); | ||
| public void menuSelectionChanged (boolean isIncluded); | empty | |
| public void processKeyEvent (java.awt.event.KeyEvent e, MenuElement[ ] path, MenuSelectionManager manager); | empty | |
| public void processMouseEvent (java.awt.event.MouseEvent event, MenuElement[ ] path, MenuSelectionManager manager); | empty | |
| // | Public Methods Overriding JComponent | |
| public void addNotify (); | ||
| public void removeNotify (); | ||
| public void updateUI (); | ||
| // | Protected Methods Overriding JComponent | |
| protected void paintBorder (java.awt.Graphics g); | ||
| protected String paramString (); | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->JMenuBar(Accessible,MenuElement)
Passed To: JApplet.setJMenuBar(), JDialog.setJMenuBar(), JFrame.setJMenuBar(), JInternalFrame.{setJMenuBar(), setMenuBar()}, JRootPane.{setJMenuBar(), setMenuBar()}
Returned By: JApplet.getJMenuBar(), JDialog.getJMenuBar(), JFrame.getJMenuBar(), JInternalFrame.{getJMenuBar(), getMenuBar()}, JRootPane.{getJMenuBar(), getMenuBar()}
Type Of: JRootPane.menuBar
| JMenuItem | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible(action,value) swing component | |
This class implements an item in a pulldown or popup menu. As a subclass of AbstractButton, it shares most of the properties of JButton. One new feature is that it allows an accelerator to be specified. An accelerator is a keyboard binding for the menu item. Like all Swing buttons, JMenuItem also supports a mnemonic. Accelerators differ from mnemonics in two important ways, however. First, accelerators can be used at any time, while menu item mnemonics can be used only when the menu that contains them is displayed. Second, accelerators are specified with a KeyStroke object, rather than a simple character. This allows complex bindings that include function keys and arbitrary modifier keys.
In addition to its AbstractButton functionality, JMenuItem also implements the MenuElement interface. The default JMenuItem model is DefaultButtonModel, and the UI delegate class is MenuItemUI.
| public class JMenuItem extends AbstractButton implements Accessible, MenuElement { | ||
| // | Public Constructors | |
| public JMenuItem (); | ||
| public JMenuItem (Icon icon); | ||
| public JMenuItem (String text); | ||
| public JMenuItem (String text, Icon icon); | ||
| public JMenuItem (String text, int mnemonic); | ||
| // | Inner Classes | |
| ; | ||
| // | Event Registration Methods (by event name) | |
| public void addMenuDragMouseListener (javax.swing.event.MenuDragMouseListener l); | ||
| public void removeMenuDragMouseListener (javax.swing.event.MenuDragMouseListener l); | ||
| public void addMenuKeyListener (javax.swing.event.MenuKeyListener l); | ||
| public void removeMenuKeyListener (javax.swing.event.MenuKeyListener l); | ||
| // | Property Accessor Methods (by property name) | |
| public KeyStroke getAccelerator (); | default:null | |
| public void setAccelerator (KeyStroke keyStroke); | bound preferred | |
| public AccessibleContext getAccessibleContext (); | Implements:Accessible default:AccessibleJMenuItem | |
| public boolean isArmed (); | default:false | |
| public void setArmed (boolean b); | hidden | |
| public Component getComponent (); | Implements:MenuElement default:JMenuItem | |
| public MenuElement[ ] getSubElements (); | Implements:MenuElement | |
| public String getUIClassID (); | Overrides:JComponent default:"MenuItemUI" | |
| // | Public Instance Methods | |
| public void processMenuDragMouseEvent (javax.swing.event.MenuDragMouseEvent e); | ||
| public void processMenuKeyEvent (javax.swing.event.MenuKeyEvent e); | ||
| public void setUI (javax.swing.plaf.MenuItemUI ui); | bound expert hidden | |
| // | Methods Implementing Accessible | |
| public AccessibleContext getAccessibleContext (); | default:AccessibleJMenuItem | |
| // | Methods Implementing MenuElement | |
| public Component getComponent (); | default:JMenuItem | |
| public MenuElement[ ] getSubElements (); | ||
| public void menuSelectionChanged (boolean isIncluded); | ||
| public void processKeyEvent (java.awt.event.KeyEvent e, MenuElement[ ] path, MenuSelectionManager manager); | ||
| public void processMouseEvent (java.awt.event.MouseEvent e, MenuElement[ ] path, MenuSelectionManager manager); | ||
| // | Public Methods Overriding AbstractButton | |
| public void setEnabled (boolean b); | bound preferred | |
| public void updateUI (); | ||
| // | Protected Methods Overriding AbstractButton | |
| protected void init (String text, Icon icon); | ||
| protected String paramString (); | ||
| // | Protected Instance Methods | |
| protected void fireMenuDragMouseDragged (javax.swing.event.MenuDragMouseEvent event); | ||
| protected void fireMenuDragMouseEntered (javax.swing.event.MenuDragMouseEvent event); | ||
| protected void fireMenuDragMouseExited (javax.swing.event.MenuDragMouseEvent event); | ||
| protected void fireMenuDragMouseReleased (javax.swing.event.MenuDragMouseEvent event); | ||
| protected void fireMenuKeyPressed (javax.swing.event.MenuKeyEvent event); | ||
| protected void fireMenuKeyReleased (javax.swing.event.MenuKeyEvent event); | ||
| protected void fireMenuKeyTyped (javax.swing.event.MenuKeyEvent event); | ||
| } | ||
Hierarchy: Object-->Component(java.awt.image.ImageObserver,java.awt.MenuContainer,Serializable)-->Container-->JComponent(Serializable)-->AbstractButton(java.awt.ItemSelectable,SwingConstants)-->JMenuItem(Accessible,MenuElement)
Subclasses: JCheckBoxMenuItem, JMenu, JRadioButtonMenuItem
Passed To: JMenu.{add(), createActionChangeListener(), insert(), remove()}, JPopupMenu.{add(), createActionChangeListener()}
Returned By: JMenu.{add(), getItem(), insert()}, JPopupMenu.add()
| JOptionPane | Java 1.2 | |
|
|
||
| javax.swing | serializable accessible swing component bean container | |
This component is used to display various types of simple dialog boxes to the user (yes, its name is misleading). It is almost always used through one of the showXXXDialog() static methods. The fact that there are more than 20 of these methods demonstrates the highly-configurable nature of this class. The showInternalXXXDialog() methods display dialogs in lightweight JInternalFrame windows. The other static methods display methods in heavyweight JDialog windows.
You can create and display a simple message dialog with showMessageDialog() and showInternalMessageDialog(). These methods display a dialog box that contains the specified message, an optional icon, and an Okay button that dismisses the dialog. The dialog is modal, meaning it blocks, returning only when the user has dismissed the dialog. The parentComponent argument specifies the component that serves as the parent of the dialog (the dialog typically pops up over this component), while title specifies a string to appear in the titlebar of the dialog. The message argument is more complex. It is declared as an Object. You typically pass a String value, which is automatically displayed in a JLabel. However, you can also specify an Icon, which is also displayed in a JLabel, or any JComponent, which is displayed as is. Furthermore, instead of specifying a single message object, you can specify an array of objects that contains any combination of strings, icons, and components. The messageType argument must be one of the constants WARNING_MESSAGE, QUESTION_MESSAGE, INFO_MESSAGE, ERROR_MESSAGE, or PLAIN_MESSAGE. These constants specify the basic type of message you are displaying. The current look-and-feel may customize the appearance of the dialog based on this value. Typically, the customization is limited to the display of one of a standard set of icons. If you'd like to override the default icon for the dialog, you can also explicitly specify an icon argument.
The showConfirmDialog() and showInternalConfirmDialog() methods are much like showMessageDialog() and showInternalMessageDialog(), except that they ask the user to make a choice and provide several push buttons that represent the options available to the user. (It is the options represented by these buttons from which the name JOptionPane derives.) For example, showConfirmDialog() can be used to display a dialog that asks "Do you really want to quit?" and allows the user to respond by pushing either a Yes button or a No button. The parentComponent, title, message, messageType, and icon arguments to these methods are the same as for the message dialogs. The confirm dialogs add an optionType argument and a return value. optionType specifies which buttons should appear in the dialog. It should be one of the constants DEFAULT_OPTION, YES_NO_OPTION, YES_NO_CANCEL_OPTION, or OK_CANCEL_OPTION. DEFAULT_OPTION provides a single Okay button; the others provide buttons as indicated by their names. Like the message dialogs, the confirm dialogs are modal, and the static methods that display them block until the user has dismissed the dialog. Since confirm dialogs present choices to the user, they have return values that indicate the choice the user selected. This return value is one of the constants OK_OPTION, CANCEL_OPTION, YES_OPTION, NO_OPTION, or CLOSED_OPTION. This last value indicates that the user closed the dialog window without selecting any of the available buttons; typically, it should be treated as a CANCEL_OPTION response.
showOptionDialog() and showInternalOptionDialog() are generalizations of the confirm dialog. They take an options argument, which specifies what buttons to display in the dialog box, and an initialValue argument, which specifies which of these buttons should be the default button. The options argument is an array of objects. Typically, you specify string values that the JOptionPane displays in JButton components. You can provide arbitrary components in the options array, but if you do so, you must arrange for each component to update the state of the JOptionPane by calling its setValue() method when selected.
The final category of dialogs are the input dialogs, created with showInputDialog() and showInternalInputDialog(). Most versions of these methods take the same arguments as the message dialogs. However, in addition to displaying a message, they also contain a JTextField in which the user can enter whatever input value is requested. These dialogs are modal, and the methods that display them block until the user has dismissed the dialog. If the user dismisses the dialog with the Okay button, the methods return the user's input as a String. If the user dismisses the dialog with the Cancel button, these methods return null. One version of both showInputDialog() and showInternalInputDialog() are different. These methods take additional selectionValues and initialSelectionValue arguments. Instead of asking the user to enter a string, they ask the user to choose among the values contained in the selectionValues array (presenting initialSelectionValue as the default value). The display of these values is left to the current look-and-feel, although they are typically displayed using a JComboBox or JList component. The selectionValues array typically contains strings, but it may also contain Icon objects or other objects that can be meaningfully displayed by JList and JComboBox components. When you pass an array of selectionValues to showInputDialog() or showInternalInputDialog(), the return value is the value the user has chosen or null, if the user selected the Cancel button.
Instead of using one of the static methods to display a JOptionPane dialog, you can also create a JOptionPane component, set properties as desired, and then create a dialog to contain it by calling the createDialog() or createInternalFrame() instance method.
| public class JOptionPane extends JComponent implements Accessible { | ||
| // | Public Constructors | |
| public JOptionPane (); | ||
| public JOptionPane (Object message); | ||
| public JOptionPane (Object message, int messageType); | ||
| public JOptionPane (Object message, int messageType, int optionType); | ||
| public JOptionPane (Object message, int messageType, int optionType, Icon icon); | ||
| public JOptionPane (Object message, int messageType, int optionType, Icon icon, Object[ ] options); | ||
| public JOptionPane (Object message, int messageType, int optionType, Icon icon, Object[ ] options, Object initialValue); | ||
| // | Public Constants | |
| public static final int CANCEL_OPTION ; | =2 | |
| public static final int CLOSED_OPTION ; | =-1 | |
| public static final int DEFAULT_OPTION ; | =-1 | |
| publi | ||