public class FileDialog extends Dialog
FileDialogクラスは、ユーザーがファイルを選択できるダイアログ・ウィンドウを表示します。
このダイアログはモーダルであるため、アプリケーションがそのshowメソッドを呼び出してこのダイアログを表示すると、ユーザーがファイルを選択するまでアプリケーションのほかの部分は使用できません。
Window.show(), 直列化された形式Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeWindow.AccessibleAWTWindow, Window.TypeContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| 修飾子と型 | フィールドと説明 |
|---|---|
static int |
LOAD
この定数値は、ファイル・ダイアログ・ウィンドウの目的が読込み用ファイルの検索であることを示します。
|
static int |
SAVE
この定数値は、ファイル・ダイアログ・ウィンドウの目的が書込み用ファイルの検索であることを示します。
|
DEFAULT_MODALITY_TYPEaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, 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()
このファイル・ダイアログのファイル名フィルタを調べます。
|
File[] |
getFiles()
ユーザーが選択するファイルを返します。
|
int |
getMode()
このファイル・ダイアログ・ボックスがファイルからロードするためのものか、ファイルに保存するためのものかを示します。
|
boolean |
isMultipleMode()
ファイル・ダイアログで複数ファイル選択が許可されるかどうかを返します。
|
protected String |
paramString()
この
FileDialogウィンドウの状態を表す文字列表現を返します。 |
void |
setDirectory(String dir)
このファイル・ダイアログ・ウィンドウのディレクトリを指定されたディレクトリに設定します。
|
void |
setFile(String file)
このファイル・ダイアログ・ウィンドウの選択されているファイルを、指定されたファイルに設定します。
|
void |
setFilenameFilter(FilenameFilter filter)
ファイル・ダイアログ・ウィンドウのファイル名フィルタを指定されたフィルタに設定します。
|
void |
setMode(int mode)
ファイル・ダイアログのモードを設定します。
|
void |
setMultipleMode(boolean enable)
ファイル・ダイアログでの複数ファイル選択を有効または無効にします。
|
getAccessibleContext, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBackaddPropertyChangeListener, 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, processWindowEvent, 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, toFrontadd, 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, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTreeaction, 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, getGraphics, getGraphicsConfiguration, 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, 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, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic 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, SAVEpublic 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値は、NullPointerExceptionがスローされることなく受け入れられるmode - ダイアログのモードであり、FileDialog.LOADまたはFileDialog.SAVEのどちらかIllegalArgumentException - 不正なファイル・ダイアログのモードが指定された場合IllegalArgumentException - parentのGraphicsConfigurationが画面デバイスのものでない場合IllegalArgumentException - parentがnullである場合。GraphicsEnvironment.isHeadlessがtrueを返した場合は、この例外が常にスローされるGraphicsEnvironment.isHeadless(), LOAD, SAVEpublic void addNotify()
addNotify、クラス: DialogComponent.isDisplayable(), Window.removeNotify()public int getMode()
FileDialog.LOADまたはFileDialog.SAVELOAD, SAVE, setMode(int)public void setMode(int mode)
modeが不当な値の場合は例外がスローされ、modeは設定されません。mode - このファイル・ダイアログのモード。FileDialog.LOADまたはFileDialog.SAVEIllegalArgumentException - 不正なファイル・ダイアログのモードが指定された場合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が返されます。nullsetFile(java.lang.String)public File[] getFiles()
ユーザーがファイル・ダイアログを取り消した場合、このメソッドは空の配列を返します。
setFile(String), getFile()public void setFile(String file)
ダイアログを表示したときに、指定されたファイルが選択されます。選択の種類は、ファイルの有無、ダイアログ型およびネイティブ・プラットフォームによって異なります。たとえば、ファイル・リスト内でファイルが強調表示されたり、ファイル名の編集ボックスにファイル名が設定されたりします。
このメソッドはファイルのフル・パスを受け入れます。setDirectoryメソッドを組み合わせて使用した場合は、拡張子付きのファイル名を受け入れます。
ファイルとして""を指定すると、nullに設定されます。
file - 設定されるファイルgetFile(), getFiles()public void setMultipleMode(boolean enable)
enable - trueの場合は複数ファイル選択が有効、falseの場合は無効。isMultipleMode()public boolean isMultipleMode()
true、そうでない場合はfalse。setMultipleMode(boolean)public FilenameFilter getFilenameFilter()
FilenameFilter, setFilenameFilter(java.io.FilenameFilter)public void setFilenameFilter(FilenameFilter filter)
filter - 指定されたフィルタFilenameFilter, getFilenameFilter()protected String paramString()
FileDialogウィンドウの状態を表す文字列表現を返します。このメソッドはデバッグ専用であり、返される文字列の内容および形式は実装によって異なる場合があります。返される文字列は空の場合がありますが、nullにはなりません。paramString、クラス: Dialog バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright© 1993, 2014, Oracle and/or its affiliates. All rights reserved.