You are on page 1of 75

JCheckbox

Constructor Summary
Checkbox()

Creates a check box with no label.


Checkbox(String label)

Creates a check box with the specified label.


Checkbox(String label, boolean state)

Creates a check box with the specified label and sets the specified state.
Checkbox(String label, boolean state, CheckboxGroup group)

Constructs a Checkbox with the specified label, set to the specified state, and in the specified check box group.
Checkbox(String label, CheckboxGroup group, boolean state)

Creates a check box with the specified label, in the specified check box group, and set to the specified state.

Method Summary
void addItemListener(ItemListener l)

Adds the specified item listener to receive item events from this check box.
void addNotify()

Creates the peer of the Checkbox.


AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this Checkbox.


CheckboxGroup getCheckboxGroup()

Determines this check box's group.


ItemListener[] getItemListeners()

Returns an array of all the item listeners registered on this checkbox.


String getLabel()

Gets the label of this check box.


EventListener[] getListeners(Class listenerType)

Returns an array of all the objects currently registered as FooListeners upon this Checkbox.
Object[] getSelectedObjects()

Returns an array (length 1) containing the checkbox label

or null if the checkbox is not selected.


boolean getState()

Determines whether this check box is in the "on" or "off" state.


protected String paramString()

Returns a string representing the state of this Checkbox.


protected void processEvent(AWTEvent e)

Processes events on this check box.


protected void processItemEvent(ItemEvent e)

Processes item events occurring on this check box by dispatching them to any registered ItemListener objects.
void removeItemListener(ItemListener l)

Removes the specified item listener so that the item listener no longer receives item events from this check box.
void setCheckboxGroup(CheckboxGroup g)

Sets this check box's group to be the specified check box group.
void setLabel(String label)

Sets this check box's label to be the string argument.


void setState(boolean state)

Sets the state of this check box to the specified state.

Constructor Summary
JButton()

Creates a button with no set text or icon.


JButton(Action a)

Creates a button where properties are taken from the Action supplied.
JButton(Icon icon)

Creates a button with an icon.


JButton(String text)

Creates a button with text.


JButton(String text, Icon icon)

Creates a button with initial text and an icon.

Method Summary
protected void configurePropertiesFromAction(Action a)

Factory method which sets the AbstractButton's properties according to values from the Action instance.
AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JButton.


String getUIClassID()

Returns a string that specifies the name of the L&F class that renders this component.
boolean isDefaultButton()

Gets the value of the defaultButton property, which if true means that this button is the current default button for its JRootPane.
boolean isDefaultCapable()

Gets the value of the defaultCapable property.


protected String paramString()

Returns a string representation of this JButton.


void removeNotify()

Overrides JComponent.removeNotify to check if this button is currently set as the default button on the RootPane, and if so,

sets the RootPane's default button to null to ensure theRootPane doesn't hold onto an invalid button reference.
void setDefaultCapable(boolean defaultCapable)

Sets the defaultCapable property, which determines whether this button can be made the default button for its root pane.
void updateUI()

Resets the UI property to a value from the current look and feel.

JComboBox

Constructor Summary
JComboBox()

Creates a JComboBox with a default data model.


JComboBox(ComboBoxModel aModel)

Creates a JComboBox that takes it's items from an existing ComboBoxModel.


JComboBox(Object[] items)

Creates a JComboBox that contains the elements in the specified array.


JComboBox(Vector items)

Creates a JComboBox that contains the elements in the specified Vector.

Method Summary
void actionPerformed(ActionEvent e)

This method is public as an implementation side effect.


void addActionListener(ActionListener l)

Adds an ActionListener.
void addItem(Object anObject)

Adds an item to the item list.


void addItemListener(ItemListener aListener)

Adds an ItemListener.
void addPopupMenuListener(PopupMenuListener l)

Adds a PopupMenu listener which will listen to notification messages from the popup portion of the combo box.
void configureEditor(ComboBoxEditor anEditor, Objec t anItem)

Initializes the editor with the specified item.


protected void configurePropertiesFromAction(Action a)

Factory method which sets the ActionEvent source's properties according to values from the Action instance.
void contentsChanged(ListDataEvent e)

This method is public as an implementation side effect.

protected

PropertyChangeListe createActionPropertyChangeListener(Action a) ner

Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance. Returns an instance of the default keyselection manager. Notifies all listeners that have registered interest for notification on this event type.

protected

JComboBox.KeySelect createDefaultKeySelectionManager() ionManager

protected

void fireActionEvent()

protected

void fireItemStateChanged(ItemEvent e)

Notifies all listeners that have registered interest for notification on this event type.
void firePopupMenuCanceled()

Notifies PopupMenuListeners that the popup portion of the combo box has been canceled.
void firePopupMenuWillBecomeInvisible()

Notifies PopupMenuListeners that the popup portion of the combo box has become invisible.
void firePopupMenuWillBecomeVisible()

Notifies PopupMenuListeners that the popup portion of the combo box will become visible.
AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JComboBox.


Action getAction()

Returns the currently set Action for this ActionEvent source, or null if no Action is set.
String getActionCommand()

Returns the action command that is included in the event sent to action listeners.
ActionListener[] getActionListeners()

Returns an array of all the ActionListeners added to this JComboBox with addActionListener().

ComboBoxEditor getEditor()

Returns the editor used to paint and edit the selected item in the JComboBox field.
Object getItemAt(int index)

Returns the list item at the specified index.


int getItemCount()

Returns the number of items in the list.


ItemListener[] getItemListeners()

Returns an array of all the ItemListeners added to this JComboBox with addItemListener().
JComboBox.KeySelectionManager getKeySelectionManager()

Returns the list's key-selection manager.


int getMaximumRowCount()

Returns the maximum number of items the combo box can display without a scrollbar
ComboBoxModel getModel()

Returns the data model currently used by the JComboBox.


PopupMenuListener[] getPopupMenuListeners()

Returns an array of all the PopupMenuListeners added to this JComboBox with addPopupMenuListener().
Object getPrototypeDisplayValue()

Returns the "prototypical display" value - an Object used for the calculation of the display height and width.
ListCellRenderer getRenderer()

Returns the renderer used to display the selected item in the JComboBox field.
int getSelectedIndex()

Returns the first item in the list that matches the given item.
Object getSelectedItem()

Returns the current selected item.


Object[] getSelectedObjects()

Returns an array containing the selected item.

ComboBoxUI getUI()

Returns the L&F object that renders this component.


String getUIClassID()

Returns the name of the L&F class that renders this component.
void hidePopup()

Causes the combo box to close its popup window.


void insertItemAt(Object anObject, int index)

Inserts an item into the item list at a given index.


protected void installAncestorListener() void intervalAdded(ListDataEvent e)

This method is public as an implementation side effect.


void intervalRemoved(ListDataEvent e)

This method is public as an implementation side effect.


boolean isEditable()

Returns true if the JComboBox is editable.


boolean isLightWeightPopupEnabled()

Gets the value of the lightWeightPopupEnabled property.


boolean isPopupVisible()

Determines the visibility of the popup.


protected String paramString()

Returns a string representation of this JComboBox.


void processKeyEvent(KeyEvent e)

Handles KeyEvents, looking for the Tab key.


void removeActionListener(ActionListener l)

Removes an ActionListener.
void removeAllItems()

Removes all items from the item list.

void removeItem(Object anObject)

Removes an item from the item list.


void removeItemAt(int anIndex)

Removes the item at anIndex This method works only if the JComboBox uses a mutable data model.
void removeItemListener(ItemListener aListener)

Removes an ItemListener.
void removePopupMenuListener(PopupMenuListener l)

Removes a PopupMenuListener.
protected void selectedItemChanged()

This protected method is implementation specific.


boolean selectWithKeyChar(char keyChar)

Selects the list item that corresponds to the specified keyboard character and returns true, if there is an item corresponding to that character.
void setAction(Action a)

Sets the Action for the ActionEvent source.


void setActionCommand(String aCommand)

Sets the action command that should be included in the event sent to action listeners.
void setEditable(boolean aFlag)

Determines whether the JComboBox field is editable.


void setEditor(ComboBoxEditor anEditor)

Sets the editor used to paint and edit the selected item in the JComboBox field.
void setEnabled(boolean b)

Enables the combo box so that items can be selected.


void setKeySelectionManager(JComboBox.KeySelectionM anager aManager)

Sets the object that translates a keyboard character into a list selection.
void setLightWeightPopupEnabled(boolean aFlag)

Sets the lightWeightPopupEnabled property, which provides a hint as to whether or not a lightweight Component should be used to contain the JComboBox, versus a heavyweight Component such as a Panel or a Window.
void setMaximumRowCount(int count)

Sets the maximum number of rows the JComboBox displays.


void setModel(ComboBoxModel aModel)

Sets the data model that the JComboBox uses to obtain the list of items.
void setPopupVisible(boolean v)

Sets the visibility of the popup.


void setPrototypeDisplayValue(Object prototypeDispl ayValue)

Sets the prototype display value used to calculate the size of the display for the UI portion.
void setRenderer(ListCellRenderer aRenderer)

Sets the renderer that paints the list items and the item selected from the list in the JComboBox field.
void setSelectedIndex(int anIndex)

Selects the item at index anIndex.


void setSelectedItem(Object anObject)

Sets the selected item in the combo box display area to the object in the argument.
void setUI(ComboBoxUI ui)

Sets the L&F object that renders this component.


void showPopup()

Causes the combo box to display its popup window.


void updateUI()

Resets the UI property to a value from the current look and feel.

JLabel

