- java.lang.Object
-
- javax.swing.PopupFactory
-
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();
- 導入されたバージョン:
- 1.4
- 関連項目:
Popup
-
-
コンストラクタのサマリー
コンストラクタ コンストラクタ 説明 PopupFactory()
-
メソッドのサマリー
修飾子と型 メソッド 説明 Popup
getPopup(Component owner, Component contents, int x, int y)
Componentcontents
を含むComponentowner
のPopup
を作成します。protected Popup
getPopup(Component owner, Component contents, int x, int y, boolean isHeavyWeightPopup)
Componentcontents
を含むComponentowner
のPopup
を作成します。static PopupFactory
getSharedInstance()
Popup
を取得するために使用できる共有PopupFactory
を返します。static void
setSharedInstance(PopupFactory factory)
Popup
の取得に使用されるPopupFactory
を設定します。
-
-
-
メソッドの詳細
-
setSharedInstance
public static void setSharedInstance(PopupFactory factory)
Popup
の取得に使用されるPopupFactory
を設定します。factory
がnullの場合、IllegalArgumentException
をスローします。- パラメータ:
factory
- 共有PopupFactory- 例外:
IllegalArgumentException
-factory
がnullである場合- 関連項目:
getPopup(java.awt.Component, java.awt.Component, int, int)
-
getSharedInstance
public static PopupFactory getSharedInstance()
Popup
を取得するために使用できる共有PopupFactory
を返します。- 戻り値:
- 共有PopupFactory
-
getPopup
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画面座標- 戻り値:
- Contentsを含むPopup
- 例外:
IllegalArgumentException
- contentsがnullの場合
-
getPopup
protected Popup getPopup(Component owner, Component contents, int x, int y, boolean isHeavyWeightPopup) throws IllegalArgumentException
Componentcontents
を含むComponentowner
のPopup
を作成します。 コンポーネントowner
を含むウィンドウが親ウィンドウとして使用されます。owner
がnullの場合、有効な親がないことを示します。x
とy
には、Popup
を最初に配置する位置を指定します。 画面サイズや他のパラメータに基づいて、Popup
がx
およびy
に表示されないことがあります。isHeavyWeightPopup
は、Popup
がヘビーウエイトかどうかを指定します。true
を渡すと、Popup
型がヘビーウエイトになります。そうでなければ、Popup
型がPopup
ファクトリによって選択されます。 軽量のPopup
ウィンドウは、重量(ネイティブ・ピア)ウィンドウよりも効率的ですが、軽量および重量のあるコンポーネントはGUIではうまく混合できません。 このメソッドは、PopupFactoryサブクラスでのみ使用されることを意図しています。- パラメータ:
owner
- マウスの座標の基準になるComponent。nullも可contents
- PopupのContentsx
- 初期のx画面座標y
- 初期のy画面座標isHeavyWeightPopup
- Popupが重たくなる必要がある場合はtrue、それ以外の場合はポップアップ型がポップアップ・ファクトリによって選択されます。- 戻り値:
- Contentsを含むPopup
- 例外:
IllegalArgumentException
- contentsがnullの場合
-
-