public class PopupFactory extends Object
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を含むComponent ownerのPopupを作成します。 |
static PopupFactory |
getSharedInstance() |
Popupを取得するために使用できる共有PopupFactoryを返します。 |
static void |
setSharedInstance(PopupFactory factory) |
Popupの取得に使用されるPopupFactoryを設定します。 |
public static void setSharedInstance(PopupFactory factory)
Popupの取得に使用されるPopupFactoryを設定します。 factoryがnullの場合、IllegalArgumentExceptionをスローします。 factory - 共有PopupFactoryIllegalArgumentException - factoryがnullである場合getPopup(java.awt.Component, java.awt.Component, int, int)public static PopupFactory getSharedInstance()
Popupを取得するために使用できる共有PopupFactoryを返します。public Popup getPopup(Component owner, Component contents, int x, int y) throws IllegalArgumentException
contentsを含むコンポーネントownerのPopupを作成します。ownerは、どのWindow (新しいPopup)がPopupの作成先のComponentの親となるかを指定するために使用します。 ownerがnullの場合、有効な親がないことを示します。xとyには、Popupを最初に配置する位置を指定します。 画面のサイズや他のパラメータによっては、Popupがxとyの位置に表示されないことがあります。 owner - マウスの座標の基準になるComponent。nullも可contents - PopupのContentsx - 初期のx画面座標y - 初期のy画面座標IllegalArgumentException - contentsがnullの場合 バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。 そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。