Constructor Summary
JLabel()

Creates a JLabel instance with no image and with an empty string for the title.
JLabel(Icon image)

Creates a JLabel instance with the specified image.


JLabel(Icon image, int horizontalAlignment)

Creates a JLabel instance with the specified image and horizontal alignment.
JLabel(String text)

Creates a JLabel instance with the specified text.


JLabel(String text, Icon icon, int horizontalAlignment)

Creates a JLabel instance with the specified text, image, and horizontal alignment.
JLabel(String text, int horizontalAlignment)

Creates a JLabel instance with the specified text and horizontal alignment.

Method Summary
protected int checkHorizontalKey(int key, String message)

Verify that key is a legal value for the horizontalAlignment properties.


protected int checkVerticalKey(int key, String message)

Verify that key is a legal value for the verticalAlignment or verticalTextPosition properties.
AccessibleContext getAccessibleContext()

Get the AccessibleContext of this object


Icon getDisabledIcon()

Returns the value of the disabledIcon property if it's been set, If it hasn't been set and the value of the icon property is an ImageIcon, we compute a "grayed out" version of the icon and update the disabledIcon property with that.
int getDisplayedMnemonic()

Return the keycode that indicates a mnemonic key.


int getDisplayedMnemonicIndex()

Returns the character, as an index, that the look and feel should provide decoration for as representing the mnemonic

character.
int getHorizontalAlignment()

Returns the alignment of the label's contents along the X axis.


int getHorizontalTextPosition()

Returns the horizontal position of the label's text, relative to its image.
Icon getIcon()

Returns the graphic image (glyph, icon) that the label displays.
int getIconTextGap()

Returns the amount of space between the text and the icon displayed in this label.
Component getLabelFor()

Get the component this is labelling.


String getText()

Returns the text string that the label displays.


LabelUI getUI()

Returns the L&F object that renders this component.


String getUIClassID()

Returns a string that specifies the name of the l&f class that renders this component.
int getVerticalAlignment()

Returns the alignment of the label's contents along the Y axis.


int getVerticalTextPosition()

Returns the vertical position of the label's text, relative to its image.
boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h)

This is overridden to return false if the current Icon's Image is not equal to the passed in Image img.
protected String paramString()

Returns a string representation of this JLabel.


void setDisabledIcon(Icon disabledIcon)

Set the icon to be displayed if this JLabel is "disabled"

(JLabel.setEnabled(false)).
void setDisplayedMnemonic(char aChar)

Specifies the displayedMnemonic as a char value.


void setDisplayedMnemonic(int key)

Specify a keycode that indicates a mnemonic key.


void setDisplayedMnemonicIndex(int index)

Provides a hint to the look and feel as to which character in the text should be decorated to represent the mnemonic.
void setHorizontalAlignment(int alignment)

Sets the alignment of the label's contents along the X axis.


void setHorizontalTextPosition(int textPosition)

Sets the horizontal position of the label's text, relative to its image.
void setIcon(Icon icon)

Defines the icon this component will display.


void setIconTextGap(int iconTextGap)

If both the icon and text properties are set, this property defines the space between them.
void setLabelFor(Component c)

Set the component this is labelling.


void setText(String text)

Defines the single line of text this component will display.


void setUI(LabelUI ui)

Sets the L&F object that renders this component.


void setVerticalAlignment(int alignment)

Sets the alignment of the label's contents along the Y axis.


void setVerticalTextPosition(int textPosition)

Sets the vertical position of the label's text, relative to its image.
void updateUI()

Resets the UI property to a value from the current look and feel.

JList

Constructor Summary
JList()

Constructs a JList with an empty model.


JList(ListModel dataModel)

Constructs a JList that displays the elements in the specified, non-null model.
JList(Object[] listData)

Constructs a JList that displays the elements in the specified array.


JList(Vector listData)

Constructs a JList that displays the elements in the specified Vector.

Method Summary
void addListSelectionListener(ListSelectionListener list ener)

Adds a listener to the list that's notified each time a change to the selection occurs.
void addSelectionInterval(int anchor, int lead)

Sets the selection to be the union of the specified interval with current selection.
void clearSelection()

Clears the selection - after calling this method isSelectionEmpty will return true.
protected ListSelectionM createSelectionModel() odel

Returns an instance

of DefaultListSelectionModel.
void ensureIndexIsVisible(int index)

Scrolls the viewport to make the specified cell completely visible.


protected void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)

Notifies JList ListSelectionListeners that the selection model has changed.


AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JList.

int getAnchorSelectionIndex()

Returns the first index argument from the most recent addSelectionModel or setSelectionInterval call.
Rectangle getCellBounds(int index0, int index1)

Returns the bounds of the specified range of items in JList coordinates.


ListCellRenderer getCellRenderer()

Returns the object that renders the list items.


boolean getDragEnabled()

Gets the dragEnabled property.


int getFirstVisibleIndex()

Returns the index of the first visible cell.


int getFixedCellHeight()

Returns the fixed cell height value -- the value specified by setting the fixedCellHeight property, rather than that calculated from the list elements.
int getFixedCellWidth()

Returns the fixed cell width value -- the value specified by setting the fixedCellWidth property, rather than that calculated from the list elements.
int getLastVisibleIndex()

Returns the index of the last visible cell.


int getLayoutOrientation()

Returns JList.VERTICAL if the layout is a single column of cells, or JList.VERTICAL_WRAP if the layout is "newspaper style" with the content flowing vertically then horizontally orJList.HORIZONTAL_WRAP if the layout is "newspaper style" with the content flowing horizontally then vertically.
int getLeadSelectionIndex()

Returns the second index argument from the most recent addSelectionInterval or setSelectionInterval ca ll.
ListSelectionListener[] getListSelectionListeners()

Returns an array of all the ListSelectionListeners added to this JList with addListSelectionListener().

int getMaxSelectionIndex()

Returns the largest selected cell index.


int getMinSelectionIndex()

Returns the smallest selected cell index.


ListModel getModel()

Returns the data model that holds the list of items displayed by the JList component.
int getNextMatch(String prefix, int startIndex, Position.Bias bias)

Returns the next list element that starts with a prefix.


Dimension getPreferredScrollableViewportSize()

Computes the size of the viewport needed to display visibleRowCount rows.


Object getPrototypeCellValue()

Returns the cell width of the "prototypical cell" -a cell used for the calculation of cell widths, because it has the same value as all other list items.
int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)

Returns the distance to scroll to expose the next or previous block.


boolean getScrollableTracksViewportHeight()

Returns true if this JList is displayed in a JViewport and the viewport is taller than JList's preferred height, or if the layout orientation is VERTICAL_WRAP and the number of visible rows is <= 0; otherwise returns false.
boolean getScrollableTracksViewportWidth()

Returns true if this JList is displayed in a JViewport and the viewport is wider than JList's preferred width; or if the layout orientation is HORIZONTAL_WRAP and the visible row count is <= 0; otherwise returns false.
int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)

Returns the distance to scroll to expose the next or previous row (for vertical scrolling) or character (for

horizontal scrolling).
int getSelectedIndex()

Returns the first selected index; returns -1 if there is no selected item.


int[] getSelectedIndices()

Returns an array of all of the selected indices in increasing order.


Object getSelectedValue()

Returns the first selected value, or null if the selection is empty.


Object[] getSelectedValues()

Returns an array of the values for the selected cells.


Color getSelectionBackground()

Returns the background color for selected cells.


Color getSelectionForeground()

Returns the selection foreground color.


int getSelectionMode()

Returns whether single-item or multiple-item selections are allowed.


ListSelectionModel getSelectionModel()

Returns the value of the current selection model.


String getToolTipText(MouseEvent event)

Overrides JComponent's getToolTipText method in order to allow the renderer's tips to be used if it has text set.
ListUI getUI()

Returns the look and feel (L&F) object that renders this component.
String getUIClassID()

Returns the suffix used to construct the name of the look and feel (L&F) class used to render this component.
boolean getValueIsAdjusting()

Returns the value of the data model's isAdjusting property.

int getVisibleRowCount()

Returns the preferred number of visible rows.


Point indexToLocation(int index)

Returns the origin of the specified item in JList coordinates.


boolean isSelectedIndex(int index)

Returns true if the specified index is selected.


boolean isSelectionEmpty()

Returns true if nothing is selected.


int locationToIndex(Point location)

Convert a point in JList coordinates to the closest index of the cell at that location.
protected String paramString()

Returns a string representation of this JList.


void removeListSelectionListener(ListSelectionListener l istener)

Removes a listener from the list that's notified each time a change to the selection occurs.
void removeSelectionInterval(int index0, int index1)

Sets the selection to be the set difference of the specified interval and the current selection.
void setCellRenderer(ListCellRenderer cellRenderer)

Sets the delegate that's used to paint each cell in the list.
void setDragEnabled(boolean b)

Sets the dragEnabled property, which must be true to enable automatic drag handling (the first part of drag and drop) on this component.
void setFixedCellHeight(int height)

Sets the height of every cell in the list.


void setFixedCellWidth(int width)

Sets the width of every cell in the list.


void setLayoutOrientation(int layoutOrientation)

Defines the way list cells are layed out.


void setListData(Object[] listData)

Constructs a ListModel from an array of objects

and then applies setModel to it.


void setListData(Vector listData)

Constructs a ListModel from a Vector and then applies setModel to it.


void setModel(ListModel model)

Sets the model that represents the contents or "value" of the list and clears the list selection after notifying PropertyChangeListeners.
void setPrototypeCellValue(Object prototypeCellValue)

