|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--java.awt.Dialog | +--javax.swing.JDialog | +--com.bigzip.plugin.support.ui.DirectoryChooser
The DirectoryChooser is used to allow the user to select a directory in the file system. The dialog allows the user to navigate the directory hierarchies in all the available file systems and to create new directories.
An accessory component can be added to the dialog box to allow the user to chooser task-specific options along with a directory.
The directory chooser can be used and customized in a number of ways:
Inner classes inherited from class javax.swing.JDialog |
javax.swing.JDialog.AccessibleJDialog |
Inner classes inherited from class java.awt.Dialog |
java.awt.Dialog.AccessibleAWTDialog |
Inner classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Field Summary | |
protected javax.swing.JComponent |
accessory
This is the accessory component to be displayed in the chooser. |
static int |
APPROVE_OPTION
Return value if approve (yes, ok) is chosen. |
protected javax.swing.JButton |
approveButton
This is the approve button. |
protected int |
approved
The approval status of the chooser. |
static int |
CANCEL_OPTION
Return value if cancel is chosen. |
protected javax.swing.JButton |
cancelButton
This is the cancel button. |
protected com.bigzip.plugin.support.ui.DirectoryChooserPane |
directoryChooserPane
This is the directory chooser pane. |
static int |
ERROR_OPTION
Return value if an error occured. |
protected javax.swing.JButton |
goHomeButton
This is the 'Go Home' button. |
protected boolean |
ignoreDirectoryChangeNotifications
Indicates if directory change notifications should be ignored. |
protected boolean |
ignoreFieldChangeNotifications
Indicates if change notifications in the path field should be ignored. |
protected javax.swing.JButton |
newDirectoryButton
This is the 'New Directory' button. |
protected java.awt.Frame |
parent
This is the parent of the chooser. |
protected javax.swing.JTextField |
pathField
This is field where the user may directly enter a path. |
Fields inherited from class javax.swing.JDialog |
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
DirectoryChooser()
Creates a new directory chooser with user's working directory selected by default. |
|
DirectoryChooser(java.io.File initialPath)
Creates a new directory chooser with directory refered to by the given path selected by default. |
|
DirectoryChooser(java.awt.Frame parent,
java.io.File initialPath)
Creates a new directory chooser with directory refered to by the given path selected by default. |
|
DirectoryChooser(java.awt.Frame parent,
java.lang.String initialPath)
Creates a new directory chooser with directory refered to by the given path selected by default. |
|
DirectoryChooser(java.lang.String initialPath)
Creates a new directory chooser with directory refered to by the given path selected by default. |
Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Registers a property change listener that will receive notification when a directory is chosen in the directory chooser. |
protected javax.swing.JButton |
createDefaultApproveButton()
Creates a button with the label "Select", mnemonic 's', and which calls the doApproveAction method when clicked. |
protected javax.swing.JButton |
createDefaultCancelButton()
Creates a button with the label "Cancel", mnemonic 'c', and which calls the doCancelAction method when clicked. |
protected javax.swing.JButton |
createDefaultGoHomeButton()
Creates a button with the default 'go home' icon for the current look'n'feel, mnemonic 'c', and which calls the doGoHomeAction method when clicked. |
protected javax.swing.JButton |
createDefaultNewDirectoryButton()
Creates a button with the default 'new folder' icon for the current look'n'feel, mnemonic 'n', and which calls the doNewDirectoryAction method when clicked. |
protected void |
doApproveAction()
Performs the standard response to the approve button being clicked. |
protected void |
doCancelAction()
Performs the standard response to the cancel button being clicked. |
protected void |
doCreateNewDirectoryAction()
Performs the standard response to the new directory button being clicked. |
protected void |
doGoHomeAction()
Performs the standard response to the go home button being clicked. |
static java.io.File |
findFirstExistingParent(java.io.File path)
Finds the first parent directory in the directory hierarchy that exists for a given path. |
javax.swing.JComponent |
getAccessory()
Retrieves the accessory component displayed in the directory chooser. |
int |
getApproveButtonMnemonic()
Retrieves the the approve button's mnemonic. |
java.lang.String |
getApproveButtonText()
Retrieves the text that appears in the approve button. |
java.lang.String |
getApproveButtonToolTipText()
Retrieves the approve button's tooltip text. |
java.io.File |
getCurrentDirectory()
Retrieves the currently selected directory. |
boolean |
isApproved()
Tests if the directory chooser was approved. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Unregisters a listener from being notified when the user chooses a directory. |
void |
setAccessory(javax.swing.JComponent accessory)
Sets the accessory to display in the directory chooser. |
void |
setApproveButtonMnemonic(char mnemonic)
Sets the approve button's mnemonic. |
void |
setApproveButtonText(java.lang.String label)
Sets the text that appears in the approve button. |
void |
setApproveButtonToolTipText(java.lang.String text)
Sets the approve button's tooltip text. |
void |
setCurrentDirectory(java.io.File path)
Sets the currently selected directory. |
int |
showDialog()
Shows the directory chooser to the user. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent)
Shows the standard directory chooser with the user's home directory initially selected. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent,
java.io.File initialPath)
Shows the standard directory chooser. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent,
java.io.File initialPath,
javax.swing.JComponent accessory)
Shows the standard directory chooser with a custom accessory. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent,
java.io.File initialPath,
java.lang.String dialogTitle)
Shows the standard directory chooser with a custom dialog box title. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent,
java.io.File initialPath,
java.lang.String dialogTitle,
javax.swing.JComponent accessory)
Shows the standard directory chooser with a custom dialog box title and accessory. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent,
java.io.File initialPath,
java.lang.String dialogTitle,
javax.swing.JComponent accessory,
java.lang.String approveButtonText,
char approveButtonMnemonic,
java.lang.String approveButtonToolTipText)
Shows the standard directory chooser with a custom dialog box title, accessory and approve button. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent,
java.lang.String initialPath)
Shows the standard directory chooser. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent,
java.lang.String initialPath,
javax.swing.JComponent accessory)
Shows the standard directory chooser with a custom accessory. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent,
java.lang.String initialPath,
java.lang.String dialogTitle)
Shows the standard directory chooser with a custom dialog box title. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent,
java.lang.String initialPath,
java.lang.String dialogTitle,
javax.swing.JComponent accessory)
Shows the standard directory chooser with a custom dialog box title and accessory. |
static java.io.File |
showDirectoryChooser(java.awt.Frame parent,
java.lang.String initialPath,
java.lang.String dialogTitle,
javax.swing.JComponent accessory,
java.lang.String approveButtonText,
char approveButtonMnemonic,
java.lang.String approveButtonToolTipText)
Shows the standard directory chooser with a custom dialog box title, accessory and approve button. |
protected void |
updateDirectoryChooser()
Synchronizes the selection in the directory chooser pane with the path field. |
protected void |
updatePathField()
Synchronizes the paht field with the selection in the directory chooser. |
Methods inherited from class javax.swing.JDialog |
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setLocationRelativeTo, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Dialog |
addNotify, dispose, getTitle, hide, isModal, isResizable, setModal, setResizable, setTitle, show |
Methods inherited from class java.awt.Window |
addWindowListener, applyResourceBundle, applyResourceBundle, finalize, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isShowing, pack, postEvent, processEvent, removeWindowListener, setCursor, toBack, toFront |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setFont, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int APPROVE_OPTION
public static final int CANCEL_OPTION
public static final int ERROR_OPTION
protected int approved
protected javax.swing.JComponent accessory
protected javax.swing.JButton approveButton
protected javax.swing.JButton cancelButton
protected com.bigzip.plugin.support.ui.DirectoryChooserPane directoryChooserPane
protected javax.swing.JButton goHomeButton
protected javax.swing.JButton newDirectoryButton
protected java.awt.Frame parent
protected javax.swing.JTextField pathField
protected boolean ignoreDirectoryChangeNotifications
protected boolean ignoreFieldChangeNotifications
Constructor Detail |
public DirectoryChooser()
public DirectoryChooser(java.lang.String initialPath)
public DirectoryChooser(java.awt.Frame parent, java.lang.String initialPath)
public DirectoryChooser(java.io.File initialPath)
public DirectoryChooser(java.awt.Frame parent, java.io.File initialPath)
Method Detail |
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in class java.awt.Component
listener
- The listener to notify.protected javax.swing.JButton createDefaultApproveButton()
protected javax.swing.JButton createDefaultCancelButton()
protected javax.swing.JButton createDefaultGoHomeButton()
protected javax.swing.JButton createDefaultNewDirectoryButton()
protected void doApproveAction()
protected void doCancelAction()
protected void doCreateNewDirectoryAction()
protected void doGoHomeAction()
public static java.io.File findFirstExistingParent(java.io.File path)
path
- The path of the directory to start searching from.public javax.swing.JComponent getAccessory()
public java.lang.String getApproveButtonText()
public int getApproveButtonMnemonic()
public java.lang.String getApproveButtonToolTipText()
public java.io.File getCurrentDirectory()
public boolean isApproved()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in class java.awt.Component
listener
- The listener to unregister.public void setAccessory(javax.swing.JComponent accessory)
public void setApproveButtonText(java.lang.String label)
public void setApproveButtonMnemonic(char mnemonic)
public void setApproveButtonToolTipText(java.lang.String text)
public void setCurrentDirectory(java.io.File path)
java.lang.IllegalArgumentException
- The path given doesn't not refer to
a directory.public int showDialog()
public static java.io.File showDirectoryChooser(java.awt.Frame parent)
parent
- The parent frame of the chooser.public static java.io.File showDirectoryChooser(java.awt.Frame parent, java.lang.String initialPath)
parent
- The parent frame of the chooser.initalPath
- The directory initially selected.public static java.io.File showDirectoryChooser(java.awt.Frame parent, java.lang.String initialPath, javax.swing.JComponent accessory)
parent
- The parent frame of the chooser.initalPath
- The directory initially selected.accessory
- The accessory component to be displayed in the chooser.public static java.io.File showDirectoryChooser(java.awt.Frame parent, java.lang.String initialPath, java.lang.String dialogTitle)
parent
- The parent frame of the chooser.initalPath
- The directory initially selected.dialogTitle
- The string to appear as the directory chooser's title.public static java.io.File showDirectoryChooser(java.awt.Frame parent, java.lang.String initialPath, java.lang.String dialogTitle, javax.swing.JComponent accessory)
parent
- The parent frame of the chooser.initalPath
- The directory initially selected.dialogTitle
- The string to appear as the directory chooser's title.accessory
- The accessory component to be displayed in the chooser.public static java.io.File showDirectoryChooser(java.awt.Frame parent, java.lang.String initialPath, java.lang.String dialogTitle, javax.swing.JComponent accessory, java.lang.String approveButtonText, char approveButtonMnemonic, java.lang.String approveButtonToolTipText)
parent
- The parent frame of the chooser.initalPath
- The directory initially selected.dialogTitle
- The string to appear as the directory chooser's title.accessory
- The accessory component to be displayed in the chooser.approveButtonText
- The text to appear in the approve button.approveButtonMnemonic
- The approve button's mnemonic.approveBuutonToolTipText
- The approve button's tooltip text.public static java.io.File showDirectoryChooser(java.awt.Frame parent, java.io.File initialPath)
parent
- The parent frame of the chooser.initalPath
- The directory initially selected.public static java.io.File showDirectoryChooser(java.awt.Frame parent, java.io.File initialPath, javax.swing.JComponent accessory)
parent
- The parent frame of the chooser.initalPath
- The directory initially selected.accessory
- The accessory component to be displayed in the chooser.public static java.io.File showDirectoryChooser(java.awt.Frame parent, java.io.File initialPath, java.lang.String dialogTitle)
parent
- The parent frame of the chooser.initalPath
- The directory initially selected.dialogTitle
- The string to appear as the directory chooser's title.public static java.io.File showDirectoryChooser(java.awt.Frame parent, java.io.File initialPath, java.lang.String dialogTitle, javax.swing.JComponent accessory)
parent
- The parent frame of the chooser.initalPath
- The directory initially selected.dialogTitle
- The string to appear as the directory chooser's title.accessory
- The accessory component to be displayed in the chooser.public static java.io.File showDirectoryChooser(java.awt.Frame parent, java.io.File initialPath, java.lang.String dialogTitle, javax.swing.JComponent accessory, java.lang.String approveButtonText, char approveButtonMnemonic, java.lang.String approveButtonToolTipText)
parent
- The parent frame of the chooser.initalPath
- The directory initially selected.dialogTitle
- The string to appear as the directory chooser's title.accessory
- The accessory component to be displayed in the chooser.approveButtonText
- The text to appear in the approve button.approveButtonMnemonic
- The approve button's mnemonic.approveBuutonToolTipText
- The approve button's tooltip text.protected void updateDirectoryChooser()
protected void updatePathField()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |