JavaTM 2 Platform
Standard Ed. 5.0

java.awt
クラス Dialog

java.lang.Object
  上位を拡張 java.awt.Component
      上位を拡張 java.awt.Container
          上位を拡張 java.awt.Window
              上位を拡張 java.awt.Dialog
すべての実装されたインタフェース:
ImageObserver, MenuContainer, Serializable, Accessible
直系の既知のサブクラス:
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 です。

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

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

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

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

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

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

入れ子のクラスの概要
protected  class Dialog.AccessibleAWTDialog
          このクラスは Dialog クラス用のユーザ補助機能のサポートを実装しています。
 
クラス java.awt.Window から継承された入れ子のクラス/インタフェース
Window.AccessibleAWTWindow
 
クラス java.awt.Container から継承された入れ子のクラス/インタフェース
Container.AccessibleAWTContainer
 
クラス java.awt.Component から継承された入れ子のクラス/インタフェース
Component.AccessibleAWTComponent, 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 を表示可能にします。
 AccessibleContext getAccessibleContext()
          このダイアログに関連した AccessibleContext を返します。
 String getTitle()
          ダイアログのタイトルを返します。
 void hide()
          推奨されていません。 JDK version 1.5 以降では Component.setVisible(boolean) を使用します。
 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()
          推奨されていません。 JDK version 1.5 以降では Component.setVisible(boolean) を使用します。
 
クラス java.awt.Window から継承されたメソッド
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, 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, 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, removeNotify, 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, 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, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, 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

@Deprecated
public void show()
推奨されていません。 JDK version 1.5 以降では Component.setVisible(boolean) を使用します。

オーバーライド:
クラス Window 内の show

hide

@Deprecated
public void hide()
推奨されていません。 JDK version 1.5 以降では Component.setVisible(boolean) を使用します。

オーバーライド:
クラス Window 内の hide

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
Standard Ed. 5.0

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

Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。