Computes the fixedCellWidth and fixedCellHeight properties by configuring the cellRenderer to index equals zero for the specified value and then computing the renderer component's preferred size.
void setSelectedIndex(int index)

Selects a single cell.


void setSelectedIndices(int[] indices)

Selects a set of cells.


void setSelectedValue(Object anObject, boolean shouldScroll)

Selects the specified object from the list.


void setSelectionBackground(Color selectionBackground)

Sets the background color for selected cells.


void setSelectionForeground(Color selectionForeground)

Sets the foreground color for selected cells.


void setSelectionInterval(int anchor, int lead)

Selects the specified interval.


void setSelectionMode(int selectionMode)

Determines whether single-item or multiple-item selections are allowed.


void setSelectionModel(ListSelectionModel selectionModel ) null ListSelectionModel void setUI(ListUI ui)

Sets the selectionModel for the list to a nonimplementation.

Sets the look and feel (L&F) object that renders this component.

void setValueIsAdjusting(boolean b)

Sets the data model's isAdjusting property to true, so that a single event will be generated when all of the selection events have finished (for example, when the mouse is being dragged over the list in selection mode).
void setVisibleRowCount(int visibleRowCount)

Sets the preferred number of rows in the list that can be displayed without a scrollbar, as determined by the nearest JViewport ancestor, if any.
void updateUI()

Resets the UI property with the value from the current look and feel.

JMenu

Constructor Summary
JMenu()

Constructs a new JMenu with no text.


JMenu(Action a)

Constructs a menu whose properties are taken from the Action supplied.
JMenu(String s)

Constructs a new JMenu with the supplied string as its text.


JMenu(String s, boolean b)

Constructs a new JMenu with the supplied string as its text and specified as a tear-off menu or not.

Method Summary
JMenuItem add(Action a)

Creates a new menu item attached to the specified Action object and appends it to the end of this menu.
Component add(Component c)

Appends a component to the end of this menu.


Component add(Component c, int index)

Adds the specified component to this container at the given position.


JMenuItem add(JMenuItem menuItem)

Appends a menu item to the end of this menu.


JMenuItem add(String s)

Creates a new menu item with the specified text and appends it to the end of this menu.
void addMenuListener(MenuListener l)

Adds a listener for menu events.


void addSeparator()

Appends a new separator to the end of the menu.


void applyComponentOrientation(ComponentOrientation

o)

Sets the ComponentOrientation property of this menu and all components contained within it.
protected void configurePropertiesFromAction(Action a)

Factory method which sets the ActionEvent source's properties according to values from the Action instance.
protected PropertyChangeListe createActionChangeListener(JMenuItem b) ner

Returns a properly configured PropertyChangeListener which updates the control as changes to the Action occur. Factory method which creates the JMenuItem for Actions added to the JMenu.

protected

JMenuItem createActionComponent(Action a)

protected

JMenu.WinListener createWinListener(JPopupMenu p)

Creates a window-closing listener for the popup.


void doClick(int pressTime)

Programmatically performs a "click".


protected void fireMenuCanceled()

Notifies all listeners that have registered interest for notification on this event type.
protected void fireMenuDeselected()

Notifies all listeners that have registered interest for notification on this event type.
protected void fireMenuSelected()

Notifies all listeners that have registered interest for notification on this event type.
AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JMenu.


Component getComponent()

Returns the java.awt.Component used to paint this MenuElement.


int getDelay()

Returns the suggested delay, in milliseconds,

before submenus are popped up or down.


JMenuItem getItem(int pos)

Returns the JMenuItem at the specified position.


int getItemCount()

Returns the number of items on the menu, including separators.


Component getMenuComponent(int n)

Returns the component at position n.


int getMenuComponentCount()

Returns the number of components on the menu.


Component[] getMenuComponents()

Returns an array of Components of the menu's subcomponents.


MenuListener[] getMenuListeners()

Returns an array of all the MenuListeners added to this JMenu with addMenuListener().
JPopupMenu getPopupMenu()

Returns the popupmenu associated with this menu.


protected Point getPopupMenuOrigin()

Computes the origin for the JMenu's popup menu.


MenuElement[] getSubElements()

Returns an array of MenuElements containing the submenu for this menu component.
String getUIClassID()

Returns the name of the L&F class that renders this component.
JMenuItem insert(Action a, int pos)

Inserts a new menu item attached to the specified Action object at a given position.
JMenuItem insert(JMenuItem mi, int pos)

Inserts the specified JMenuitem at a given position.

void insert(String s, int pos)

Inserts a new menu item with the specified text at a given position.
void insertSeparator(int index)

Inserts a separator at the specified position.


boolean isMenuComponent(Component c)

Returns true if the specified component exists in the submenu hierarchy.


boolean isPopupMenuVisible()

Returns true if the menu's popup window is visible.


boolean isSelected()

Returns true if the menu is currently selected (highlighted).


boolean isTearOff()

Returns true if the menu can be torn off.


boolean isTopLevelMenu()

Returns true if the menu is a 'top-level menu', that is, if it is the direct child of a menubar.
void menuSelectionChanged(boolean isIncluded)

Messaged when the menubar selection changes to activate or deactivate this menu.
protected String paramString()

Returns a string representation of this JMenu.


protected void processKeyEvent(KeyEvent evt)

Processes key stroke events such as mnemonics and accelerators.


void remove(Component c)

Removes the component c from this menu.


void remove(int pos)

Removes the menu item at the specified index from this menu.
void remove(JMenuItem item)

Removes the specified menu item from this menu.


void removeAll()

Removes all menu items from this menu.


void removeMenuListener(MenuListener l)

Removes a listener for menu events.


void setAccelerator(KeyStroke keyStroke) setAccelerator )

is not defined for JMenu.

void setComponentOrientation(ComponentOrientation o

Sets the language-sensitive orientation that is to be used to order the elements or text within this component.
void setDelay(int d)

Sets the suggested delay before the menu's PopupMenu is popped up or down.
void setMenuLocation(int x, int y)

Sets the location of the popup component.


void setModel(ButtonModel newModel)

Sets the data model for the "menu button" -the label that the user clicks to open or close the menu.
void setPopupMenuVisible(boolean b)

Sets the visibility of the menu's popup.


void setSelected(boolean b)

Sets the selection status of the menu.


void updateUI()

Resets the UI property with a value from the current look and feel.

JMenuBar

Constructor Summary
JMenuBar()

Creates a new menu bar.

Method Summary
JMenu add(JMenu c)

Appends the specified menu to the end of the menu bar.


void addNotify()

Overrides JComponent.addNotify to register this menu bar with the current keyboard manager.
AccessibleCont getAccessibleContext() ext Component getComponent()

Gets the AccessibleContext associated with this JMenuBar. Implemented to be a MenuElement.

Component getComponentAtIndex(int i)

Deprecated. replaced by getComponent(int


int getComponentIndex(Component c)

i)

Returns the index of the specified component.


JMenu getHelpMenu()

Gets the help menu for the menu bar.


Insets getMargin()

Returns the margin between the menubar's border and its menus.
JMenu getMenu(int index)

Returns the menu at the specified position in the menu bar.


int getMenuCount()

Returns the number of items in the menu bar.


SingleSelectio getSelectionModel() nModel MenuElement[] getSubElements()

Returns the model object that handles single selections.

Implemented to be a MenuElement -- returns the menus in this menu bar.


MenuBarUI getUI()

Returns the menubar's current UI.


String getUIClassID()

Returns the name of the L&F class that renders this component.
boolean isBorderPainted()

Returns true if the menu bars border should be painted.


boolean isSelected()

Returns true if the menu bar currently has a component selected.


void menuSelectionChanged(boolean isIncluded)

Implemented to be a MenuElement
protected void paintBorder(Graphics g)

-- does nothing.

Paints the menubar's border if BorderPainted property is true.


protected Stri paramString() ng

Returns a string representation of this JMenuBar.

protected

bool processKeyBinding(KeyStroke ks, KeyEvent e, int condition, ean boolean pressed)

Subclassed to check all the child menus.


void processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelection Manager manager)

Implemented to be a MenuElement -- does nothing.


void processMouseEvent(MouseEvent event, MenuElement[] path, MenuS electionManager manager)

Implemented to be a MenuElement -- does nothing.


void removeNotify()

Overrides JComponent.removeNotify to unregister this menu bar with the current keyboard manager.
void setBorderPainted(boolean b)

Sets whether the border should be painted.


void setHelpMenu(JMenu menu)

Sets the help menu that appears when the user selects the "help" option in the menu bar.
void setMargin(Insets m)

Sets the margin between the menubar's border and its menus.
void setSelected(Component sel)

Sets the currently selected component, producing a a change

to the selection model.


void setSelectionModel(SingleSelectionModel model)

Sets the model object to handle single selections.


void setUI(MenuBarUI ui)

Sets the L&F object that renders this component.


void updateUI()

Resets the UI property with a value from the current look and feel.

JMenuItem

Constructor Summary
JMenuItem()

Creates a JMenuItem with no set text or icon.


JMenuItem(Action a)

Creates a menu item whose properties are taken from the specified Action.
JMenuItem(Icon icon)

Creates a JMenuItem with the specified icon.


JMenuItem(String text)

Creates a JMenuItem with the specified text.


JMenuItem(String text, Icon icon)

Creates a JMenuItem with the specified text and icon.


JMenuItem(String text, int mnemonic)

Creates a JMenuItem with the specified text and keyboard mnemonic.

Method Summary
void addMenuDragMouseListener(MenuDragMouseListener l)

