|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel org.fife.ui.ResizableFrameContentPane org.fife.ui.rtextfilechooser.RTextFileChooser
public class RTextFileChooser
A powerful, flexible text file chooser. Its UI is similar to the Windows LnF
JFileChooser
, but it is not affected by Look-and-Feel changes.
This file chooser has the following features:
JFileChooser
and is designed to be a drop-in replacement for opening text files.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
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 |
APPROVE_OPTION
|
static int |
CANCEL_OPTION
|
static int |
DETAILS_MODE
|
static int |
DIRECTORIES_ONLY
|
static int |
ERROR_OPTION
|
static int |
FILES_AND_DIRECTORIES
|
static int |
FILES_ONLY
|
static int |
ICONS_MODE
|
static int |
LIST_MODE
|
static int |
OPEN_DIALOG
|
static int |
SAVE_DIALOG
|
static int |
STYLE_BOLD
|
static int |
STYLE_ITALIC
|
static int |
STYLE_UNDERLINE
|
protected org.fife.ui.rtextfilechooser.RTextFileChooserView |
view
The "view" of the current directory (either list, details or icons). |
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 | |
---|---|
RTextFileChooser()
Creates a new RTextFileChooser . |
|
RTextFileChooser(boolean showEncodingCombo)
Creates a new RTextFileChooser . |
|
RTextFileChooser(boolean showEncodingCombo,
java.io.File startDirectory)
Creates a new RTextFileChooser . |
|
RTextFileChooser(java.io.File startDirectory)
Creates a new RTextFileChooser . |
|
RTextFileChooser(java.lang.String startDirectory)
Creates a new RTextFileChooser . |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Listens for actions in this file dialog. |
void |
addChoosableFileFilter(javax.swing.filechooser.FileFilter filter)
Adds a file filter to the filter combo box. |
boolean |
addToFavorites(java.lang.String dir)
Adds the specified directory to the user's "favorites" list. |
void |
approveSelection()
Called when the user clicks the "Approve" button. |
protected boolean |
approveSelectionImpl()
Called at the end of approveSelection() ; the file chooser
dialog will only close if this method returns true . |
void |
cancelSelection()
Called when the user clicks the Cancel button. |
void |
clearExtensionColorMap()
Removes all values from the extension-to-color map. |
void |
clearFavorites()
Removes all favorites from the "Favorites" list. |
protected javax.swing.JDialog |
createDialog(java.awt.Window parent)
Creates a dialog for the given parent frame. |
boolean |
getAutoCompleteFileNames()
Returns whether the filename text field auto-completes the next matching filename when the drop-down list is visible. |
javax.swing.filechooser.FileFilter[] |
getChoosableFileFilters()
Gets the list of user-choosable file filters. |
java.awt.Color |
getColorForExtension(java.lang.String extension)
Returns the color associated with a file type. |
java.io.File |
getCurrentDirectory()
Returns the directory this RTextFileChooser is currently
in. |
java.util.Map<java.lang.String,java.awt.Color> |
getCustomColorsMap()
Returns the map containing all file extensions and the colors used to color the names of files of those types. |
java.lang.String |
getCustomTitle()
Returns the custom title to use for this file chooser. |
static java.lang.String |
getDefaultEncoding()
Returns the default encoding for this operating system. |
java.awt.Color |
getDefaultFileColor()
Returns the color used to paint the name of files with unknown type. |
java.lang.String |
getDescription(java.io.File file)
Returns the description for the file displayed in the file chooser. |
int |
getDialogType()
Returns the last type of dialog displayed. |
java.lang.String |
getEncoding()
Returns a string representing the encoding chosen by the user. |
java.lang.String[] |
getFavorites()
Returns the "Favorite directories" of this file chooser, as an array of strings. |
javax.swing.filechooser.FileFilter |
getFileFilter()
Returns the currently-active file filter. |
int |
getFileSelectionMode()
Returns the file selection mode. |
boolean |
getFileSystemAware()
Returns whether or not the filename text field is file-system aware. |
javax.swing.filechooser.FileSystemView |
getFileSystemView()
Returns the file system view for this file chooser. |
FileTypeInfo |
getFileTypeInfoFor(java.io.File file)
Returns the file type info (color) to use when painting the specified file in this file chooser. |
java.awt.Color |
getHiddenFileColor()
Returns the color used to paint hidden files if hidden files are being shown. |
void |
getIcons()
Creates the icons used by this file chooser. |
java.lang.String |
getName(java.io.File f)
Returns the name of the file. |
int |
getOpenFilesStyle()
Returns the special styling used when displaying the names of opened files. |
java.io.File |
getSelectedFile()
Returns the file selected by the user. |
java.io.File[] |
getSelectedFiles()
Returns the files selected by the user. |
boolean |
getShowHiddenFiles()
Returns whether hidden files and directories are shown by the file chooser. |
java.lang.String |
getString(java.lang.String key)
Returns the localized text for a given key. |
boolean |
getStyleOpenFiles()
Returns whether "opened" files should have a special style applied to them when they are displayed in this file chooser (for example, being underlined). |
int |
getViewMode()
Returns the view mode. |
protected void |
initializeGUIComponents()
Initializes the GUI components for the file chooser. |
boolean |
isMultiSelectionEnabled()
Returns whether or not multi-selection is enabled. |
boolean |
isOpenedFile(java.io.File file)
Returns whether or not a file should be underlined when displayed by a view of this file chooser. |
int |
loadFavorites(java.io.File file)
Loads a list of "Favorites" from a file. |
void |
propertyChange(java.beans.PropertyChangeEvent e)
Called when a property we're listening to changes. |
protected void |
refreshEncodingComboBox()
If the GUI has been initialized, this sets the encoding combo box to display the proper value. |
boolean |
removeChoosableFileFilter(javax.swing.filechooser.FileFilter f)
Removes a filter from the list of user choosable file filters. |
void |
saveFavorites(java.io.File file)
Saves the list of "Favorites" of this file chooser to a file. |
void |
savePreferences()
Saves this file chooser's preferences (colors used for filenames, etc.). |
void |
setAutoCompleteFileNames(boolean auto)
Sets whether the filename text field auto-completes the next matching filename when the drop-down list is visible. |
void |
setColorForExtension(java.lang.String extension,
java.awt.Color color)
Sets the color associated with a file type. |
void |
setCurrentDirectory(java.io.File dir)
Sets the directory this RTextFileChooser is currently in. |
void |
setCurrentDirectory(java.lang.String dir)
Sets the directory this RTextFileChooser is currently in. |
void |
setCustomTitle(java.lang.String title)
Returns the title to use for this file chooser, whether it is an open dialog or a save dialog. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding selected by this file chooser. |
void |
setFileFilter(javax.swing.filechooser.FileFilter filter)
Sets the current file filter. |
protected void |
setFileFilterImpl(javax.swing.filechooser.FileFilter filter,
boolean cacheIfGUINotRealized)
Sets the current file filter. |
void |
setFileSelectionMode(int mode)
Sets whether the user can select files only, directories only, or both files and directories from this file chooser. |
void |
setFileSystemAware(boolean aware)
Sets whether the filename text field is "file system aware." |
void |
setHiddenFileColor(java.awt.Color color)
Sets the color used to display hidden files' names. |
void |
setInfoForExtension(java.lang.String extension,
java.awt.Color c)
Adds a color to associate with a file type. |
void |
setMultiSelectionEnabled(boolean enabled)
Sets whether or not multi-selection is enabled. |
void |
setOpenedFiles(java.io.File[] files)
Sets the list of files to be underlined if displayed in the file chooser. |
void |
setOpenFilesStyle(int style)
Sets the style that "opened" files should have applied to them when they are displayed in this file chooser (for example, being underlined). |
void |
setSelectedFile(java.io.File file)
Sets the file selected by the user. |
void |
setSelectedFiles(java.io.File[] files)
Sets the files selected by the user. |
void |
setSelectedFiles(java.util.List<java.io.File> files)
Sets the files selected by the user. |
void |
setShowHiddenFiles(boolean show)
Sets whether hidden files and directories are shown by the file chooser. |
void |
setStyleOpenFiles(boolean style)
Sets whether "opened" files should have a special style applied to them when they are displayed in this file chooser (for example, being underlined). |
void |
setViewMode(int mode)
Sets the view mode. |
protected void |
setViewModeImpl(int mode)
Does the dirty-work of setting the view mode. |
protected int |
showDialogImpl(java.awt.Window parent,
int dialogType)
Does all of the dirty-work for showOpenDialog and
showSaveDialog since much of what they do is the same. |
int |
showOpenDialog(java.awt.Window parent)
Displays an "Open" dialog. |
int |
showSaveDialog(java.awt.Window parent)
Displays a "Save As" dialog. |
void |
updateUI()
Updates any contained components when a Look and Feel change occurs. |
Methods inherited from class org.fife.ui.ResizableFrameContentPane |
---|
paint |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI |
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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
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, setLayout, 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 |
---|
public static final int LIST_MODE
public static final int DETAILS_MODE
public static final int ICONS_MODE
public static final int APPROVE_OPTION
public static final int CANCEL_OPTION
public static final int ERROR_OPTION
public static final int FILES_ONLY
public static final int DIRECTORIES_ONLY
public static final int FILES_AND_DIRECTORIES
public static final int OPEN_DIALOG
public static final int SAVE_DIALOG
public static final int STYLE_BOLD
public static final int STYLE_ITALIC
public static final int STYLE_UNDERLINE
protected org.fife.ui.rtextfilechooser.RTextFileChooserView view
Constructor Detail |
---|
public RTextFileChooser()
RTextFileChooser
.
public RTextFileChooser(boolean showEncodingCombo)
RTextFileChooser
.
showEncodingCombo
- Whether the encoding combo box should be
visible. This should be true
if this is a chooser
for text files, and false
if it is a chooser for
binary files.public RTextFileChooser(java.lang.String startDirectory)
RTextFileChooser
.
startDirectory
- The directory for the file chooser to "start" in.public RTextFileChooser(java.io.File startDirectory)
RTextFileChooser
.
startDirectory
- The directory for the file chooser to "start" in.public RTextFileChooser(boolean showEncodingCombo, java.io.File startDirectory)
RTextFileChooser
.
showEncodingCombo
- Whether the encoding combo box should be
visible. This should be true
if this is a chooser
for text files, and false
if it is a chooser for
binary files.startDirectory
- The directory for the file chooser to "start" in.Method Detail |
---|
public boolean addToFavorites(java.lang.String dir)
dir
- The directory to add to the "favorites" list.
false
,
then the directory specified is already in the "Favorites" list.
java.lang.NullPointerException
- If dir
is null
.getFavorites()
,
clearFavorites()
,
loadFavorites(File)
,
saveFavorites(File)
protected void initializeGUIComponents()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void addChoosableFileFilter(javax.swing.filechooser.FileFilter filter)
filter
- The file filter to add.removeChoosableFileFilter(javax.swing.filechooser.FileFilter)
,
getChoosableFileFilters()
public void approveSelection()
FILES_ONLY
, then the
file dialog will simply change to that directory.
Users who wish to subclass this class and provide a means of canceling
the dialog closing (such as an "are you sure you wish to overwrite?"
message) should override approveSelectionImpl()
. That method
is called at the end of this one, and the file chooser will only close
if that method returns true
.
protected boolean approveSelectionImpl()
approveSelection()
; the file chooser
dialog will only close if this method returns true
.
Subclasses can override this method to add things such as an "Are you
sure you want to overwrite?" message.
true
.public void cancelSelection()
public void clearExtensionColorMap()
getColorForExtension(java.lang.String)
,
setColorForExtension(java.lang.String, java.awt.Color)
public void clearFavorites()
addToFavorites(String)
,
getFavorites()
,
loadFavorites(File)
,
saveFavorites(File)
protected javax.swing.JDialog createDialog(java.awt.Window parent) throws java.awt.HeadlessException
parent
- The window that is to be the parent of the created dialog.
java.awt.HeadlessException
public boolean getAutoCompleteFileNames()
setAutoCompleteFileNames(boolean)
public javax.swing.filechooser.FileFilter[] getChoosableFileFilters()
FileFilter
array containing all the choosable
file filters.addChoosableFileFilter(javax.swing.filechooser.FileFilter)
,
removeChoosableFileFilter(javax.swing.filechooser.FileFilter)
public java.awt.Color getColorForExtension(java.lang.String extension)
extension
- The extension for which to get the associated image.
null
if there is none.setColorForExtension(java.lang.String, java.awt.Color)
,
clearExtensionColorMap()
public final java.io.File getCurrentDirectory()
RTextFileChooser
is currently
in.
setCurrentDirectory(java.io.File)
public java.util.Map<java.lang.String,java.awt.Color> getCustomColorsMap()
So, for example, with the returned HashMap
you can iterate
through its keys (the extensions) to get the color used by this
file chooser to display files with those extensions.
public java.lang.String getCustomTitle()
null
if default values for
"Open" and "Save" dialogs should be used.setCustomTitle(String)
public static final java.lang.String getDefaultEncoding()
public java.awt.Color getDefaultFileColor()
public java.lang.String getDescription(java.io.File file)
file
- The file for which to get the description.
public int getDialogType()
OPEN_DIALOG
or SAVE_DIALOG
.showOpenDialog(Window)
,
showSaveDialog(Window)
public java.lang.String getEncoding()
setEncoding(java.lang.String)
public java.lang.String[] getFavorites()
addToFavorites(String)
,
clearFavorites()
,
loadFavorites(File)
,
saveFavorites(File)
public javax.swing.filechooser.FileFilter getFileFilter()
setFileFilter(javax.swing.filechooser.FileFilter)
public int getFileSelectionMode()
FILES_ONLY
, DIRECTORIES_ONLY
,
or FILES_AND_DIRECTORIES
.setFileSelectionMode(int)
public boolean getFileSystemAware()
setFileSystemAware(boolean)
public javax.swing.filechooser.FileSystemView getFileSystemView()
public FileTypeInfo getFileTypeInfoFor(java.io.File file)
file
- The file.
public java.awt.Color getHiddenFileColor()
setHiddenFileColor(java.awt.Color)
public void getIcons()
public java.lang.String getName(java.io.File f)
f
- The file for which you want its name.
public int getOpenFilesStyle()
STYLE_BOLD
,
STYLE_ITALIC
or STYLE_UNDERLINE
.setOpenFilesStyle(int)
,
getStyleOpenFiles()
public java.io.File getSelectedFile()
getSelectedFile
in interface FileSelector
getSelectedFiles()
,
setSelectedFile(File)
,
setSelectedFiles(File[])
public java.io.File[] getSelectedFiles()
getSelectedFiles
in interface FileSelector
getSelectedFile()
,
setSelectedFile(java.io.File)
,
setSelectedFiles(java.util.List)
public boolean getShowHiddenFiles()
setShowHiddenFiles(boolean)
public java.lang.String getString(java.lang.String key)
key
- The key.
public boolean getStyleOpenFiles()
setStyleOpenFiles(boolean)
,
setOpenFilesStyle(int)
public int getViewMode()
LIST_MODE
, DETAILS_MODE
, or
ICONS_MODE
.setViewMode(int)
public final boolean isMultiSelectionEnabled()
setMultiSelectionEnabled(boolean)
public boolean isOpenedFile(java.io.File file)
file
- A file.
file
should be underlined by the
view.setOpenedFiles(File[])
public int loadFavorites(java.io.File file) throws java.io.IOException
#
' character
are ignored.
file
- The favorites file to load.
java.io.IOException
- If an IO error occurs.addToFavorites(String)
,
clearFavorites()
,
getFavorites()
,
saveFavorites(File)
public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange
in interface java.beans.PropertyChangeListener
e
- The event.protected void refreshEncodingComboBox()
public boolean removeChoosableFileFilter(javax.swing.filechooser.FileFilter f)
true
if the file filter was removed.addChoosableFileFilter(javax.swing.filechooser.FileFilter)
,
getChoosableFileFilters()
public void saveFavorites(java.io.File file) throws java.io.IOException
loadFavorites(File)
. If there are no Favorites for this
file chooser, an empty file is created.
file
- The file to write to. If it already exists, it will be
overwritten.
java.io.IOException
- If an IO error occurs writing the file.addToFavorites(String)
,
clearFavorites()
,
getFavorites()
,
loadFavorites(File)
public void savePreferences()
public void setAutoCompleteFileNames(boolean auto)
auto
- Whether the next matching filename is auto-inserted.getAutoCompleteFileNames()
public void setColorForExtension(java.lang.String extension, java.awt.Color color)
extension
- The extension for which to set the associated color.color
- The new color to associate with this extension. A value
of null
makes the default color used.getColorForExtension(java.lang.String)
,
clearExtensionColorMap()
public void setCurrentDirectory(java.io.File dir)
RTextFileChooser
is currently in.
dir
- The new current directory. If this value isn't a valid
directory, The user's home directory is used.getCurrentDirectory()
public void setCurrentDirectory(java.lang.String dir)
RTextFileChooser
is currently in.
dir
- The new current directory. If this value isn't a valid
directory, The user's home directory is used.getCurrentDirectory()
public void setCustomTitle(java.lang.String title)
title
- The new title. If this is null
, a default
title will be used appropriately (e.g. a localized version of
"Open" or "Save").getCustomTitle()
public void setEncoding(java.lang.String encoding)
encoding
- The desired encoding. If this value is invalid or
not supported by this OS, a system default is used.getEncoding()
public void setFileFilter(javax.swing.filechooser.FileFilter filter)
filter
- The new current file filter to use. If this is
null
, the "all files" filter is selected.getFileFilter()
protected void setFileFilterImpl(javax.swing.filechooser.FileFilter filter, boolean cacheIfGUINotRealized)
filter
- The new current file filter to use. If this is
null
, the "all files" filter is selected.cacheIfGUINotRealized
- If the GUI isn't created, whether or not
the selected file filter should be set to this filter when it
is created. This parameter is here because
addChoosableFileFilter
calls this method, but that
method should not change the selected file filter.getFileFilter()
public void setFileSelectionMode(int mode)
mode
- One of FILES_ONLY
, DIRECTORIES_ONLY
,
or FILES_AND_DIRECTORIES
.getFileSelectionMode()
public void setFileSystemAware(boolean aware)
aware
- Whether the filename text field will be helpful and
provide possible filename matches while you are typing in it.
This feature can be disabled for slow networks.getFileSystemAware()
public void setHiddenFileColor(java.awt.Color color)
color
- The new color to use for the names of hidden files.
java.lang.NullPointerException
- If color
is null
.getHiddenFileColor()
public void setInfoForExtension(java.lang.String extension, java.awt.Color c)
extension
- The extension to associate an image and color with.c
- The color to associate with this extension.public void setMultiSelectionEnabled(boolean enabled)
enabled
- Whether or not multi-selection is to be enabled.isMultiSelectionEnabled()
public void setOpenedFiles(java.io.File[] files)
files
- The files to underline. Note that they need not all
reside in the same directory. To clear all underlined
files, pass null
in for this value.isOpenedFile(File)
public void setOpenFilesStyle(int style)
style
- The style to apply. If this is invalid,
STYLE_UNDERLINE
is used.getOpenFilesStyle()
,
setStyleOpenFiles(boolean)
public void setSelectedFile(java.io.File file)
file
- The file selected by the user.getSelectedFile()
,
getSelectedFiles()
,
setSelectedFiles(java.util.List)
public void setSelectedFiles(java.util.List<java.io.File> files)
files
- The files selected by the user.getSelectedFile()
,
getSelectedFiles()
,
setSelectedFile(java.io.File)
public void setSelectedFiles(java.io.File[] files)
files
- The files selected by the user.getSelectedFile()
,
getSelectedFiles()
,
setSelectedFile(java.io.File)
public void setShowHiddenFiles(boolean show)
show
- Whether to show hidden files.getShowHiddenFiles()
public void setStyleOpenFiles(boolean style)
style
- Whether opened files should have a style applied.getStyleOpenFiles()
,
setOpenFilesStyle(int)
public void setViewMode(int mode)
mode
- One of LIST_MODE
, DETAILS_MODE
, or
ICONS_MODE
.getViewMode()
protected void setViewModeImpl(int mode)
mode
- The new view mode.protected int showDialogImpl(java.awt.Window parent, int dialogType)
showOpenDialog
and
showSaveDialog
since much of what they do is the same.
parent
- The parent of this open/save dialog.dialogType
- Either OPEN_DIALOG
or SAVE_DIALOG
.public int showOpenDialog(java.awt.Window parent)
parent
- The window or dialog that owns this file chooser dialog.
APPROVE_OPTION
, CANCEL_OPTION
,
or ERROR_OPTION
.public int showSaveDialog(java.awt.Window parent)
parent
- The window or dialog that owns this file chooser dialog.
APPROVE_OPTION
, CANCEL_OPTION
,
or ERROR_OPTION
.public void updateUI()
updateUI
method, as JDialog
doesn't have one. Rather, this method
should be explicitly called whenever a LnF change occurs to ensure that
the popup menu gets its UI updated.
updateUI
in class javax.swing.JPanel
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |