©
本文档使用
php中文网手册 发布
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
java.awt.FileDialog
public class FileDialog
FileDialog 类显示一个对话框窗口,用户可以从中选择文件。
由于它是一个模式对话框,当应用程序调用其 show 方法来显示对话框时,它将阻塞其余应用程序,直到用户选择一个文件。
Window.show(),
序列化表格| 嵌套类摘要 |
|---|
| 从类 java.awt.Dialog 继承的嵌套类/接口 |
|---|
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType |
| 从类 java.awt.Window 继承的嵌套类/接口 |
|---|
Window.AccessibleAWTWindow |
| 从类 java.awt.Container 继承的嵌套类/接口 |
|---|
Container.AccessibleAWTContainer |
| 从类 java.awt.Component 继承的嵌套类/接口 |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| 字段摘要 | |
|---|---|
static int |
LOAD
此常量值指示文件对话框窗口的作用是查找要读取的文件。 |
static int |
SAVE
此常量值指示文件对话框窗口的作用是查找要写入的文件。 |
| 从类 java.awt.Dialog 继承的字段 |
|---|
DEFAULT_MODALITY_TYPE |
| 从类 java.awt.Component 继承的字段 |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| 从接口 java.awt.image.ImageObserver 继承的字段 |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| 构造方法摘要 | |
|---|---|
FileDialog(Dialog parent)
创建一个文件对话框,用于加载文件。 |
|
FileDialog(Dialog parent,
String title)
创建一个具有指定标题的文件对话框,用于加载文件。 |
|
FileDialog(Dialog parent,
String title,
int mode)
创建一个具有指定标题的文件对话框窗口,用于加载或保存文件。 |
|
FileDialog(Frame parent)
创建一个文件对话框,用于加载文件。 |
|
FileDialog(Frame parent,
String title)
创建一个具有指定标题的文件对话框窗口,用于加载文件。 |
|
FileDialog(Frame parent,
String title,
int mode)
创建一个具有指定标题的文件对话框窗口,用于加载或保存文件。 |
|
| 方法摘要 | |
|---|---|
void |
addNotify()
创建文件对话框的同位体。 |
String |
getDirectory()
获取此文件对话框的目录。 |
String |
getFile()
获取此文件对话框的选定文件。 |
FilenameFilter |
getFilenameFilter()
确定此文件对话框的文件名过滤器。 |
int |
getMode()
指示此文件对话框是用于从文件加载内容还是将内容保存到文件。 |
protected String |
paramString()
返回表示此 FileDialog 窗口状态的字符串。 |
void |
setDirectory(String dir)
将此文件对话框窗口的目录设置为指定目录。 |
void |
setFile(String file)
将此文件对话框窗口的选定文件设置为指定文件。 |
void |
setFilenameFilter(FilenameFilter filter)
将此文件对话框窗口的文件名过滤器设置为指定的过滤器。 |
void |
setMode(int mode)
设置文件对话框的模式。 |
| 从类 java.awt.Dialog 继承的方法 |
|---|
getAccessibleContext, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setModalityType, setResizable, setTitle, setUndecorated, setVisible, show, toBack |
| 从类 java.awt.Window 继承的方法 |
|---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront |
| 从类 java.awt.Container 继承的方法 |
|---|
add, add, add, add, add, addContainerListener, addImpl, 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, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree |
| 从类 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, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, 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, isOpaque, 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, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
public static final int LOAD
public static final int SAVE
| 构造方法详细信息 |
|---|
public FileDialog(Frame parent)
FileDialog(parent, "", LOAD) 的一个便捷方法。
parent - 对话框的所有者
public FileDialog(Frame parent,
String title)
FileDialog(parent, title, LOAD) 的一个便捷方法。
parent - 对话框的所有者title - 对话框的标题
public FileDialog(Frame parent,
String title,
int mode)
如果 mode 的值为 LOAD,那么文件对话框将查找要读取的文件,所显示的文件是当前目录中的文件。如果 mode 的值为 SAVE,则文件对话框将查找要写入文件的位置。
parent - 对话框的所有者title - 对话框的标题mode - 对话框的模式,可以是 FileDialog.LOAD 或 FileDialog.SAVE
IllegalArgumentException - 如果提供了非法的文件对话框模式LOAD,
SAVE
public FileDialog(Dialog parent)
FileDialog(parent, "", LOAD) 的一个便捷方法。
parent - 对话框的所有者
IllegalArgumentException - 如果 parent 的 GraphicsConfiguration 不是来自屏幕设备;
IllegalArgumentException - 如果 parent 为 null;当 GraphicsEnvironment.isHeadless 返回 true 时始终抛出此异常GraphicsEnvironment.isHeadless()
public FileDialog(Dialog parent,
String title)
FileDialog(parent, title, LOAD) 的一个便捷方法。
parent - 对话框的所有者title - 对话框的标题;接受 null 值时不会抛出 NullPointerException
IllegalArgumentException - 如果 parent 的 GraphicsConfiguration 不是来自屏幕设备;
IllegalArgumentException - 如果 parent 为 null;当 GraphicsEnvironment.isHeadless 返回 true 时始终抛出此异常GraphicsEnvironment.isHeadless()
public FileDialog(Dialog parent,
String title,
int mode)
如果 mode 的值为 LOAD,那么文件对话框将查找要读取的文件,所显示的文件是当前目录中的文件。如果 mode 的值为 SAVE,则文件对话框将查找要写入文件的位置。
parent - 对话框的所有者title - 对话框的标题;接受 null 值时不会抛出 NullPointerExceptionmode - 对话框的模式,FileDialog.LOAD 或 FileDialog.SAVE
IllegalArgumentException - 如果提供了非法的文件对话框模式;
IllegalArgumentException - 如果 parent 的 GraphicsConfiguration 不是来自屏幕设备;
IllegalArgumentException - 如果 parent 为 null;当 GraphicsEnvironment.isHeadless 返回 true 时始终抛出此异常GraphicsEnvironment.isHeadless(),
LOAD,
SAVE
| 方法详细信息 |
|---|
public void addNotify()
Dialog 中的 addNotify
Component.isDisplayable(),
Window.removeNotify()
public int getMode()
FileDialog.LOAD 或 FileDialog.SAVE
LOAD,
SAVE,
setMode(int)
public void setMode(int mode)
mode 不是一个合法值,则抛出一个异常,并且不设置 mode。
mode - 文件对话框的模式,可以是 FileDialog.LOAD 或 FileDialog.SAVE
IllegalArgumentException - 如果提供了非法的文件对话框模式LOAD,
SAVE,
getMode()
public String getDirectory()
FileDialog 的目录(可能为 null 或无效)setDirectory(java.lang.String)public void setDirectory(String dir)
null 或无效目录意味着指定由实现所定义的默认值。但是,在用户选择一个文件之前,此默认值不会被实现。在此之前,getDirectory() 将返回传递到此方法的值。
指定 "" 作为目录,完全等同于指定 null 作为目录。
dir - 指定的目录getDirectory()public String getFile()
CANCEL,则返回文件为 null。
null
setFile(java.lang.String)public void setFile(String file)
指定 "" 作为文件,完全等同于指定 null 作为文件。
file - 正被设置的文件 setgetFile()public FilenameFilter getFilenameFilter()
FilenameFilter,
setFilenameFilter(java.io.FilenameFilter)
public void setFilenameFilter(FilenameFilter filter)
filter - 指定的过滤器FilenameFilter,
getFilenameFilter()
protected String paramString()
FileDialog 窗口状态的字符串。此方法仅在进行调试的时候使用,对于不同的实现,返回的字符串的内容和格式可能有所不同。返回的字符串可能为空,但不可能为 null。
Dialog 中的 paramString
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。