Adds a MenuDragMouseListener to the menu item.


void addMenuKeyListener(MenuKeyListener l)

Adds a MenuKeyListener to the menu item.


protected void configurePropertiesFromAction(Action a)

Factory method which sets the ActionEvent source's properties according to values from the Action instance.
protected PropertyCha createActionPropertyChangeListener(Action a) ngeListener

Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance.

protected

void fireMenuDragMouseDragged(MenuDragMouseEvent event)

Notifies all listeners that have registered interest for notification on this event type.
protected void fireMenuDragMouseEntered(MenuDragMouseEvent event)

Notifies all listeners that have registered interest for notification on this event type.

protected

void fireMenuDragMouseExited(MenuDragMouseEvent event)

Notifies all listeners that have registered interest for notification on this event type.
protected void fireMenuDragMouseReleased(MenuDragMouseEvent event)

Notifies all listeners that have registered interest for notification on this event type.
protected void fireMenuKeyPressed(MenuKeyEvent event)

Notifies all listeners that have registered interest for notification on this event type.
protected void fireMenuKeyReleased(MenuKeyEvent event)

Notifies all listeners that have registered interest for notification on this event type.
protected void fireMenuKeyTyped(MenuKeyEvent event)

Notifies all listeners that have registered interest for notification on this event type.
KeyStroke getAccelerator()

Returns the KeyStroke which serves as an accelerator for the menu item.
AccessibleContext getAccessibleContext()

Returns the AccessibleContext associated with this JMenuItem.


Component getComponent()

Returns the java.awt.Component used to paint this object.


MenuDragMouseListener getMenuDragMouseListeners() []

Returns an array of all the MenuDragMouseListeners added to this JMenuItem with addMenuDragMouseListener(). Returns an array of all the MenuKeyListeners added to this JMenuItem with addMenuKeyListener().

MenuKeyListener[] getMenuKeyListeners()

MenuElement[] getSubElements()

This method returns an array containing the sub-menu components for this menu component.
String getUIClassID()

Returns the suffix used to construct the name of the

L&F class used to render this component.


protected void init(String text, Icon icon)

Initializes the menu item with the specified text and icon.
boolean isArmed()

Returns whether the menu item is "armed".


void menuSelectionChanged(boolean isIncluded)

Called by the MenuSelectionManager when the MenuElement is selected or unselected.


protected String paramString()

Returns a string representation of this JMenuItem.


void processKeyEvent(KeyEvent e, MenuElement[] path, MenuSe lectionManager manager)

Processes a key event forwarded from the MenuSelectionManager and changes the menu selection, if necessary, by using MenuSelectionManager's API.
void processMenuDragMouseEvent(MenuDragMouseEvent e)

Handles mouse drag in a menu.


void processMenuKeyEvent(MenuKeyEvent e)

Handles a keystroke in a menu.


void processMouseEvent(MouseEvent e, MenuElement[] path, Me nuSelectionManager manager)

Processes a mouse event forwarded from the MenuSelectionManager and changes the menu selection, if necessary, by using the MenuSelectionManager's API.
void removeMenuDragMouseListener(MenuDragMouseListener l)

Removes a MenuDragMouseListener from the menu item.


void removeMenuKeyListener(MenuKeyListener l)

Removes a MenuKeyListener from the menu item.


void setAccelerator(KeyStroke keyStroke)

Sets the key combination which invokes the menu item's action listeners without navigating the menu hierarchy.
void setArmed(boolean b)

Identifies the menu item as "armed".

void setEnabled(boolean b)

Enables or disables the menu item.


void setUI(MenuItemUI ui)

Sets the look and feel object that renders this component.
void updateUI()

Resets the UI property with a value from the current look and feel.

JPanel

Constructor Summary
JPanel()

Creates a new JPanel with a double buffer and a flow layout.


JPanel(boolean isDoubleBuffered)

Creates a new JPanel with FlowLayout and the specified buffering strategy.
JPanel(LayoutManager layout)

Create a new buffered JPanel with the specified layout manager


JPanel(LayoutManager layout, boolean isDoubleBuffered)

Creates a new JPanel with the specified layout manager and buffering strategy.

Method Summary
AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JPanel.


PanelUI getUI()

Returns the look and feel (L&F) object that renders this component.
String getUIClassID()

Returns a string that specifies the name of the L&F class that renders this component.
protected String paramString()

Returns a string representation of this JPanel.


void setUI(PanelUI ui)

Sets the look and feel (L&F) object that renders this component.
void updateUI()

Resets the UI property with a value from the current look and feel.

JRadioButton

Constructor Summary
JRadioButton()

Creates an initially unselected radio button with no set text.


JRadioButton(Action a)

Creates a radiobutton where properties are taken from the Action supplied.
JRadioButton(Icon icon)

Creates an initially unselected radio button with the specified image but no text.
JRadioButton(Icon icon, boolean selected)

Creates a radio button with the specified image and selection state, but no text.
JRadioButton(String text)

Creates an unselected radio button with the specified text.


JRadioButton(String text, boolean selected)

Creates a radio button with the specified text and selection state.
JRadioButton(String text, Icon icon)

Creates a radio button that has the specified text and image, and that is initially unselected.
JRadioButton(String text, Icon icon, boolean selected)

Creates a radio button that has the specified text, image, and selection state.

Method Summary
protected void configurePropertiesFromAction(Action a)

Factory method which sets the ActionEvent source's properties according to values from the Action instance.
protected PropertyChangeListene createActionPropertyChangeListener(Action a) r

Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance.
AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated

with this JRadioButton.


String getUIClassID()

Returns the name of the L&F class that renders this component.
protected String paramString()

Returns a string representation of this JRadioButton.


void updateUI()

Resets the UI property to a value from the current look and feel.

JRadioButtonMenuItem

Constructor Summary
JRadioButtonMenuItem()

Creates a JRadioButtonMenuItem with no set text or icon.


JRadioButtonMenuItem(Action a)

Creates a radio button menu item whose properties are taken from the Action supplied.
JRadioButtonMenuItem(Icon icon)

Creates a JRadioButtonMenuItem with an icon.


JRadioButtonMenuItem(Icon icon, boolean selected)

Creates a radio button menu item with the specified image and selection state, but no text.
JRadioButtonMenuItem(String text)

Creates a JRadioButtonMenuItem with text.


JRadioButtonMenuItem(String text, boolean selected)

Creates a radio button menu item with the specified text and selection state.
JRadioButtonMenuItem(String text, Icon icon)

Creates a radio button menu item with the specified text and Icon.
JRadioButtonMenuItem(String text, Icon icon, boolean selected)

Creates a radio button menu item that has the specified text, image, and selection state.

Method Summary
AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JRadioButtonMenuItem.


String getUIClassID()

Returns the name of the L&F class that renders this component.
protected String paramString()

Returns a string representation of this JRadioButtonMenuItem.

JPopupMenu

Constructor Summary
JPopupMenu()

Constructs a JPopupMenu without an "invoker".


JPopupMenu(String label)

Constructs a JPopupMenu with the specified title.

Method Summary
JMenuItem add(Action a)

Appends a new menu item to the end of the menu which dispatches the specified Action object.
JMenuItem add(JMenuItem menuItem)

Appends the specified menu item to the end of this menu.


JMenuItem add(String s)

Creates a new menu item with the specified text and appends it to the end of this menu.
void addPopupMenuListener(PopupMenuListener l)

Adds a PopupMenu listener.


void addSeparator()

Appends a new separator at the end of the menu.


protected PropertyCh createActionChangeListener(JMenuItem b) angeListener

Returns a properly configured PropertyChangeListener which updates the control as changes to the Action occur. Factory method which creates the JMenuItem for Actions added to the JPopupMenu.

protected

JMenuItem createActionComponent(Action a)

protected

void firePopupMenuCanceled()

Notifies PopupMenuListeners that this popup menu is cancelled.


protected void firePopupMenuWillBecomeInvisible()

Notifies PopupMenuListeners that this popup menu will become invisible.


protected void firePopupMenuWillBecomeVisible()

Notifies PopupMenuListeners that this popup menu will become visible.


AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JPopupMenu.


Component getComponent()

Returns this JPopupMenu component.


Component getComponentAtIndex(int i)

Deprecated. replaced by getComponent(int


int getComponentIndex(Component c)

i)

Returns the index of the specified component.


static boolean getDefaultLightWeightPopupEnabled()

Gets the defaultLightWeightPopupEnabled property, which by default is true.


Component getInvoker()

Returns the component which is the 'invoker' of this popup menu.


String getLabel()

Returns the popup menu's label


Insets getMargin()

Returns the margin, in pixels, between the popup menu's border and its containees.
PopupMenuListener[] getPopupMenuListeners()

Returns an array of all the PopupMenuListeners added to this JMenuItem with addPopupMenuListener().
SingleSelectionModel getSelectionModel()

Returns the model object that handles single selections.


MenuElement[] getSubElements()

Returns an array of MenuElements containing the submenu for this menu component.
PopupMenuUI getUI()

Returns the look and feel (L&F) object that renders this component.
String getUIClassID()

Returns the name of the L&F class that renders this component.

void insert(Action a, int index)

Inserts a menu item for the specified Action object at a given position.
void insert(Component component, int index)

Inserts the specified component into the menu at a given position.


boolean isBorderPainted()

Checks whether the border should be painted.


boolean isLightWeightPopupEnabled()

Gets the lightWeightPopupEnabled property.


boolean isPopupTrigger(MouseEvent e)

Returns true if the MouseEvent is considered a popup trigger by the JPopupMenu's currently installed UI.
boolean isVisible()

