| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjavax.swing.PopupFactory
public class PopupFactory
顾名思义,PopupFactory 用于获取 Popup 的实例。Popup 用于显示特定包含层次结构中所有其他 Component 之上的 Component。常规协定是从 PopupFactory 获取 Popup 之后,必须调用 Popup 上的 hide。一般用法为:
 
PopupFactory factory = PopupFactory.getSharedInstance(); Popup popup = factory.getPopup(owner, contents, x, y); popup.show(); ... popup.hide();
Popup| 构造方法摘要 | |
|---|---|
| PopupFactory() | |
| 方法摘要 | |
|---|---|
|  Popup | getPopup(Component owner,
         Component contents,
         int x,
         int y)为包含 Component contents的 Componentowner创建Popup。 | 
| static PopupFactory | getSharedInstance()返回共享 PopupFactory,它可用于获取Popup。 | 
| static void | setSharedInstance(PopupFactory factory)设置用于获取 Popup的PopupFactory。 | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| 构造方法详细信息 | 
|---|
public PopupFactory()
| 方法详细信息 | 
|---|
public static void setSharedInstance(PopupFactory factory)
Popup 的 PopupFactory。如果 factory 为 null,这将抛出 IllegalArgumentException。
factory - Shared PopupFactory
IllegalArgumentException - 如果 factory 为 nullgetPopup(java.awt.Component, java.awt.Component, int, int)public static PopupFactory getSharedInstance()
PopupFactory,它可用于获取 Popup。
public Popup getPopup(Component owner,
                      Component contents,
                      int x,
                      int y)
               throws IllegalArgumentException
contents 的 Component owner 创建 Popup。owner 用于确定 Window,新 Popup 将其作为创建 Popup 的 Component 的父级。null owner 暗示不存在有效的父级。x 和 y 指定放置 Popup 的首选初始位置。基于屏幕大小或其他参数,Popup 不能显示在 x 和 y 处。
owner - 组件鼠标坐标与其相关,它可以为 nullcontents - Popup 的内容x - 初始的 x 屏幕坐标y - 初始的 y 屏幕坐标
IllegalArgumentException - 如果内容为 null| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。