public class PopupFactory extends Object
PopupFactory
,顾名思义,用于获取Popup的Popup
。
Popup
s的用于显示Component
上述所有其他Component
中特定包含层次结构秒。
一般的合同是,一旦你已经获得了Popup
从PopupFactory
,您必须调用hide
上Popup
。
典型用法是:
PopupFactory factory = PopupFactory.getSharedInstance();
Popup popup = factory.getPopup(owner, contents, x, y);
popup.show();
...
popup.hide();
Popup
Constructor and Description |
---|
PopupFactory() |
Modifier and Type | Method and Description |
---|---|
Popup |
getPopup(Component owner, Component contents, int x, int y)
创建
Popup 为组件
owner 包含Component
contents 。
|
static PopupFactory |
getSharedInstance()
返回共享的
PopupFactory ,可用于获取
Popup s。
|
static void |
setSharedInstance(PopupFactory factory)
设置
PopupFactory 将被用于获取
Popup 秒。
|
public static void setSharedInstance(PopupFactory factory)
PopupFactory
将被用于获取Popup
秒。
如果factory
为空,则会抛出IllegalArgumentException
。
factory
- 共享PopupFactory
IllegalArgumentException
- 如果
factory
为空
getPopup(java.awt.Component, java.awt.Component, int, int)
public static PopupFactory getSharedInstance()
PopupFactory
,可用于获取
Popup
s。
public Popup getPopup(Component owner, Component contents, int x, int y) throws IllegalArgumentException
Popup
为组件owner
包含Component contents
。
owner
用于确定哪些Window
将新增Popup
将母公司Component
Popup
创建。
null owner
意味着没有有效的父项。
x
和y
指定放置Popup
的首选初始位置。
根据屏幕尺寸或其他参数, Popup
可能不会显示在x
和y
。
owner
- 组件鼠标坐标是相对的,可以是null
contents
- 弹出窗口的内容
x
- 初始x屏幕坐标
y
- 初始y屏幕坐标
IllegalArgumentException
- if contents is null
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.