JavaTM 2
Platform
Std. Ed. v1.4.0

java.awt
クラス Dialog

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Dialog
すべての実装インタフェース:
Accessible, ImageObserver, MenuContainer, Serializable
直系の既知のサブクラス:
FileDialog, JDialog

public class Dialog
extends Window

ダイアログはタイトルとボーダを持つトップレベルのウィンドウであり、ユーザが何らかの入力を行うために通常使用されます。ダイアログのサイズには、ボーダのために指定された領域が含まれます。ボーダ領域の寸法は getInsets メソッドを使うことにより取得できます。ただし、ボーダ領域の寸法はプラットフォームに依存するので、pack または show のどちらかを呼び出してダイアログを表示可能にしないと正確なインセット値は取得できません。ボーダ領域はダイアログ全体のサイズに含まれているため、ダイアログの一部が隠れてしまうことがあります。このため、サブコンポーネントを描画および表示するための領域は、左上隅の位置が (insets.left, insets.top) であり、幅 width - (insets.left + insets.right)、高さ height - (insets.top + insets.bottom) の矩形に制限されます。

ダイアログのデフォルトのレイアウトは BorderLayout です。

ダイアログはネイティブな装飾 (FrameTitlebar) を持つことができ、setUndecorated でこれを無効化できます。フレームが displayable の状態でない時にだけ無効化できます。

ダイアログを作成するときには、フレームまたはもう 1 つのダイアログをその所有者として定義しなければなりません。表示されているダイアログの所有者ウィンドウが非表示になった場合や最小化された場合、そのダイアログは自動的にユーザに対して表示されなくなります。オーナウィンドウがまた開かれると、ダイアログは再びユーザに対して表示されます。

マルチスクリーン環境では、Dialog を所有者とは別の画面デバイス上に生成することができます。詳細は Frame を参照してください。

ダイアログは、モードなし (デフォルト) またはモーダルのどちらかになります。モーダルダイアログの場合、そのダイアログを所有者として生成されたウィンドウを除き、アプリケーションのほかのトップレベルウィンドウへの入力はできなくなります。

ダイアログは、WindowOpenedWindowClosingWindowClosedWindowActivatedWindowDeactivatedWindowGainedFocus、および WindowLostFocusWindowEvents を生成できます。

導入されたバージョン:
JDK1.0
関連項目:
WindowEvent, Window.addWindowListener(java.awt.event.WindowListener), 直列化された形式

入れ子クラスの概要
protected  class Dialog.AccessibleAWTDialog
          このクラスは Dialog クラス用のユーザ補助機能のサポートを実装しています。
 
クラス java.awt.Window から継承した入れ子クラス
 
クラス java.awt.Container から継承した入れ子クラス
 
クラス java.awt.Component から継承した入れ子クラス
Component.BltBufferStrategy, Component.FlipBufferStrategy
 
フィールドの概要
 
クラス 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
 
コンストラクタの概要
Dialog(Dialog owner)
          空のタイトルおよび指定された所有者ダイアログを持ち、最初は表示されず、モーダルではない Dialog を構築します。
Dialog(Dialog owner, String title)
          指定された所有者フレームおよびタイトルを持ち、最初は表示されず、モーダルではない Dialog を構築します。
Dialog(Dialog owner, String title, boolean modal)
          指定された所有者フレームおよびタイトルを持ち、モーダルであるかどうかを指定された、最初は表示されない Dialog を構築します。
Dialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc)
          指定された所有者フレーム、タイトル、および GraphicsConfiguration を持ち、モーダルであるかどうかを指定された、最初は表示されない Dialog を構築します。
Dialog(Frame owner)
          空のタイトルおよび指定された所有者フレームを持ち、最初は表示されない、モーダルではない Dialog を構築します。
Dialog(Frame owner, boolean modal)
          空のタイトルおよび指定された所有者フレームを持ち、モーダルであるかどうかを指定された、最初は表示されない Dialog を構築します。
Dialog(Frame owner, String title)
          指定されたオーナフレームおよびタイトルを持ち、最初は表示されず、モーダルではない Dialog を構築します。
Dialog(Frame owner, String title, boolean modal)
          指定されたオーナフレームおよびタイトルを持ち、モーダルであるかどうかを指定された、最初は表示されない Dialog を構築します。
Dialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc)
          指定された所有者フレーム、タイトル、および GraphicsConfiguration を持ち、モーダルであるかどうかを指定された、最初は表示されない Dialog を構築します。
 
