public class JDialog extends Dialog implements WindowConstants, Accessible, RootPaneContainer
JOptionPane创建各种标准对话框。有关创建对话框的信息,看到java教程第
How to Make Dialogs。
的JDialog组件包含一个JRootPane作为其唯一的孩子。的contentPane应该是所有孩子的JDialog母。为方便起见,本add,remove,和这类setLayout方法被重写,所以,他们的ContentPane委托调用相应的方法。例如,您可以在对话框中添加子组件,如下所示:
对话框添加(子);和孩子将被添加到内容块。的
contentPane总是非
null。试图把它
null生成异常。默认
contentPane有
BorderLayout经理了。参考
RootPaneContainer细节添加,删除和设置一个
JDialog的
LayoutManager。
请看到的contentPane,glassPane完整描述JRootPane文档,和layeredPane组件。
在多屏幕环境,你可以创造出比它的主人不同的屏幕设备JDialog。更多信息见Frame。
警告: Swing是线程不安全的。更多信息见Swing's Threading Policy。
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans包。请看XMLEncoder。
JOptionPane,
JRootPane,
RootPaneContainer
| Modifier and Type | Class and Description |
|---|---|
protected class |
JDialog.AccessibleJDialog
这个类实现了对
JDialog类可访问性支持。
|
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityTypeWindow.AccessibleAWTWindow, Window.TypeContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
protected AccessibleContext |
accessibleContext |
protected JRootPane |
rootPane |
protected boolean |
rootPaneCheckingEnabled
如果真的那么叫
add和
setLayout将被转发到
contentPane。
|
DEFAULT_MODALITY_TYPEBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTDISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSEABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
JDialog()
创建一个非模态对话框没有标题,没有指定的
Frame所有者。
|
JDialog(Dialog owner)
创建一个具有指定
Dialog为其拥有者和一个空的标题”对话框。
|
JDialog(Dialog owner, boolean modal)
创建一个空的标题和指定的方式和
Dialog主人对话。
|
JDialog(Dialog owner, String title)
创建一个非模态对话框与指定名称和指定的所有者对话框。
|
JDialog(Dialog owner, String title, boolean modal)
创建一个具有指定名称的对话框,情态和指定的所有者
Dialog。
|
JDialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc)
创建一个对话框指定标题的,业主
Dialog、情态和
GraphicsConfiguration。
|
JDialog(Frame owner)
创建一个具有指定
Frame为其拥有者和一个空的标题”对话框。
|
JDialog(Frame owner, boolean modal)
创建一个空的标题和指定的方式和
Frame主人对话。
|
JDialog(Frame owner, String title)
创建一个非模态对话框与指定名称和指定的主框架。
|
JDialog(Frame owner, String title, boolean modal)
创建一个具有指定名称的对话框,业主
Frame和情态。
|
JDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc)
创建一个对话框指定标题的,业主
Frame、情态和
GraphicsConfiguration。
|
JDialog(Window owner)
创建一个具有指定
Window为其拥有者和一个空的标题”对话框。
|
JDialog(Window owner, Dialog.ModalityType modalityType)
创建一个空的标题和指定的方式和
Window主人对话。
|
JDialog(Window owner, String title)
创建一个非模态对话框与指定名称和所有者
Window。
|
JDialog(Window owner, String title, Dialog.ModalityType modalityType)
创建一个具有指定名称的对话框,业主
Window和情态。
|
JDialog(Window owner, String title, Dialog.ModalityType modalityType, GraphicsConfiguration gc)
创建一个对话框指定标题的,业主
Window、情态和
GraphicsConfiguration。
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addImpl(Component comp, Object constraints, int index)
添加指定的孩子
Component。
|
protected JRootPane |
createRootPane()
通过构造函数的方法来创建默认
rootPane。
|
protected void |
dialogInit()
通过构造函数来初始化
JDialog正确。
|
AccessibleContext |
getAccessibleContext()
获取与此相关的accessiblecontext JDialog。
|
Container |
getContentPane()
返回该对话框的
contentPane对象。
|
int |
getDefaultCloseOperation()
返回当用户在这个对话框上启动一个“关闭”时发生的操作。
|
Component |
getGlassPane()
返回该对话框的
glassPane对象。
|
Graphics |
getGraphics()
为该组件创建一个图形上下文。
|
JMenuBar |
getJMenuBar()
返回设置该对话框菜单栏。
|
JLayeredPane |
getLayeredPane()
返回该对话框的
layeredPane对象。
|
JRootPane |
getRootPane()
返回该对话框的
rootPane对象。
|
TransferHandler |
getTransferHandler()
得到
transferHandler财产。
|
static boolean |
isDefaultLookAndFeelDecorated()
如果新创建的
JDialogs应该有他们的窗户装饰的目前看提供感觉返回true。
|
protected boolean |
isRootPaneCheckingEnabled()
返回是否调用
add和
setLayout转发给
contentPane。
|
protected String |
paramString()
返回该
JDialog字符串表示形式。
|
protected void |
processWindowEvent(WindowEvent e)
处理窗口事件取决于对
defaultCloseOperation属性的状态。
|
void |
remove(Component comp)
从容器中移除指定的组件。
|
void |
repaint(long time, int x, int y, int width, int height)
重画指定矩形的这一部分在
time毫秒。
|
void |
setContentPane(Container contentPane)
集
contentPane财产。
|
void |
setDefaultCloseOperation(int operation)
设置默认情况下,当用户在该对话框中启动“关闭”时,将发生的操作。
|
static void |
setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated)
提供一个提示是否新建
JDialogs应该有自己的窗口装饰(如边界、窗口关闭窗口,标题…)由目前看和感觉。
|
void |
setGlassPane(Component glassPane)
集
glassPane财产。
|
void |
setJMenuBar(JMenuBar menu)
设置此对话框的菜单栏。
|
void |
setLayeredPane(JLayeredPane layeredPane)
集
layeredPane财产。
|
void |
setLayout(LayoutManager manager)
集
LayoutManager。
|
protected void |
setRootPane(JRootPane root)
集
rootPane财产。
|
protected void |
setRootPaneCheckingEnabled(boolean enabled)
设置是否
add和
setLayout调用转发给
contentPane。
|
void |
setTransferHandler(TransferHandler newHandler)
集
transferHandler物业,这是一种机制,支持数据为这部分转移。
|
void |
update(Graphics g)
电话
paint(g)。
|
addNotify, 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, 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, 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, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, 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, 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, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprotected JRootPane rootPane
protected boolean rootPaneCheckingEnabled
add和
setLayout将被转发到
contentPane。这是最初的错误,而是被设置为true时,
JDialog构造。
protected AccessibleContext accessibleContext
public JDialog()
Frame所有者。一个共享的,隐藏的框架将被设置为对话框的所有者。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
注:此构造函数不允许你创建一个不受控制的JDialog。创造一个不受控制的JDialog必须使用的JDialog(Window)或JDialog(Dialog)构造函数与null争论。
HeadlessException -如果
GraphicsEnvironment.isHeadless()返回
true。
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Frame owner)
Frame为其拥有者和一个空的标题”对话框。如果
owner是
null、共享、隐框将被设置为该对话框的所有者。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
注:此构造函数不允许你创建一个不受控制的JDialog。创造一个不受控制的JDialog必须使用的JDialog(Window)或JDialog(Dialog)构造函数与null争论。
owner -
Frame从该对话框显示
HeadlessException -如果
GraphicsEnvironment.isHeadless()返回
true。
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Frame owner, boolean modal)
Frame主人对话。如果
owner是
null、共享、隐框将被设置为该对话框的所有者。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
注:此构造函数不允许你创建一个不受控制的JDialog。创建一个不受控制的JDialog必须使用的JDialog(Window)或JDialog(Dialog)构造函数与null争论。
owner -
Frame从该对话框显示
modal -指定对话框阻止用户输入其他的顶层窗口时显示。如果
true,情态类型”属性设置为“
DEFAULT_MODALITY_TYPE,否则是非模态对话框。
HeadlessException -如果
GraphicsEnvironment.isHeadless()返回
true。
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Frame owner, String title)
owner是
null、共享、隐框将被设置为该对话框的所有者。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
注:此构造函数不允许你创建一个不受控制的JDialog。创造一个不受控制的JDialog必须使用的JDialog(Window)或JDialog(Dialog)构造函数与null争论。
owner -
Frame从该对话框显示
title -
String在对话框的标题栏中显示
HeadlessException -如果
GraphicsEnvironment.isHeadless()返回
true。
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Frame owner, String title, boolean modal)
Frame和情态。如果
owner是
null、共享、隐框将被设置为该对话框的所有者。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
注意:任何弹出式组件(JComboBox,JPopupMenu,JMenuBar)在模态对话框的创建将被迫轻。
注:此构造函数不允许你创建一个不受控制的JDialog。创建一个不受控制的JDialog必须使用的JDialog(Window)或JDialog(Dialog)构造函数与null争论。
owner -
Frame从该对话框显示
title -
String在对话框的标题栏中显示
modal -指定对话框阻止用户输入其他的顶层窗口时显示。如果
true,情态类型”属性设置为“
DEFAULT_MODALITY_TYPE否则对话框是非模态的
HeadlessException -如果
GraphicsEnvironment.isHeadless()返回
true。
Dialog.ModalityType,
Dialog.ModalityType.MODELESS,
Dialog.DEFAULT_MODALITY_TYPE,
Dialog.setModal(boolean),
Dialog.setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc)
Frame、情态和
GraphicsConfiguration。如果
owner是
null、共享、隐框将被设置为该对话框的所有者。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
注意:任何弹出式组件(JComboBox,JPopupMenu,JMenuBar)在模态对话框的创建将被迫轻。
注:此构造函数不允许你创建一个不受控制的JDialog。创建一个不受控制的JDialog必须使用的JDialog(Window)或JDialog(Dialog)构造函数与null争论。
owner -
Frame从该对话框显示
title -
String在对话框的标题栏中显示
modal -指定对话框阻止用户输入其他的顶层窗口时显示。如果
true,情态类型”属性设置为“
DEFAULT_MODALITY_TYPE,否则是非模态对话框。
gc -目标屏幕装置的
GraphicsConfiguration;如果
null,系统默认
GraphicsConfiguration假定
HeadlessException -如果
GraphicsEnvironment.isHeadless()返回
true。
Dialog.ModalityType,
Dialog.ModalityType.MODELESS,
Dialog.DEFAULT_MODALITY_TYPE,
Dialog.setModal(boolean),
Dialog.setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Dialog owner)
Dialog为其拥有者和一个空的标题”对话框。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
owner -业主
Dialog从该对话框显示或
null如果这个对话框没有主人
HeadlessException -
if GraphicsEnvironment.isHeadless()返回
true。
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Dialog owner, boolean modal)
Dialog主人对话。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
owner -业主
Dialog从该对话框显示或
null如果这个对话框没有主人
modal -指定对话框阻止用户输入其他的顶层窗口时显示。如果
true,情态类型”属性设置为“
DEFAULT_MODALITY_TYPE,否则是非模态对话框。
HeadlessException -如果
GraphicsEnvironment.isHeadless()返回
true。
Dialog.ModalityType,
Dialog.ModalityType.MODELESS,
Dialog.DEFAULT_MODALITY_TYPE,
Dialog.setModal(boolean),
Dialog.setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Dialog owner, String title)
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
owner -业主
Dialog从该对话框显示或
null如果这个对话框没有主人
title -
String在对话框的标题栏中显示
HeadlessException -如果
GraphicsEnvironment.isHeadless()返回
true。
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Dialog owner, String title, boolean modal)
Dialog。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
owner -业主
Dialog从该对话框显示或
null如果这个对话框没有主人
title -
String在对话框的标题栏中显示
modal -指定对话框阻止用户输入其他的顶层窗口时显示。如果
true,情态类型”属性设置为“
DEFAULT_MODALITY_TYPE,否则是非模态对话框
HeadlessException -如果
GraphicsEnvironment.isHeadless()返回
true。
Dialog.ModalityType,
Dialog.ModalityType.MODELESS,
Dialog.DEFAULT_MODALITY_TYPE,
Dialog.setModal(boolean),
Dialog.setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Dialog owner, String title, boolean modal, GraphicsConfiguration gc)
Dialog、情态和
GraphicsConfiguration
注意:任何弹出式组件(JComboBox,JPopupMenu,JMenuBar)在模态对话框的创建将被迫轻。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
owner -业主
Dialog从该对话框显示或
null如果这个对话框没有主人
title -
String在对话框的标题栏中显示
modal -指定对话框阻止用户输入其他的顶层窗口时显示。如果
true,情态类型”属性设置为“
DEFAULT_MODALITY_TYPE,否则是非模态对话框
gc -目标屏幕装置的
GraphicsConfiguration;如果
null,系统默认
GraphicsConfiguration假定
HeadlessException -如果
GraphicsEnvironment.isHeadless()返回
true。
Dialog.ModalityType,
Dialog.ModalityType.MODELESS,
Dialog.DEFAULT_MODALITY_TYPE,
Dialog.setModal(boolean),
Dialog.setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Window owner)
Window为其拥有者和一个空的标题”对话框。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
owner -
Window从该对话框显示或
null如果这个对话框没有主人
IllegalArgumentException -如果
owner不是
Dialog或
Frame实例
IllegalArgumentException -如果
owner的
GraphicsConfiguration不是从一个屏幕的设备
HeadlessException当
GraphicsEnvironment.isHeadless()返回
true
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Window owner, Dialog.ModalityType modalityType)
Window主人对话。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
owner -
Window从该对话框显示或
null如果这个对话框没有主人
modalityType -指定对话框输入到其他窗口时,显示块。
null价值和不支持的情态类型相当于
MODELESS
IllegalArgumentException -如果
owner不是
Dialog或
Frame实例
IllegalArgumentException -如果
owner的
GraphicsConfiguration不是从一个屏幕的设备
HeadlessException当
GraphicsEnvironment.isHeadless()返回
true
SecurityException -如果调用线程没有权限创建与给定的
modalityType模态对话框
Dialog.ModalityType,
Dialog.setModal(boolean),
Dialog.setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Window owner, String title)
Window。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
owner -
Window从该对话框显示或
null如果这个对话框没有主人
title -
String在对话框的标题栏或
null显示如果对话框没有标题
IllegalArgumentException -如果
owner不是
Dialog或
Frame实例
IllegalArgumentException -如果
owner的
GraphicsConfiguration不是从一个屏幕的设备
HeadlessException当
GraphicsEnvironment.isHeadless()返回
true
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Window owner, String title, Dialog.ModalityType modalityType)
Window和情态。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
owner -
Window从该对话框显示或
null如果这个对话框没有主人
title -
String在对话框的标题栏或
null显示如果对话框没有标题
modalityType -指定对话框输入到其他窗口时,显示块。
null价值和不支持的情态类型相当于
MODELESS
IllegalArgumentException -如果
owner不是
Dialog或
Frame实例
IllegalArgumentException -如果
owner的
GraphicsConfiguration不是从一个屏幕的设备
HeadlessException当
GraphicsEnvironment.isHeadless()返回
true
SecurityException -如果调用线程没有权限创建与给定的
modalityType模态对话框
Dialog.ModalityType,
Dialog.setModal(boolean),
Dialog.setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
public JDialog(Window owner, String title, Dialog.ModalityType modalityType, GraphicsConfiguration gc)
Window、情态和
GraphicsConfiguration。
注意:任何弹出式组件(JComboBox,JPopupMenu,JMenuBar)在模态对话框的创建将被迫轻。
此构造函数设置组件的本地化属性返回的值JComponent.getDefaultLocale。
owner -
Window从该对话框显示或
null如果这个对话框没有主人
title -
String在对话框的标题栏或
null显示如果对话框没有标题
modalityType -指定对话框输入到其他窗口时,显示块。
null价值和不支持的情态类型相当于
MODELESS
gc -目标屏幕装置的
GraphicsConfiguration;如果
null,系统默认
GraphicsConfiguration假定
IllegalArgumentException -如果
owner不是
Dialog或
Frame实例
IllegalArgumentException -如果
owner的
GraphicsConfiguration不是从一个屏幕的设备
HeadlessException当
GraphicsEnvironment.isHeadless()返回
true
SecurityException -如果调用线程没有权限创建与给定的
modalityType模态对话框
Dialog.ModalityType,
Dialog.setModal(boolean),
Dialog.setModalityType(java.awt.Dialog.ModalityType),
GraphicsEnvironment.isHeadless(),
JComponent.getDefaultLocale()
protected void dialogInit()
JDialog正确。
protected JRootPane createRootPane()
rootPane。
protected void processWindowEvent(WindowEvent e)
defaultCloseOperation属性的状态。
processWindowEvent 方法重写,继承类
Window
e -窗口事件
setDefaultCloseOperation(int)
public void setDefaultCloseOperation(int operation)
DO_NOTHING_ON_CLOSE(定义在WindowConstants):不做任何处理;要求程序运行在windowClosing方法注册WindowListener对象。HIDE_ON_CLOSE(定义在WindowConstants):自动隐藏对话框后调用任何注册WindowListener对象。DISPOSE_ON_CLOSE(定义在WindowConstants):自动隐藏和处理对话框后调用任何注册WindowListener对象。的值设置为默认的HIDE_ON_CLOSE。这个属性的值的属性更改事件引起的放电变化,与属性名称”defaultcloseoperation”。
注:当最后一个显示窗口的java虚拟机(VM)内设置,虚拟机可能会终止。更多信息见 AWT Threading Issues。
operation所应表现在用户关闭对话框的操作
IllegalArgumentException -如果defaultcloseoperation值不是一个以上的有效值
Window.addWindowListener(java.awt.event.WindowListener),
getDefaultCloseOperation(),
WindowConstants
public int getDefaultCloseOperation()
setDefaultCloseOperation(int)
public void setTransferHandler(TransferHandler newHandler)
transferHandler物业,这是一种机制,支持数据为这部分转移。如果组件不支持数据传输操作使用
null。
如果系统性能suppressSwingDropSupport是false(默认),这个元件上的电流下降的目标是null或没有用户设置滴目标,这种方法会改变下降的目标如下:如果newHandler是null将明显下降的目标。如果不null将安装一个新的DropTarget。
注意:当使用JDialog,TransferHandler只提供数据导入功能,为数据与出口相关的方法是目前对JComponent型。
请看 How to Use Drag and Drop and Data Transfer,java教程中的一部分,更多的信息。
newHandler -新的
TransferHandler
TransferHandler,
getTransferHandler(),
Component.setDropTarget(java.awt.dnd.DropTarget)
public TransferHandler getTransferHandler()
transferHandler财产。
transferHandler属性的值
TransferHandler,
setTransferHandler(javax.swing.TransferHandler)
public void update(Graphics g)
paint(g)。该方法被重写以防止不必要的电话清晰的背景。
update 方法重写,继承类
Container
g -其中
Graphics背景画
Component.update(Graphics)
public void setJMenuBar(JMenuBar menu)
menu -菜单栏放置在对话框
getJMenuBar()
public JMenuBar getJMenuBar()
protected boolean isRootPaneCheckingEnabled()
add和
setLayout转发给
contentPane。
add和
setLayout转发真;否则为false
addImpl(java.awt.Component, java.lang.Object, int),
setLayout(java.awt.LayoutManager),
setRootPaneCheckingEnabled(boolean),
RootPaneContainer
protected void setRootPaneCheckingEnabled(boolean enabled)
add和
setLayout调用转发给
contentPane。
enabled -如果
add和
setLayout转发,假如果他们应该直接在
JDialog操作。
addImpl(java.awt.Component, java.lang.Object, int),
setLayout(java.awt.LayoutManager),
isRootPaneCheckingEnabled(),
RootPaneContainer
protected void addImpl(Component comp, Object constraints, int index)
addImpl 方法重写,继承类
Container
comp -可以提高构件的
constraints -被尊重的约束
index -指数
IllegalArgumentException -如果
index无效
IllegalArgumentException如果添加容器的家长本身
IllegalArgumentException如果增加一个窗口一个容器
setRootPaneCheckingEnabled(boolean),
RootPaneContainer
public void remove(Component comp)
comp不是
rootPane,这将给
contentPane。如果这样会
comp不是的
JDialog或
contentPane孩子做什么。
remove 方法重写,继承类
Container
comp -要移除的组件
NullPointerException -如果
comp是空的
Container.add(java.awt.Component),
RootPaneContainer
public void setLayout(LayoutManager manager)
setLayout 方法重写,继承类
Container
manager -
LayoutManager
setRootPaneCheckingEnabled(boolean),
RootPaneContainer
public JRootPane getRootPane()
rootPane对象。
getRootPane 接口
RootPaneContainer
setRootPane(javax.swing.JRootPane),
RootPaneContainer.getRootPane()
protected void setRootPane(JRootPane root)
rootPane财产。此方法被构造函数调用。
root -此对话框的
rootPane对象
getRootPane()
public Container getContentPane()
contentPane对象。
getContentPane 接口
RootPaneContainer
contentPane财产
setContentPane(java.awt.Container),
RootPaneContainer.getContentPane()
public void setContentPane(Container contentPane)
contentPane财产。此方法被构造函数调用。
摆动的绘画结构需要在层次结构不透明的JComponent。这通常是由内容窗格提供的。如果更换建议你用不透明的JComponent替换内容窗格。
setContentPane 接口
RootPaneContainer
contentPane -此对话框的
contentPane对象
IllegalComponentStateException -(运行时异常)如果内容窗格中的参数是
null
JRootPane,
getContentPane(),
RootPaneContainer.setContentPane(java.awt.Container)
public JLayeredPane getLayeredPane()
layeredPane对象。
getLayeredPane 接口
RootPaneContainer
layeredPane财产
setLayeredPane(javax.swing.JLayeredPane),
RootPaneContainer.getLayeredPane()
public void setLayeredPane(JLayeredPane layeredPane)
layeredPane财产。此方法被构造函数调用。
setLayeredPane 接口
RootPaneContainer
layeredPane -新的
layeredPane财产
IllegalComponentStateException -(运行时异常)如果分层窗格参数为空
getLayeredPane(),
RootPaneContainer.setLayeredPane(javax.swing.JLayeredPane)
public Component getGlassPane()
glassPane对象。
getGlassPane 接口
RootPaneContainer
glassPane财产
setGlassPane(java.awt.Component),
RootPaneContainer.getGlassPane()
public void setGlassPane(Component glassPane)
glassPane财产。此方法被构造函数调用。
setGlassPane 接口
RootPaneContainer
glassPane -此对话框的
glassPane对象
getGlassPane(),
RootPaneContainer.setGlassPane(java.awt.Component)
public Graphics getGraphics()
null。
getGraphics 方法重写,继承类
Component
null
Component.paint(java.awt.Graphics)
public void repaint(long time,
int x,
int y,
int width,
int height)
time毫秒。参考
RepaintManager详情如何重新处理。
repaint 方法重写,继承类
Component
time -毫秒最大时间更新前
x的X坐标
y的Y坐标
width -宽度
height -高度
RepaintManager
public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated)
JDialogs应该有自己的窗口装饰(如边界、窗口关闭窗口,标题…)由目前看和感觉。如果
defaultLookAndFeelDecorated属实,目前
LookAndFeel支持提供窗户装饰,和当前的窗口管理器支持未装饰的窗户,然后将新创建的
JDialogs窗口装饰的
LookAndFeel提供。否则,新创建的
JDialogs将窗户装饰由当前的窗口管理器提供。
你可以通过做以下获得一个JDialog相同的效果:
新jdialog() JDialog对话框=;对话框。setundecorated(真的);对话框。getrootpane()。setwindowdecorationstyle(jrootpane。plain_dialog);
defaultLookAndFeelDecorated -一个提示是否当前的外观和感觉应该提供窗饰
LookAndFeel.getSupportsWindowDecorations()
public static boolean isDefaultLookAndFeelDecorated()
JDialogs应该有他们的窗户装饰的目前看提供感觉返回true。这只是一个提示,因为某些外观和感觉可能不支持这个功能。
protected String paramString()
JDialog字符串表示形式。此方法仅用于调试目的,返回的字符串的内容和格式可能会在实现过程中有所不同。返回的字符串是空的但可能不
null。
paramString 方法重写,继承类
Dialog
JDialog字符串表示形式。
public AccessibleContext getAccessibleContext()
getAccessibleContext 接口
Accessible
getAccessibleContext 方法重写,继承类
Dialog
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.