Returns true if the popup menu is visible (currently being displayed).


void menuSelectionChanged(boolean isIncluded)

Messaged when the menubar selection changes to activate or deactivate this menu.
void pack()

Lays out the container so that it uses the minimum space needed to display its contents.
protected void paintBorder(Graphics g)

Paints the popup menu's border if the borderPainted property is true.


protected String paramString()

Returns a string representation of this JPopupMenu.


protected void processFocusEvent(FocusEvent evt)

Processes focus events occurring on this component by dispatching them to any registered FocusListener objects.
protected void processKeyEvent(KeyEvent evt)

Processes key stroke events such as mnemonics and accelerators.


void processKeyEvent(KeyEvent e, MenuElement[] path, MenuSel ectionManager manager)

This method is required to conform to

the MenuElement interface, but it not implemented.


void processMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager)

This method is required to conform to the MenuElement interface, but it not implemented.
void remove(int pos)

Removes the component at the specified index from this popup menu.
void removePopupMenuListener(PopupMenuListener l)

Removes a PopupMenu listener.


void setBorderPainted(boolean b)

Sets whether the border should be painted.


static void setDefaultLightWeightPopupEnabled(boolean aFlag)

Sets the default value of the lightWeightPopupEnabled property.


void setInvoker(Component invoker)

Sets the invoker of this popup menu -- the component in which the popup menu menu is to be displayed.
void setLabel(String label)

Sets the popup menu's label.


void setLightWeightPopupEnabled(boolean aFlag)

Sets the value of the lightWeightPopupEnabled property, which by default is true.


void setLocation(int x, int y)

Sets the location of the upper left corner of the popup menu using x, y coordinates.
void setPopupSize(Dimension d)

Sets the size of the Popup window using a Dimension object.


void setPopupSize(int width, int height)

Sets the size of the Popup window to the specified width and height.
void setSelected(Component sel)

Sets the currently selected component, This will result in a change to the selection model.

void setSelectionModel(SingleSelectionModel model)

Sets the model object to handle single selections.


void setUI(PopupMenuUI ui)

Sets the L&F object that renders this component.


void setVisible(boolean b)

Sets the visibility of the popup menu.


void show(Component invoker, int x, int y)

Displays the popup menu at the position x,y in the coordinate space of the component invoker.
void updateUI()

Resets the UI property to a value from the current look and feel.

JTable

Constructor Summary
JTable()

Constructs a default JTable that is initialized with a default data model, a default column model, and a default selection model.
JTable(int numRows, int numColumns)

Constructs a JTable with numRows and numColumns of empty cells using DefaultTableModel.
JTable(Object[][] rowData, Object[] columnNames)

Constructs a JTable to display the values in the two dimensional array, rowData, with column names, columnNames.
JTable(TableModel dm)

Constructs a JTable that is initialized with dm as the data model, a default column model, and a default selection model.
JTable(TableModel dm, TableColumnModel cm)

Constructs a JTable that is initialized with dm as the data model, cm as the column model, and a default selection model.
JTable(TableModel dm, TableColumnModel cm, ListSelectionModel sm)

Constructs a JTable that is initialized with dm as the data model, cm as the column model, and sm as the selection model.
JTable(Vector rowData, Vector columnNames)

Constructs a JTable to display the values in the Vector of Vectors, rowData, with column names, columnNames.

Method Summary
void addColumn(TableColumn aColumn)

Appends aColumn to the end of the array of columns held by this JTable's column model.
void addColumnSelectionInterval(int index0, int index1)

Adds the columns from index0 to index1, inclusive, to the current selection.
void addNotify()

Calls the configureEnclosingScrollPane method.


void addRowSelectionInterval(int index0, int index1)

Adds the rows from index0 to index1, inclusive, to

the current selection.


void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)

Updates the selection models of the table, depending on the state of the two flags: toggle and extend.
void clearSelection()

Deselects all selected columns and rows.


void columnAdded(TableColumnModelEvent e)

Invoked when a column is added to the table column model.


int columnAtPoint(Point point)

Returns the index of the column that point lies in, or -1 if the result is not in the range [0, getColumnCount()-1].
void columnMarginChanged(ChangeEvent e)

Invoked when a column is moved due to a margin change.


void columnMoved(TableColumnModelEvent e)

Invoked when a column is repositioned.


void columnRemoved(TableColumnModelEvent e)

Invoked when a column is removed from the table column model.


void columnSelectionChanged(ListSelectionEvent e)

Invoked when the selection model of the TableColumnModel is changed.


protected void configureEnclosingScrollPane()

If this JTable is the viewportView of an enclosing JScrollPane (the usual situation), configure this ScrollPane by, amongst other things, installing the table's tableHeader as thecolumnHeaderView of the scroll pane.
int convertColumnIndexToModel(int viewColumnIndex)

Maps the index of the column in the view at viewColumnIndex to the index of the column in the table model.
int convertColumnIndexToView(int modelColumnIndex)

Maps the index of the column in the table model at modelColumnIndex to the index of the column in the

view.
protected TableColumnM createDefaultColumnModel() odel

Returns the default column model object, which is a DefaultTableColumnModel. Creates default columns for the table from the data model using the getColumnCount method defined in the TableModel interface.

void createDefaultColumnsFromModel()

protected

TableModel createDefaultDataModel()

Returns the default table model object, which is a DefaultTableModel.


protected void createDefaultEditors()

Creates default cell editors for objects, numbers, and boolean values.
protected void createDefaultRenderers()

Creates default cell renderers for objects, numbers, doubles, dates, booleans, and icons.
protected ListSelectio createDefaultSelectionModel() nModel

Returns the default selection model object, which is a DefaultListSelectionModel. Returns the default table header object, which is a JTableHeader.

protected

JTableHeader createDefaultTableHeader()

static JScrollPane createScrollPaneForTable(JTable aTable)

Deprecated. As of Swing version 1.0.2, replaced by new JScrollPane(aTable).


void doLayout()

Causes this table to lay out its rows and columns.


boolean editCellAt(int row, int column)

Programmatically starts editing the cell at row and column, if the cell is editable.
boolean editCellAt(int row, int column, EventObject e)

Programmatically starts editing the cell at row and column, if the cell is editable.
void editingCanceled(ChangeEvent e)

Invoked when editing is canceled.

void editingStopped(ChangeEvent e)

Invoked when editing is finished.


AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JTable.


boolean getAutoCreateColumnsFromModel()

Determines whether the table will create default columns from the model.
int getAutoResizeMode()

Returns the auto resize mode of the table.


TableCellEditor getCellEditor()

Returns the cell editor.


TableCellEditor getCellEditor(int row, int column)

Returns an appropriate editor for the cell specified by row and column.
Rectangle getCellRect(int row, int column, boolean includeSpacing)

Returns a rectangle for the cell that lies at the intersection of row and column.
TableCellRenderer getCellRenderer(int row, int column)

Returns an appropriate renderer for the cell specified by this row and column.
boolean getCellSelectionEnabled()

Returns true if both row and column selection models are enabled.
TableColumn getColumn(Object identifier)

Returns the TableColumn object for the column in the table whose identifier is equal to identifier, when compared using equals.
Class getColumnClass(int column)

Returns the type of the column appearing in the view at column position column.
int getColumnCount()

Returns the number of columns in the column model.


TableColumnModel getColumnModel()

Returns the TableColumnModel that contains all column information of this table.
String getColumnName(int column)

Returns the name of the column appearing in the view at column position column.
boolean getColumnSelectionAllowed()

Returns true if columns can be selected.


TableCellEditor getDefaultEditor(Class columnClass)

Returns the editor to be used when no editor has been set in a TableColumn.
TableCellRenderer getDefaultRenderer(Class columnClass)

Returns the cell renderer to be used when no renderer has been set in a TableColumn.
boolean getDragEnabled()

Gets the value of the dragEnabled property.


int getEditingColumn()

Returns the index of the column that contains the cell currently being edited.
int getEditingRow()

Returns the index of the row that contains the cell currently being edited.
Component getEditorComponent()

Returns the component that is handling the editing session.


Color getGridColor()

Returns the color used to draw grid lines.


Dimension getIntercellSpacing()

Returns the horizontal and vertical space between cells.


TableModel getModel()

Returns the TableModel that provides the data displayed by this JTable.
Dimension getPreferredScrollableViewportSize()

Returns the preferred size of the viewport for this table.


int getRowCount()

Returns the number of rows in this table's model.


int getRowHeight()

Returns the height of a table row, in pixels.


int getRowHeight(int row)

Returns the height, in pixels, of the cells in row.


int getRowMargin()

Gets the amount of empty space, in pixels, between cells.


boolean getRowSelectionAllowed()

Returns true if rows can be selected.


int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)

Returns visibleRect.height or visibleRect.width, depending on this table's orientation.


boolean getScrollableTracksViewportHeight()

Returns false to indicate that the height of the viewport does not determine the height of the table.
boolean getScrollableTracksViewportWidth()

Returns false if autoResizeMode is set to AUTO_RESIZE_OFF, which indicates that the width of the viewport does not determine the width of the table.
int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)

Returns the scroll increment (in pixels) that completely exposes one new row or column (depending on the orientation).
int getSelectedColumn()

Returns the index of the first selected column, -1 if no column is selected.


int getSelectedColumnCount()

Returns the number of selected columns.


int[] getSelectedColumns()

Returns the indices of all selected columns.


int getSelectedRow()

Returns the index of the first selected row, -1 if no row is selected.