メソッドの概要
 void addNotify()
          ネイティブスクリーンリソースに接続することにより、この Dialog を表示可能にします。
 void dispose()
          現在ブロックされている場合は、Dialog を破棄して show() を返します。
 AccessibleContext getAccessibleContext()
          このダイアログに関連した AccessibleContext を返します。
 String getTitle()
          ダイアログのタイトルを返します。
 void hide()
          現在ブロックされている場合は、Dialog を非表示にし、show() を返します。
 boolean isModal()
          ダイアログがモーダルであるかどうかを示します。
 boolean isResizable()
          ユーザがこのダイアログのサイズを変更できるかどうかを示します。
 boolean isUndecorated()
          このダイアログが装飾を持たないことを示します。
protected  String paramString()
          このダイアログの状態を表す文字列を返します。
 void setModal(boolean b)
          ダイアログがモーダルかどうかを指定します。
 void setResizable(boolean resizable)
          ユーザがこのダイアログのサイズを変更できるかどうかを設定します。
 void setTitle(String title)
          Dialog のタイトルを設定します。
 void setUndecorated(boolean undecorated)
          このダイアログの装飾の有効化と無効化を切り替えます。
 void show()
          ダイアログを表示します。
 
クラス java.awt.Window から継承したメソッド
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, 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, 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, isOpaque, 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, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
クラス java.lang.Object から継承したメソッド
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

コンストラクタの詳細

Dialog

public Dialog(Frame owner)
空のタイトルおよび指定された所有者フレームを持ち、最初は表示されない、モーダルではない Dialog を構築します。

パラメータ:
owner - ダイアログの所有者
例外:
IllegalArgumentException - ownerGraphicsConfiguration が画面デバイスからのものでない場合
IllegalArgumentException - ownernull の場合。この例外は GraphicsEnvironment.isHeadlesstrue の場合は常にスローされる
関連項目:
GraphicsEnvironment.isHeadless(), Component.setSize(int, int), Component.setVisible(boolean)

Dialog

public Dialog(Frame owner,
              boolean modal)
空のタイトルおよび指定された所有者フレームを持ち、モーダルであるかどうかを指定された、最初は表示されない Dialog を構築します。

パラメータ:
owner - ダイアログの所有者
modal - true の場合、ダイアログが表示されているときは、ほかのアプリケーションウィンドウへの入力は不可
例外:
IllegalArgumentException - ownerGraphicsConfiguration が画面デバイスからのものでない場合
IllegalArgumentException - ownernull の場合。この例外は GraphicsEnvironment.isHeadlesstrue の場合は常にスローされる
関連項目:
GraphicsEnvironment.isHeadless()

Dialog

public Dialog(Frame owner,
              String title)
指定されたオーナフレームおよびタイトルを持ち、最初は表示されず、モーダルではない Dialog を構築します。

パラメータ:
owner - ダイアログの所有者
title - ダイアログのタイトル。null 値も指定可能であり、NullPointerException はスローされない
例外:
IllegalArgumentException - ownerGraphicsConfiguration が画面デバイスからのものでない場合
IllegalArgumentException - ownernull の場合。この例外は GraphicsEnvironment.isHeadlesstrue の場合は常にスローされる
関連項目:
GraphicsEnvironment.isHeadless(), Component.setSize(int, int), Component.setVisible(boolean)

Dialog

public Dialog(Frame owner,
              String title,
              boolean modal)
指定されたオーナフレームおよびタイトルを持ち、モーダルであるかどうかを指定された、最初は表示されない Dialog を構築します。

パラメータ:
owner - ダイアログの所有者
title - ダイアログのタイトル。null 値も指定可能であり、NullPointerException はスローされない
modal - true の場合、ダイアログが表示されたときは、ほかのアプリケーションウィンドウへの入力は不可
例外:
IllegalArgumentException - ownerGraphicsConfiguration が画面デバイスからのものでない場合
IllegalArgumentException - ownernull の場合。この例外は GraphicsEnvironment.isHeadlesstrue の場合は常にスローされる
関連項目:
GraphicsEnvironment.isHeadless(), Component.setSize(int, int), Component.setVisible(boolean)

Dialog

public Dialog(Frame owner,
              String title,
              boolean modal,
              GraphicsConfiguration gc)
指定された所有者フレーム、タイトル、および GraphicsConfiguration を持ち、モーダルであるかどうかを指定された、最初は表示されない Dialog を構築します。

