javax.swing.plaf.metal

Class MetalFileChooserUI.DirectoryComboBoxModel

protected class MetalFileChooserUI.DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel

A combo box model containing the selected directory and all its parent directories.
Constructor Summary
DirectoryComboBoxModel()
Creates a new model.
Method Summary
intgetDepth(int index)
Returns the depth of the item at the given index.
ObjectgetElementAt(int index)
Returns the item at the specified index.
ObjectgetSelectedItem()
Returns the selected item, or null if no item is selected.
intgetSize()
Returns the number of items in the model.
voidsetSelectedItem(Object selectedDirectory)
Sets the selected item.

Constructor Detail

DirectoryComboBoxModel

public DirectoryComboBoxModel()
Creates a new model.

Method Detail

getDepth

public int getDepth(int index)
Returns the depth of the item at the given index.

Parameters: index the item index.

Returns: The depth.

getElementAt

public Object getElementAt(int index)
Returns the item at the specified index.

Parameters: index the item index.

Returns: The item.

getSelectedItem

public Object getSelectedItem()
Returns the selected item, or null if no item is selected.

Returns: The selected item, or null.

getSize

public int getSize()
Returns the number of items in the model.

Returns: The number of items in the model.

setSelectedItem

public void setSelectedItem(Object selectedDirectory)
Sets the selected item. This clears all the directories from the existing list, and repopulates it with the new selected directory and all its parent directories.

Parameters: selectedDirectory the selected directory.