int getSelectedRowCount()

Returns the number of selected rows.


int[] getSelectedRows()

Returns the indices of all selected rows.


Color getSelectionBackground()

Returns the background color for selected cells.


Color getSelectionForeground()

Returns the foreground color for selected cells.


ListSelectionModel getSelectionModel()

Returns the ListSelectionModel that is used to maintain row selection state.


boolean getShowHorizontalLines()

Returns true if the table draws horizontal lines between cells, false if it doesn't.
boolean getShowVerticalLines()

Returns true if the table draws vertical lines between cells, false if it doesn't.
boolean getSurrendersFocusOnKeystroke()

Returns true if the editor should get the focus when keystrokes cause the editor to be activated
JTableHeader getTableHeader()

Returns the tableHeader used by this JTable.


String getToolTipText(MouseEvent event)

Overrides JComponent's getToolTipText method in order to allow the renderer's tips to be used if it has text set.
TableUI getUI()

Returns the L&F object that renders this component.


String getUIClassID()

Returns the suffix used to construct the name of the L&F class used to render this component.
Object getValueAt(int row, int column)

Returns the cell value at row and column.


protected void initializeLocalVars()

Initializes table properties to their default values.

boolean isCellEditable(int row, int column)

Returns true if the cell at row and column is editable.


boolean isCellSelected(int row, int column)

Returns true if the cell at the specified position is selected.


boolean isColumnSelected(int column)

Returns true if the column at the specified index is selected.


boolean isEditing()

Returns true if a cell is being edited.


boolean isRowSelected(int row)

Returns true if the row at the specified index is selected.


void moveColumn(int column, int targetColumn)

Moves the column column to the position currently occupied by the column targetColumn in the view.
protected String paramString()

Returns a string representation of this table.


Component prepareEditor(TableCellEditor editor, int row, int column)

Prepares the editor by querying the data model for the value and selection state of the cell at row, column.
Component prepareRenderer(TableCellRenderer renderer, int row, int column)

Prepares the renderer by querying the data model for the value and selection state of the cell at row, column.
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed)

Invoked to process the key bindings for ks as the result of the KeyEvent e.
void removeColumn(TableColumn aColumn)

Removes aColumn from this JTable's array of columns.


void removeColumnSelectionInterval(int index0, int index1)

Deselects the columns from index0 to index1, inclusive.

void removeEditor()

Discards the editor object and frees the real estate it used for cell rendering.
void removeNotify()

Calls the unconfigureEnclosingScrollPane method.


void removeRowSelectionInterval(int index0, int index1)

Deselects the rows from index0 to index1, inclusive.


protected void resizeAndRepaint()

Equivalent to revalidate followed by repaint.


int rowAtPoint(Point point)

Returns the index of the row that point lies in, or -1 if the result is not in the range [0, getRowCount()-1].
void selectAll()

Selects all rows, columns, and cells in the table.


void setAutoCreateColumnsFromModel(boolean autoCreateColum nsFromModel)

Sets this table's autoCreateColumnsFromModel flag.


void setAutoResizeMode(int mode)

Sets the table's auto resize mode when the table is resized.
void setCellEditor(TableCellEditor anEditor)

Sets the cellEditor variable.


void setCellSelectionEnabled(boolean cellSelectionEnabled)

Sets whether this table allows both a column selection and a row selection to exist simultaneously.
void setColumnModel(TableColumnModel columnModel)

Sets the column model for this table to newModel and registers for listener notifications from the new column model.
void setColumnSelectionAllowed(boolean columnSelectionAllo wed)

Sets whether the columns in this model can be selected.


void setColumnSelectionInterval(int index0, int index1)

Selects the columns from index0 to index1, inclusive.

void setDefaultEditor(Class columnClass, TableCellEditor e ditor)

Sets a default cell editor to be used if no editor has been set in a TableColumn.
void setDefaultRenderer(Class columnClass, TableCellRender er renderer)

Sets a default cell renderer to be used if no renderer has been set in a TableColumn.
void setDragEnabled(boolean b)

Sets the dragEnabled property, which must be true to enable automatic drag handling (the first part of drag and drop) on this component.
void setEditingColumn(int aColumn)

Sets the editingColumn variable.


void setEditingRow(int aRow)

Sets the editingRow variable.


void setGridColor(Color gridColor)

Sets the color used to draw grid lines to gridColor and redisplays.
void setIntercellSpacing(Dimension intercellSpacing)

Sets the rowMargin and the columnMargin -- the height and width of the space between cells -to intercellSpacing.
void setModel(TableModel dataModel)

Sets the data model for this table to newModel and registers with it for listener notifications from the new data model.
void setPreferredScrollableViewportSize(Dimension size)

Sets the preferred size of the viewport for this table.


void setRowHeight(int rowHeight)

Sets the height, in pixels, of all cells to rowHeight, revalidates, and repaints.
void setRowHeight(int row, int rowHeight)

Sets the height for row to rowHeight, revalidates, and repaints.


void setRowMargin(int rowMargin)

Sets the amount of empty space between cells in

adjacent rows.
void setRowSelectionAllowed(boolean rowSelectionAllowed)

Sets whether the rows in this model can be selected.


void setRowSelectionInterval(int index0, int index1)

Selects the rows from index0 to index1, inclusive.


void setSelectionBackground(Color selectionBackground)

Sets the background color for selected cells.


void setSelectionForeground(Color selectionForeground)

Sets the foreground color for selected cells.


void setSelectionMode(int selectionMode)

Sets the table's selection mode to allow only single selections, a single contiguous interval, or multiple intervals.
void setSelectionModel(ListSelectionModel newModel)

Sets the row selection model for this table to newModel and registers for listener notifications from the new selection model.
void setShowGrid(boolean showGrid)

Sets whether the table draws grid lines around cells.


void setShowHorizontalLines(boolean showHorizontalLines)

Sets whether the table draws horizontal lines between cells.


void setShowVerticalLines(boolean showVerticalLines)

Sets whether the table draws vertical lines between cells.


void setSurrendersFocusOnKeystroke(boolean surrendersFocus OnKeystroke)

Sets whether editors in this JTable get the keyboard focus when an editor is activated as a result of the JTable forwarding keyboard events for a cell.
void setTableHeader(JTableHeader tableHeader)

Sets the tableHeader working with this JTable to newHeader.


void setUI(TableUI ui)

Sets the L&F object that renders this component and repaints.

void setValueAt(Object aValue, int row, int column)

Sets the value for the cell in the table model at row and column.
void sizeColumnsToFit(boolean lastColumnOnly)

Deprecated. As of Swing version 1.0.3, replaced by doLayout().


void sizeColumnsToFit(int resizingColumn)

Obsolete as of Java 2 platform v1.4.


void tableChanged(TableModelEvent e)

Invoked when this table's TableModel generates a TableModelEvent.


protected void unconfigureEnclosingScrollPane()

Reverses the effect of configureEnclosingScrollPane by replacing the columnHeaderView of the enclosing scroll pane with null.
void updateUI()

Notification from the UIManager that the L&F has changed.


void valueChanged(ListSelectionEvent e)

Invoked when the row selection changes -- repaints to show the new selection.

JTextArea

Constructor Summary
JTextArea()

Constructs a new TextArea.


JTextArea(Document doc)

Constructs a new JTextArea with the given document model, and defaults for all of the other arguments (null, 0, 0).
JTextArea(Document doc, String text, int rows, int columns)

Constructs a new JTextArea with the specified number of rows and columns, and the given model.
JTextArea(int rows, int columns)

Constructs a new empty TextArea with the specified number of rows and columns.
JTextArea(String text)

Constructs a new TextArea with the specified text displayed.


JTextArea(String text, int rows, int columns)

Constructs a new TextArea with the specified text and number of rows and columns.

Method Summary
void append(String str)

Appends the given text to the end of the document.


protected Document createDefaultModel()

Creates the default implementation of the model to be used at construction if one isn't explicitly given.
AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JTextArea.


int getColumns()

Returns the number of columns in the TextArea.


protected int getColumnWidth()

Gets column width.


int getLineCount()

Determines the number of lines contained in the area.

int getLineEndOffset(int line)

Determines the offset of the end of the given line.


int getLineOfOffset(int offset)

Translates an offset into the components text to a line number.


int getLineStartOffset(int line)

Determines the offset of the start of the given line.


boolean getLineWrap()

Gets the line-wrapping policy of the text area.


Dimension getPreferredScrollableViewportSize()

Returns the preferred size of the viewport if this component is embedded in a JScrollPane.
Dimension getPreferredSize()

Returns the preferred size of the TextArea.


protected int getRowHeight()

Defines the meaning of the height of a row.


int getRows()

Returns the number of rows in the TextArea.


boolean getScrollableTracksViewportWidth()

Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport.
int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)

Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation.
int getTabSize()

Gets the number of characters used to expand tabs.


String getUIClassID()

Returns the class ID for the UI.


boolean getWrapStyleWord()

Gets the style of wrapping used if the text area is wrapping lines.
void insert(String str, int pos)

Inserts the specified text at the specified position.


protected String paramString()

Returns a string representation of this JTextArea.


void replaceRange(String str, int start, int end)

Replaces text from the indicated start to end position with the new text specified.
void setColumns(int columns)

Sets the number of columns for this TextArea.


void setFont(Font f)

Sets the current font.


void setLineWrap(boolean wrap)

Sets the line-wrapping policy of the text area.


void setRows(int rows)

Sets the number of rows for this TextArea.


void setTabSize(int size)

Sets the number of characters to expand tabs to.


