Class ProjectFolderDialog
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- ca.cgjennings.apps.arkham.project.ProjectFolderDialog
-
- All Implemented Interfaces:
AgnosticDialog
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
public class ProjectFolderDialog extends javax.swing.JDialog implements AgnosticDialog
A dialog for selecting project file folders, or folders OTHER THAN project file folders.- Author:
- Chris Jennings
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProjectFolderDialog.Mode
The type of folder selection supported by the dialog.-
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
-
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
-
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
-
-
Constructor Summary
Constructors Constructor Description ProjectFolderDialog(java.awt.Component parent, ProjectFolderDialog.Mode mode)
Creates a new project folder dialog that allows folder selection using the specified mode.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAcceptButtonText()
Returns the label text of the button that accepts the selected file and closes the dialog (the "OK" button).java.io.File
getSelectedFolder()
Returns the currently selected folder.java.lang.String
getSuggestedFolderName()
Returns the initial name to use when the user first creates a new folder, ornull
if no suggested name has been set.void
handleCancelAction(java.awt.event.ActionEvent e)
Performs whatever action is required when the Cancel button is pressed.void
handleOKAction(java.awt.event.ActionEvent e)
Performs whatever action is required when the OK button is pressed.static boolean
isFolderDialogEnabled()
void
setAcceptButtonText(java.lang.String okText)
Sets the label text of the button that accepts the selected file and closes the dialog (the "OK" button).void
setSelectedFolder(java.io.File f)
Sets the currently selected folder.void
setSuggestedFolderName(java.lang.String suggestion)
Sets the initial name to use when the user first creates a new folder.java.io.File
showDialog()
Displays the selection dialog and allows the user to select a file.void
useSettingKey(java.lang.String key)
Uses the specified setting key to recall and store the initial selected folder for the dialog.-
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
ProjectFolderDialog
public ProjectFolderDialog(java.awt.Component parent, ProjectFolderDialog.Mode mode)
Creates a new project folder dialog that allows folder selection using the specified mode.- Parameters:
parent
- an optional component to use for the dialog's parent; ifnull
the main application window is usedmode
- the type of folder selection to allow
-
-
Method Detail
-
useSettingKey
public void useSettingKey(java.lang.String key)
Uses the specified setting key to recall and store the initial selected folder for the dialog. The value of the setting key is used to set the initial folder, and if the user selects a folder then the parent of that folder will be stored in the key.- Parameters:
key
- the name of the user setting key to use- See Also:
Settings.getUser()
-
setSelectedFolder
public void setSelectedFolder(java.io.File f)
Sets the currently selected folder. If the file isnull
, the folder will be set to a platform-dependent default location. If the specified file does not exist or is not a folder, the selection is unchanged.- Parameters:
f
- the folder to select- See Also:
getSelectedFolder()
-
getSelectedFolder
public java.io.File getSelectedFolder()
Returns the currently selected folder.- Returns:
- the selected folder
- See Also:
setSelectedFolder(java.io.File)
,showDialog()
-
setAcceptButtonText
public void setAcceptButtonText(java.lang.String okText)
Sets the label text of the button that accepts the selected file and closes the dialog (the "OK" button). If no text is set explicitly, a generic label will be used.- Parameters:
okText
- text that describes the effect of accepting the file- See Also:
getAcceptButtonText()
-
getAcceptButtonText
public java.lang.String getAcceptButtonText()
Returns the label text of the button that accepts the selected file and closes the dialog (the "OK" button).- Returns:
- text that describes the effect of accepting the file
- See Also:
setAcceptButtonText(java.lang.String)
-
setSuggestedFolderName
public void setSuggestedFolderName(java.lang.String suggestion)
Sets the initial name to use when the user first creates a new folder. If set tonull
, then the default name is used.- Parameters:
suggestion
- the suggested name, ornull
- See Also:
getSuggestedFolderName()
-
getSuggestedFolderName
public java.lang.String getSuggestedFolderName()
Returns the initial name to use when the user first creates a new folder, ornull
if no suggested name has been set.- Returns:
- the suggested name, or
null
- See Also:
setSuggestedFolderName(java.lang.String)
-
showDialog
public java.io.File showDialog()
Displays the selection dialog and allows the user to select a file. If the user selects a file, the file is returned. If the user cancels the dialog,null
is returned.- Returns:
- the selected file, or
null
-
isFolderDialogEnabled
public static boolean isFolderDialogEnabled()
-
handleOKAction
public void handleOKAction(java.awt.event.ActionEvent e)
Description copied from interface:AgnosticDialog
Performs whatever action is required when the OK button is pressed. Called when the (possibly swapped) OK button generates an ActionEvent.- Specified by:
handleOKAction
in interfaceAgnosticDialog
- Parameters:
e
- theActionEvent
generated by the button
-
handleCancelAction
public void handleCancelAction(java.awt.event.ActionEvent e)
Description copied from interface:AgnosticDialog
Performs whatever action is required when the Cancel button is pressed. Called when the (possibly swapped) OK button generates an ActionEvent.- Specified by:
handleCancelAction
in interfaceAgnosticDialog
- Parameters:
e
- theActionEvent
generated by the button
-
-