Documentation of 'jas2.util.gui.JDirectoryChooser' Java class
JDirectoryChooser
jas2.util.gui

Class JDirectoryChooser

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable


    public class JDirectoryChooser
    extends javax.swing.JComponent
    A class which allows a user to select directories or files, similar to JFileChooser, except that it display files as a tree, and is better suited to selecting directories than the current file chooser (see java bug id 4239219). TODO: Understand issue with moving mouse between double clicks (seems like MOUSE_PRESSED and MOUSE_RELEASED events are generated, but not MOUSE_CLICKED) See Bug ID 4218549
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int APPROVE_OPTION 
      static int CANCEL_OPTION 
      • Fields inherited from class javax.swing.JComponent

        TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor and Description
      JDirectoryChooser()
      Create a JDirectoryChooser with the default FileSystemView
      JDirectoryChooser(java.io.File currentDirectory)
      Create a JDirectoryChooser with the default FileSystemView
      JDirectoryChooser(java.io.File currentDirectory, javax.swing.filechooser.FileSystemView view)
      Create a JDirectoryChooser
      JDirectoryChooser(javax.swing.filechooser.FileSystemView view)
      Create a JDirectoryChooser
      JDirectoryChooser(java.lang.String currentDirectory)
      Create a JDirectoryChooser with the default FileSystemView
      JDirectoryChooser(java.lang.String currentDirectory, javax.swing.filechooser.FileSystemView view)
      Create a JDirectoryChooser
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addNotify() 
      java.lang.String getDialogTitle()
      Gets the string that goes in the FileChooser's titlebar
      javax.swing.filechooser.FileFilter getFileFilter()
      Get the current file filter
      int getFileSelectionMode()
      Test the file selection mode
      javax.swing.filechooser.FileView getFileView()
      Returns the current file view.
      java.io.File getSelectedFile()
      Returns the currently selected file (or the first selected file if multiple files are selected)
      java.io.File[] getSelectedFiles()
      Returns a list of selected files if the filechooser is set to allow multi-selection.
      boolean isFileHidingEnabled()
      Test if file hiding is enabled
      boolean isMultiSelectionEnabled()
      Returns true if multi-file selection is enabled.
      static void main(java.lang.String[] argv) 
      void setCurrentDirectory(java.io.File dir)
      Set the directory to which the tree is to open
      void setDialogTitle(java.lang.String dialogTitle)
      Sets the string that goes in the FileChooser window's title bar
      void setFileFilter(javax.swing.filechooser.FileFilter fileFilter)
      Set a filter to control which files are displayed in the tree
      void setFileHidingEnabled(boolean hide)
      Select whether to show "hidden" files in the tree
      void setFileSelectionMode(int mode)
      Set the file selection mode.
      void setFileView(javax.swing.filechooser.FileView fileView)
      Sets the file view to used to retrieve UI information, such as the icon that represents a file or the type description of a file.
      void setMultiSelectionEnabled(boolean enable)
      Sets the filechooser to allow multiple file selections.
      int showDialog(java.awt.Component parent)
      Popup up a modal dialog containing the JDirectoryChooser
      void updateUI() 
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • APPROVE_OPTION

        public static int APPROVE_OPTION
      • CANCEL_OPTION

        public static int CANCEL_OPTION
    • Constructor Detail

      • JDirectoryChooser

        public JDirectoryChooser()
        Create a JDirectoryChooser with the default FileSystemView
      • JDirectoryChooser

        public JDirectoryChooser(java.io.File currentDirectory)
        Create a JDirectoryChooser with the default FileSystemView
        Parameters:
        currentDirectory - The directory to which the tree is initially set
      • JDirectoryChooser

        public JDirectoryChooser(java.lang.String currentDirectory)
        Create a JDirectoryChooser with the default FileSystemView
        Parameters:
        currentDirectory - The directory to which the tree is initially set
      • JDirectoryChooser

        public JDirectoryChooser(java.io.File currentDirectory,
                                 javax.swing.filechooser.FileSystemView view)
        Create a JDirectoryChooser
        Parameters:
        currentDirectory - The directory to which the tree is initially set
        view - The FileSystemView to use
      • JDirectoryChooser

        public JDirectoryChooser(java.lang.String currentDirectory,
                                 javax.swing.filechooser.FileSystemView view)
        Create a JDirectoryChooser
        Parameters:
        currentDirectory - The directory to which the tree is initially set
        view - The FileSystemView to use
      • JDirectoryChooser

        public JDirectoryChooser(javax.swing.filechooser.FileSystemView view)
        Create a JDirectoryChooser
        Parameters:
        view - The FileSystemView to use
    • Method Detail

      • addNotify

        public void addNotify()
        Overrides:
        addNotify in class javax.swing.JComponent
      • setCurrentDirectory

        public void setCurrentDirectory(java.io.File dir)
        Set the directory to which the tree is to open
      • setFileFilter

        public void setFileFilter(javax.swing.filechooser.FileFilter fileFilter)
        Set a filter to control which files are displayed in the tree
      • getFileFilter

        public javax.swing.filechooser.FileFilter getFileFilter()
        Get the current file filter
        Returns:
        The current FileFilter or null if none set
      • setFileHidingEnabled

        public void setFileHidingEnabled(boolean hide)
        Select whether to show "hidden" files in the tree
        Parameters:
        hide - True if hidden files should not be shown
      • isFileHidingEnabled

        public boolean isFileHidingEnabled()
        Test if file hiding is enabled
        Returns:
        true if file hiding is enabled
        See Also:
        setFileHidingEnabled(boolean)
      • setFileSelectionMode

        public void setFileSelectionMode(int mode)
        Set the file selection mode. Valid modes are
        Parameters:
        mode - either JFileChooser.DIRECTORIES_ONLY or JFileChooser.FILES_AND_DIRECTORIES (the default)
        See Also:
        JFileChooser.setFileSelectionMode(int)
      • getFileSelectionMode

        public int getFileSelectionMode()
        Test the file selection mode
        Returns:
        The current file selection mode
        See Also:
        setFileSelectionMode(int)
      • setMultiSelectionEnabled

        public void setMultiSelectionEnabled(boolean enable)
        Sets the filechooser to allow multiple file selections.
      • isMultiSelectionEnabled

        public boolean isMultiSelectionEnabled()
        Returns true if multi-file selection is enabled.
      • getSelectedFile

        public java.io.File getSelectedFile()
        Returns the currently selected file (or the first selected file if multiple files are selected)
      • getSelectedFiles

        public java.io.File[] getSelectedFiles()
        Returns a list of selected files if the filechooser is set to allow multi-selection.
      • updateUI

        public void updateUI()
        Overrides:
        updateUI in class javax.swing.JComponent
      • showDialog

        public int showDialog(java.awt.Component parent)
        Popup up a modal dialog containing the JDirectoryChooser
        Parameters:
        parent - The parent of the dialog box
        Returns:
        either JFileChooser.CANCEL_OPTION or JFileChooser.APPROVE_OPTION
        See Also:
        JFileChooser.showDialog(java.awt.Component, java.lang.String)
      • setDialogTitle

        public void setDialogTitle(java.lang.String dialogTitle)
        Sets the string that goes in the FileChooser window's title bar
      • getDialogTitle

        public java.lang.String getDialogTitle()
        Gets the string that goes in the FileChooser's titlebar
      • setFileView

        public void setFileView(javax.swing.filechooser.FileView fileView)
        Sets the file view to used to retrieve UI information, such as the icon that represents a file or the type description of a file.
      • getFileView

        public javax.swing.filechooser.FileView getFileView()
        Returns the current file view.
      • main

        public static void main(java.lang.String[] argv)

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.