void setWrapStyleWord(boolean word)

Sets the style of wrapping used if the text area is wrapping lines.

JTextComponent.KeyBinding

Constructor Summary
JTextComponent.KeyBinding(KeyStroke key, String actionName)

Creates a new key binding.

JTextField

Constructor Summary
JTextField()

Constructs a new TextField.


JTextField(Document doc, String text, int columns)

Constructs a new JTextField that uses the given text storage model and the given number of columns.
JTextField(int columns)

Constructs a new empty TextField with the specified number of columns.


JTextField(String text)

Constructs a new TextField initialized with the specified text.


JTextField(String text, int columns)

Constructs a new TextField initialized with the specified text and columns.

Method Summary
void addActionListener(ActionListener l)

Adds the specified action listener to receive action events from this textfield.
protected void configurePropertiesFromAction(Action a)

Factory method which sets the ActionEvent source's properties according to values from the Action instance.
protected PropertyChangeListene createActionPropertyChangeListener(Action a) r

Factory method which creates the PropertyChangeListener used to update the ActionEvent source as properties change on its Action instance.
protected Document createDefaultModel()

Creates the default implementation of the model to be used at construction if one isn't explicitly given.
protected void fireActionPerformed()

Notifies all listeners that have registered interest for notification on this event type.

AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JTextField.


Action getAction()

Returns the currently set Action for this ActionEvent source, or null if no Action is set.
ActionListener[] getActionListeners()

Returns an array of all the ActionListeners added to this JTextField with addActionListener().
Action[] getActions()

Fetches the command list for the editor.


int getColumns()

Returns the number of columns in this TextField.


protected int getColumnWidth()

Returns the column width.


int getHorizontalAlignment()

Returns the horizontal alignment of the text.


BoundedRangeModel getHorizontalVisibility()

Gets the visibility of the text field.


Dimension getPreferredSize()

Returns the preferred size Dimensions needed for this TextField.


int getScrollOffset()

Gets the scroll offset, in pixels.


String getUIClassID()

Gets the class ID for a UI.


boolean isValidateRoot()

Calls to revalidate that come from within the textfield itself will be handled by validating the textfield, unless the textfield is contained within a JViewport, in which case this returns false.

protected

String paramString()

Returns a string representation of this JTextField.


void postActionEvent()

Processes action events occurring on this textfield by dispatching them to any registered ActionListener objects.
void removeActionListener(ActionListener l)

Removes the specified action listener so that it no longer receives action events from this textfield.
void scrollRectToVisible(Rectangle r)

Scrolls the field left or right.


void setAction(Action a)

Sets the Action for the ActionEvent source.


void setActionCommand(String command)

Sets the command string used for action events.


void setColumns(int columns)

Sets the number of columns in this TextField, and then invalidate the layout.
void setDocument(Document doc)

Associates the editor with a text document.


void setFont(Font f)

Sets the current font.


void setHorizontalAlignment(int alignment)

Sets the horizontal alignment of the text.


void setScrollOffset(int scrollOffset)

Sets the scroll offset, in pixels.

JToggleButton

Constructor Summary
JToggleButton()

Creates an initially unselected toggle button without setting the text or image.
JToggleButton(Action a)

Creates a toggle button where properties are taken from the Action supplied.
JToggleButton(Icon icon)

Creates an initially unselected toggle button with the specified image but no text.
JToggleButton(Icon icon, boolean selected)

Creates a toggle button with the specified image and selection state, but no text.
JToggleButton(String text)

Creates an unselected toggle button with the specified text.


JToggleButton(String text, boolean selected)

Creates a toggle button with the specified text and selection state.
JToggleButton(String text, Icon icon)

Creates a toggle button that has the specified text and image, and that is initially unselected.
JToggleButton(String text, Icon icon, boolean selected)

Creates a toggle button with the specified text, image, and selection state.

Method Summary
AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JToggleButton.


String getUIClassID()

Returns a string that specifies the name of the l&f class that renders this component.
protected String paramString()

Returns a string representation of this JToggleButton.


void updateUI()

Resets the UI property to a value from the current look and feel.

JToolBar

Constructor Summary
JToolBar()

Creates a new tool bar; orientation defaults to HORIZONTAL.


JToolBar(int orientation)

Creates a new tool bar with the specified orientation.


JToolBar(String name)

Creates a new tool bar with the specified name.


JToolBar(String name, int orientation)

Creates a new tool bar with a specified name and orientation.

Method Summary
JButton add(Action a)

Adds a new JButton which dispatches the action.


protected void addImpl(Component comp, Object constraints, int index)

If a JButton is being added, it is initially set to be disabled.


void addSeparator()

Appends a separator of default size to the end of the tool bar.


void addSeparator(Dimension size)

Appends a separator of a specified size to the end of the tool bar.


protected PropertyChangeListener createActionChangeListener(JButton b)

Returns a properly configured PropertyChangeListener which updates the control as changes to the Action occur, or null if the default property change listener for the control is desired.
protected JButton createActionComponent(Action a)

Factory method which creates the JButton for Actions added to the JToolBar.
AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JToolBar.


Component getComponentAtIndex(int i)

Returns the component at the specified index.


int getComponentIndex(Component c)

Returns the index of the specified component.


Insets getMargin()

Returns the margin between the tool bar's border and its buttons.
int getOrientation()

Returns the current orientation of the tool bar.


ToolBarUI getUI()

Returns the tool bar's current UI.


String getUIClassID()

Returns the name of the L&F class that renders this component.
boolean isBorderPainted()

Gets the borderPainted property.


boolean isFloatable()

Gets the floatable property.


boolean isRollover()

Returns the rollover state.


protected void paintBorder(Graphics g)

Paints the tool bar's border if the borderPainted property is true.


protected String paramString()

Returns a string representation of this JToolBar.


void setBorderPainted(boolean b)

Sets the borderPainted property, which is true if the border should be painted.
void setFloatable(boolean b)

Sets the floatable property, which must

be true for the user to move the tool bar.


void setLayout(LayoutManager mgr)

Sets the layout manager for this container.


void setMargin(Insets m)

Sets the margin between the tool bar's border and its buttons.
void setOrientation(int o)

Sets the orientation of the tool bar.


void setRollover(boolean rollover)

Sets the rollover state of this toolbar.


void setUI(ToolBarUI ui)

Sets the L&F object that renders this component.


void updateUI()

Notification from the UIFactory that the L&F has changed.

JTree

Constructor Summary
JTree()

Returns a JTree with a sample model.


JTree(Hashtable value)

Returns a JTree created from a Hashtable which does not display with root.
JTree(Object[] value)

Returns a JTree with each element of the specified array as the child of a new root node which is not displayed.
JTree(TreeModel newModel)

Returns an instance of JTree which displays the root node -- the tree is created using the specified data model.
JTree(TreeNode root)

Returns a JTree with the specified TreeNode as its root, which displays the root node.
JTree(TreeNode root, boolean asksAllowsChildren)

Returns a JTree with the specified TreeNode as its root, which displays the root node and which decides whether a node is a leaf node in the specified manner.
JTree(Vector value)

Returns a JTree with each element of the specified Vector as the child of a new root node which is not displayed.

Method Summary
void addSelectionInterval(int index0, int index1)

Adds the paths between index0 and index1, inclusive, to the selection.
void addSelectionPath(TreePath path)

Adds the node identified by the specified TreePath to the current selection.
void addSelectionPaths(TreePath[] paths)

Adds each path in the array of paths to the current selection.


void addSelectionRow(int row)

Adds the path at the specified row to the current selection.

void addSelectionRows(int[] rows)

Adds the paths at each of the specified rows to the current selection.
void addTreeExpansionListener(TreeExpansionListener tel)

Adds a listener for TreeExpansion events.


void addTreeSelectionListener(TreeSelectionListener tsl)

Adds a listener for TreeSelection events.


void addTreeWillExpandListener(TreeWillExpandListener te l)

Adds a listener for TreeWillExpand events.


void cancelEditing()

Cancels the current editing session.


void clearSelection()

Clears the selection.


protected void clearToggledPaths()

Clears the cache of toggled tree paths.


void collapsePath(TreePath path)

Ensures that the node identified by the specified path is collapsed and viewable.
void collapseRow(int row)

Ensures that the node in the specified row is collapsed.


String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)

Called by the renderers to convert the specified value to text.


protected createTreeModel(Object value) static TreeModel Returns a TreeModel wrapping protected TreeModelListe createTreeModelListener() ner

the specified object.

Creates and returns an instance of TreeModelHandler. Ensures that the node identified by the specified path is expanded and viewable.

void expandPath(TreePath path)

void expandRow(int row)

Ensures that the node in the specified row is expanded and viewable.
void fireTreeCollapsed(TreePath path)

Notifies all listeners that have registered interest for notification on this event type.
void fireTreeExpanded(TreePath path)

Notifies all listeners that have registered interest for notification on this event type.
void fireTreeWillCollapse(TreePath path)

Notifies all listeners that have registered interest for notification on this event type.
void fireTreeWillExpand(TreePath path)

Notifies all listeners that have registered interest for notification on this event type.
protected void fireValueChanged(TreeSelectionEvent e)

Notifies all listeners that have registered interest for notification on this event type.
AccessibleContext getAccessibleContext()

Gets the AccessibleContext associated with this JTree.


TreePath getAnchorSelectionPath()

Returns the path identified as the anchor.


TreeCellEditor getCellEditor()

Returns the editor used to edit entries in the tree.


TreeCellRenderer getCellRenderer()

Returns the current TreeCellRenderer that is rendering each cell.


