de.hillenbrand.swing
Class HFileString

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.Box
                  extended by de.hillenbrand.swing.HFileString
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class HFileString
extends javax.swing.Box

This component implements a collection of a text field an a button, with which you can select a file or a directory.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.Box
javax.swing.Box.AccessibleBox, javax.swing.Box.Filler
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int DIRECTORIES_ONLY
           
static int FILES_AND_DIRECTORIES
           
static int MULTIPLE_FILES
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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
HFileString()
          Constructs a new FileString.
HFileString(java.io.File file)
          Constructs a new FileString with the file as content.
HFileString(java.io.File file, int policy)
          Constructs a new FileString with filename and the policy.
HFileString(int policy)
          Constructs a new FileString the policy.
HFileString(java.lang.String filename)
          Constructs a new FileString with the file as content.
HFileString(java.lang.String filename, int policy)
          Constructs a new FileString with the file as content.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
          Adds an action listener to this components.
 void addChoosableFileFilter(javax.swing.filechooser.FileFilter f)
           
 java.io.File getFile()
          Returns the current value of the component.
 FileRequester getFileRequester()
           
 java.io.File[] getFiles()
          Returns the current value of the component.
 int getPolicy()
          Get the policy of the FileString component.
 java.lang.String getText()
          Returns the name of the selected file.
 void setEditable(boolean b)
           
 void setEnabled(boolean b)
           
 void setFile(java.io.File file)
          Sets the file.
 void setFile(java.lang.String file)
          Sets the file.
 void setLoadMode()
           
 void setSaveMode()
           
 void setText(java.lang.String file)
          Sets the text.
 void setToolTipText(java.lang.String text)
          Sets the tool tip for this component.
 
Methods inherited from class javax.swing.Box
createGlue, createHorizontalBox, createHorizontalGlue, createHorizontalStrut, createRigidArea, createVerticalBox, createVerticalGlue, createVerticalStrut, getAccessibleContext, paintComponent, setLayout
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, hide, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FILES_AND_DIRECTORIES

public static final int FILES_AND_DIRECTORIES
See Also:
Constant Field Values

DIRECTORIES_ONLY

public static final int DIRECTORIES_ONLY
See Also:
Constant Field Values

MULTIPLE_FILES

public static final int MULTIPLE_FILES
See Also:
Constant Field Values
Constructor Detail

HFileString

public HFileString()
Constructs a new FileString. The component's policy is FILES_AND_DIRECTORIES.


HFileString

public HFileString(java.io.File file)
Constructs a new FileString with the file as content. The component's policy is FILES_AND_DIRECTORIES.

Parameters:
file - the initial file

HFileString

public HFileString(java.lang.String filename)
Constructs a new FileString with the file as content. The component's policy is FILES_AND_DIRECTORIES.

Parameters:
filename - the initial file name

HFileString

public HFileString(int policy)
Constructs a new FileString the policy.

Parameters:
policy - either FILES_AND_DIRECTORIES or DIRECTORIES_ONLY or MULTIPLE_FILES

HFileString

public HFileString(java.io.File file,
                   int policy)
Constructs a new FileString with filename and the policy.

Parameters:
file - the file
policy - either FILES_AND_DIRECTORIES or DIRECTORIES_ONLY or MULTIPLE_FILES

HFileString

public HFileString(java.lang.String filename,
                   int policy)
Constructs a new FileString with the file as content. The component's policy is FILES_AND_DIRECTORIES.

Parameters:
filename - the initial file name
policy - the file requester policy
Method Detail

getPolicy

public int getPolicy()
Get the policy of the FileString component.

Returns:

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Adds an action listener to this components.

Parameters:
l - the listener

addChoosableFileFilter

public void addChoosableFileFilter(javax.swing.filechooser.FileFilter f)

getFile

public java.io.File getFile()
Returns the current value of the component.

Returns:
the file which has been selected by the user (the file or directory might not exist)

getFileRequester

public FileRequester getFileRequester()

getFiles

public java.io.File[] getFiles()
Returns the current value of the component.

Returns:
the files which has been selected by the user

getText

public java.lang.String getText()
Returns the name of the selected file.

Returns:
the name of the file which has been selected by the user (the file or directory might not exist)

setEditable

public void setEditable(boolean b)

setEnabled

public void setEnabled(boolean b)
Overrides:
setEnabled in class javax.swing.JComponent

setFile

public void setFile(java.io.File file)
Sets the file.

Parameters:
file - the new selected file of the component

setFile

public void setFile(java.lang.String file)
Sets the file.

Parameters:
file - the new selected file of the component

setLoadMode

public void setLoadMode()

setSaveMode

public void setSaveMode()

setText

public void setText(java.lang.String file)
Sets the text.

Parameters:
file - the new selected file of the component

setToolTipText

public void setToolTipText(java.lang.String text)
Sets the tool tip for this component.

Overrides:
setToolTipText in class javax.swing.JComponent
Parameters:
text - the tool tip text