パラメータ:
owner - ダイアログの所有者
title - ダイアログのタイトル。null 値も指定可能であり、NullPointerException はスローされない
modal - true の場合、ダイアログが表示されたときは、ほかのアプリケーションウィンドウへの入力は不可
gc - ターゲットスクリーンデバイスの GraphicsConfigurationgcnull の場合は、同じ GraphicsConfiguration を所有フレームとして使用
例外:
IllegalArgumentException - ownernull の場合。この例外は GraphicsEnvironment.isHeadless() が true の場合は常にスローされる
導入されたバージョン:
1.4
関連項目:
GraphicsEnvironment.isHeadless(), Component.setSize(int, int), Component.setVisible(boolean)

Dialog

public Dialog(Dialog owner)
空のタイトルおよび指定された所有者ダイアログを持ち、最初は表示されず、モーダルではない Dialog を構築します。

パラメータ:
owner - ダイアログの所有者
例外:
IllegalArgumentException - ownernull の場合。この例外は GraphicsEnvironment.isHeadless() が true の場合は常にスローされる
導入されたバージョン:
1.2
関連項目:
GraphicsEnvironment.isHeadless()

Dialog

public Dialog(Dialog owner,
              String title)
指定された所有者フレームおよびタイトルを持ち、最初は表示されず、モーダルではない Dialog を構築します。

パラメータ:
owner - ダイアログの所有者
title - ダイアログのタイトル。null 値も指定可能であり、NullPointerException はスローされない
例外:
IllegalArgumentException - ownernull の場合。この例外は GraphicsEnvironment.isHeadless() が true の場合は常にスローされる
導入されたバージョン:
1.2
関連項目:
GraphicsEnvironment.isHeadless()

Dialog

public Dialog(Dialog owner,
              String title,
              boolean modal)
指定された所有者フレームおよびタイトルを持ち、モーダルであるかどうかを指定された、最初は表示されない Dialog を構築します。

パラメータ:
owner - ダイアログの所有者
title - ダイアログのタイトル。null 値も指定可能であり、NullPointerException はスローされない
modal - true の場合、ダイアログが表示されたときは、ほかのアプリケーションウィンドウへの入力は不可
例外:
IllegalArgumentException - ownerGraphicsConfiguration が画面デバイスからのものでない場合
IllegalArgumentException - ownernull の場合。この例外は GraphicsEnvironment.isHeadlesstrue の場合は常にスローされる
導入されたバージョン:
1.2
関連項目:
GraphicsEnvironment.isHeadless()

Dialog

public Dialog(Dialog owner,
              String title,
              boolean modal,
              GraphicsConfiguration gc)
指定された所有者フレーム、タイトル、および GraphicsConfiguration を持ち、モーダルであるかどうかを指定された、最初は表示されない Dialog を構築します。

パラメータ:
owner - ダイアログの所有者
title - ダイアログのタイトル。null 値も指定可能であり、NullPointerException はスローされない
modal - true の場合、ダイアログが表示されたときは、ほかのアプリケーションウィンドウへの入力は不可
gc - ターゲットスクリーンデバイスの GraphicsConfigurationgcnull の場合は、同じ GraphicsConfiguration を所有ダイアログとして使用
例外:
IllegalArgumentException - ownerGraphicsConfiguration が画面デバイスからのものでない場合
IllegalArgumentException - ownernull の場合。この例外は GraphicsEnvironment.isHeadlesstrue の場合は常にスローされる
導入されたバージョン:
1.4
関連項目:
GraphicsEnvironment.isHeadless(), Component.setSize(int, int), Component.setVisible(boolean)
メソッドの詳細

addNotify

public void addNotify()
ネイティブスクリーンリソースに接続することにより、この Dialog を表示可能にします。ダイアログを表示可能にすると、そのダイアログのすべての子も表示可能になります。このメソッドはツールキットによって内部で呼び出され、プログラムから直接呼び出されることはありません。

オーバーライド:
クラス Window 内の addNotify
関連項目:
Component.isDisplayable(), Container.removeNotify()

isModal

public boolean isModal()
ダイアログがモーダルであるかどうかを示します。モーダルダイアログが表示されると、このダイアログを所有者として作成されたウィンドウを除き、アプリケーションコンテキストのほかのウィンドウへのユーザ入力はできません。