TreePath getClosestPathForLocation(int x, int y)

Returns the path to the node that is closest to x,y.


int getClosestRowForLocation(int x, int y)

Returns the row to the node that is closest to x,y.


protected getDefaultTreeModel() static TreeModel protected

Creates and returns a sample TreeModel. Returns an Enumeration of TreePaths that have

Enumeration getDescendantToggledPaths(TreePath parent)

been expanded that are descendants of parent.


boolean getDragEnabled()

Gets the value of the dragEnabled property.


TreePath getEditingPath()

Returns the path to the element that is currently being edited.


Enumeration getExpandedDescendants(TreePath parent)

Returns an Enumeration of the descendants of the path parent that are currently expanded.
boolean getExpandsSelectedPaths()

Returns the expandsSelectedPaths property.


boolean getInvokesStopCellEditing()

Returns the indicator that tells what happens when editing is interrupted.
Object getLastSelectedPathComponent()

Returns the last path component in the first node of the current selection.
TreePath getLeadSelectionPath()

Returns the path identified as the lead.


int getLeadSelectionRow()

Returns the row index corresponding to the lead path.


int getMaxSelectionRow()

Returns the last selected row.


int getMinSelectionRow()

Gets the first selected row.


TreeModel getModel()

Returns the TreeModel that is providing the data.


TreePath getNextMatch(String prefix, int startingRow, Position.Bias bias)

Returns the TreePath to the next tree element that begins with a prefix.
protected TreePath[] getPathBetweenRows(int index0, int index1)

Returns JTreePath instances representing the path between index0 and index1 (including index1).
Rectangle getPathBounds(TreePath path)

Returns the Rectangle that the specified node will be drawn into.
TreePath getPathForLocation(int x, int y)

Returns the path for the node at the specified location.


TreePath getPathForRow(int row)

Returns the path for the specified row.


Dimension getPreferredScrollableViewportSize()

Returns the preferred display size of a JTree.


Rectangle getRowBounds(int row)

Returns the Rectangle that the node at the specified row is drawn in.
int getRowCount()

Returns the number of rows that are currently being displayed.


int getRowForLocation(int x, int y)

Returns the row for the specified location.


int getRowForPath(TreePath path)

Returns the row that displays the node identified by the specified path.
int getRowHeight()

Returns the height of each row.


int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)

Returns the amount for a block increment, which is the height or width of visibleRect, based on orientation.
boolean getScrollableTracksViewportHeight()

Returns false to indicate that the height of the viewport does not determine the height of the table, unless the preferred height of the tree is smaller than the viewports height.
boolean getScrollableTracksViewportWidth()

Returns false to indicate that the width of the viewport does not determine the width of the table, unless the preferred width of the tree is smaller than the viewports width.

int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)

Returns the amount to increment when scrolling.


boolean getScrollsOnExpand()

Returns the value of the scrollsOnExpand property.


int getSelectionCount()

Returns the number of nodes selected.


TreeSelectionModel getSelectionModel()

Returns the model for selections.


TreePath getSelectionPath()

Returns the path to the first selected node.


TreePath[] getSelectionPaths()

Returns the paths of all selected values.


int[] getSelectionRows()

Returns all of the currently selected rows.


boolean getShowsRootHandles()

Returns the value of the showsRootHandles property.


int getToggleClickCount()

Returns the number of mouse clicks needed to expand or close a node.


String getToolTipText(MouseEvent event)

Overrides JComponent's getToolTipText method in order to allow renderer's tips to be used if it has text set.
TreeExpansionListener[] getTreeExpansionListeners()

Returns an array of all the TreeExpansionListeners added to this JTree with addTreeExpansionListener().
TreeSelectionListener[] getTreeSelectionListeners()

Returns an array of all the TreeSelectionListeners added to this JTree with addTreeSelectionListener().
TreeWillExpandListener[] getTreeWillExpandListeners()

Returns an array of all the TreeWillExpandListeners added to this JTree with addTreeWillExpandListener().
TreeUI getUI()

Returns the L&F object that renders this

component.
String getUIClassID()

Returns the name of the L&F class that renders this component.
int getVisibleRowCount()

Returns the number of rows that are displayed in the display area.
boolean hasBeenExpanded(TreePath path)

Returns true if the node identified by the path has ever been expanded.
boolean isCollapsed(int row)

Returns true if the node at the specified display row is collapsed.


boolean isCollapsed(TreePath path)

Returns true if the value identified by path is currently collapsed, this will return false if any of the values in path are currently not being displayed.
boolean isEditable()

Returns true if the tree is editable.


boolean isEditing()

Returns true if the tree is being edited.


boolean isExpanded(int row)

Returns true if the node at the specified display row is currently expanded.
boolean isExpanded(TreePath path)

Returns true if the node identified by the path is currently expanded,


boolean isFixedRowHeight()

Returns true if the height of each display row is a fixed size.


boolean isLargeModel()

Returns true if the tree is configured for a large model.


boolean isPathEditable(TreePath path)

Returns isEditable.
boolean isPathSelected(TreePath path)

Returns true if the item identified by the path is currently selected.


boolean isRootVisible()

Returns true if the root node of the tree is displayed.


boolean isRowSelected(int row)

Returns true if the node identified by row is selected.


boolean isSelectionEmpty()

Returns true if the selection is currently empty.


boolean isVisible(TreePath path)

Returns true if the value identified by path is currently viewable, which means it is either the root or all of its parents are expanded.
void makeVisible(TreePath path)

Ensures that the node identified by path is currently viewable.


protected String paramString()

Returns a string representation of this JTree.


protected boolean removeDescendantSelectedPaths(TreePath path, boolean includePath)

Removes any paths in the selection that are descendants of path.


protected void removeDescendantToggledPaths(Enumeration toRemove)

Removes any descendants of the TreePaths in toRemove that have been expanded.
void removeSelectionInterval(int index0, int index1)

Removes the nodes between index0 and index1, inclusive, from the selection.
void removeSelectionPath(TreePath path)

Removes the node identified by the specified path from the current selection.
void removeSelectionPaths(TreePath[] paths)

Removes the nodes identified by the specified paths from the current selection.
void removeSelectionRow(int row)

Removes the row at the index row from the current selection.
void removeSelectionRows(int[] rows)

Removes the rows that are selected at each of the specified rows.
void removeTreeExpansionListener(TreeExpansionListener t el)

Removes a listener for TreeExpansion events.


void removeTreeSelectionListener(TreeSelectionListener t sl)

Removes a TreeSelection listener.


void removeTreeWillExpandListener(TreeWillExpandListener tel)

Removes a listener for TreeWillExpand events.


void scrollPathToVisible(TreePath path)

Makes sure all the path components in path are expanded (except for the last path component) and scrolls so that the node identified by the path is displayed.
void scrollRowToVisible(int row)

Scrolls the item identified by row until it is displayed.


void setAnchorSelectionPath(TreePath newPath)

Sets the path identified as the anchor.


void setCellEditor(TreeCellEditor cellEditor)

Sets the cell editor.


void setCellRenderer(TreeCellRenderer x)

Sets the TreeCellRenderer that will be used to draw each cell.


void setDragEnabled(boolean b)

Sets the dragEnabled property, which must be true to enable automatic drag handling (the first part of drag and drop) on this component.
void setEditable(boolean flag)

Determines whether the tree is editable.


protected void setExpandedState(TreePath path, boolean state)

Sets the expanded state of this JTree.

void setExpandsSelectedPaths(boolean newValue)

Configures the expandsSelectedPaths property.


void setInvokesStopCellEditing(boolean newValue)

Determines what happens when editing is interrupted by selecting another node in the tree, a change in the tree's data, or by some other means.
void setLargeModel(boolean newValue)

Specifies whether the UI should use a large model.


void setLeadSelectionPath(TreePath newPath)

Sets the path identifies as the lead.


void setModel(TreeModel newModel)

Sets the TreeModel that will provide the data.


void setRootVisible(boolean rootVisible)

Determines whether or not the root node from the TreeModel is visible.
void setRowHeight(int rowHeight)

Sets the height of each cell, in pixels.


void setScrollsOnExpand(boolean newValue)

Sets the scrollsOnExpand property, which determines whether the tree might scroll to show previously hidden children.
void setSelectionInterval(int index0, int index1)

Selects the nodes between index0 and index1, inclusive.


void setSelectionModel(TreeSelectionModel selectionModel )

Sets the tree's selection model.


void setSelectionPath(TreePath path)

Selects the node identified by the specified path.


void setSelectionPaths(TreePath[] paths)

Selects the nodes identified by the specified array of paths.


void setSelectionRow(int row)

Selects the node at the specified row in the display.


void setSelectionRows(int[] rows)

Selects the nodes corresponding to each of the specified rows in the display.
void setShowsRootHandles(boolean newValue)

Sets the value of the showsRootHandles property, which specifies whether the node handles should be displayed.
void setToggleClickCount(int clickCount)

Sets the number of mouse clicks before a node will expand or close.
void setUI(TreeUI ui)

Sets the L&F object that renders this component.


void setVisibleRowCount(int newCount)

Sets the number of rows that are to be displayed.


void startEditingAtPath(TreePath path)

Selects the node identified by the specified path and initiates editing.
boolean stopEditing()

Ends the current editing session.


void treeDidChange()

Sent when the tree has changed enough that we need to resize the bounds, but not enough that we need to remove the expanded node set (e.g nodes were expanded or collapsed, or nodes were inserted into the tree).
void updateUI()

Notification from the UIManager that the L&F has changed.

You might also like