戻り値:
このダイアログウィンドウがモーダルの場合は true、そうでない場合は false
関連項目:
setModal(boolean)

setModal

public void setModal(boolean b)
ダイアログがモーダルかどうかを指定します。

導入されたバージョン:
JDK1.1
関連項目:
isModal()

getTitle

public String getTitle()
ダイアログのタイトルを返します。タイトルは、ダイアログのボーダに表示されます。

戻り値:
このダイアログウィンドウのタイトル。null の可能性もあり
関連項目:
setTitle(java.lang.String)

setTitle

public void setTitle(String title)
Dialog のタイトルを設定します。

パラメータ:
title - ダイアログのボーダに表示されるタイトル。null の場合、空のタイトルが表示される
関連項目:
getTitle()

show

public void show()
ダイアログを表示します。ダイアログまたはその所有者がまだ表示可能でない場合は、その両方が表示可能になります。ダイアログは、表示される前に検査されます。ダイアログがすでに表示されている場合、このメソッドはダイアログを前面に表示します。

ダイアログがモーダルでまだ見えない場合、hide または dispose を呼び出すことによりダイアログを隠すまでは、この呼び出しは返されません。イベントをディスパッチするスレッドからモーダルダイアログを表示することができます。ツールキットでは、このメソッドを呼び出したスレッドがブロックされていても別のイベントポンプが実行されるためです。

オーバーライド:
クラス Window 内の show
関連項目:
Component.hide(), Component.isDisplayable(), Component.validate(), isModal()

hide

public void hide()
現在ブロックされている場合は、Dialog を非表示にし、show() を返します。

オーバーライド:
クラス Window 内の hide
関連項目:
Window.show(), Window.dispose()

dispose

public void dispose()
現在ブロックされている場合は、Dialog を破棄して show() を返します。

オーバーライド:
クラス Window 内の dispose
関連項目:
Component.isDisplayable(), Window.pack(), Window.show()

isResizable

public boolean isResizable()
ユーザがこのダイアログのサイズを変更できるかどうかを示します。

戻り値:
ユーザがダイアログのサイズを変更できる場合は true、そうでない場合は false
関連項目:
setResizable(boolean)

setResizable

public void setResizable(boolean resizable)
ユーザがこのダイアログのサイズを変更できるかどうかを設定します。

パラメータ:
resizable - ユーザがダイアログのサイズを変更できる場合は true、そうでない場合は false
関連項目:
isResizable()

setUndecorated

public void setUndecorated(boolean undecorated)
このダイアログの装飾の有効化と無効化を切り替えます。ダイアログが表示されていない時にだけ呼び出すことができます。

パラメータ:
undecorated - 有効化できるダイアログ装飾がない場合は true、ある場合は false
例外:
IllegalComponentStateException - ダイアログが表示可能な場合
導入されたバージョン:
1.4
関連項目:
isUndecorated(), Component.isDisplayable()

isUndecorated

public boolean isUndecorated()
このダイアログが装飾を持たないことを示します。デフォルトではすべてのダイアログが装飾を持ちます。

戻り値:
このダイアログが装飾を持たない場合は true、持つ場合は false
導入されたバージョン:
1.4
関連項目:
setUndecorated(boolean)

paramString

protected String paramString()
このダイアログの状態を表す文字列を返します。このメソッドは、デバッグ専用であり、返される文字列の内容および形式は実装によって異なります。返される文字列は空の場合がありますが、null にはなりません。

オーバーライド:
クラス Container 内の paramString
戻り値:
このダイアログウィンドウのパラメータ文字列

getAccessibleContext

public AccessibleContext getAccessibleContext()
このダイアログに関連した AccessibleContext を返します。ダイアログの場合、AccessibleContext は AccessibleAWTDialog の形式を取ります。必要に応じて新規の AccessibleAWTDialog インスタンスが生成されます。

定義:
インタフェース Accessible 内の getAccessibleContext
オーバーライド:
クラス Window 内の getAccessibleContext
戻り値:
このダイアログの AccessibleContext として機能する AccessibleAWTDialog

JavaTM 2
Platform
Std. Ed. v1.4.0

バグの報告と機能のリクエスト
これ以外の API リファレンスおよび開発者用ドキュメントについては、 Java 2 SDK SE 開発者用ドキュメントを参照してください。 開発者向けの詳細な解説、概念の概要、用語の定義、バグの回避策、 およびコード実例が含まれています。

Java、Java 2D、および JDBC は米国ならびにその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.