- 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()
 - 
メソッドのサマリー修飾子と型 メソッド 説明 PopupgetPopup(Component owner, Component contents, int x, int y)Componentcontentsを含むComponentownerのPopupを作成します。protected PopupgetPopup(Component owner, Component contents, int x, int y, boolean isHeavyWeightPopup)Componentcontentsを含むComponentownerのPopupを作成します。static PopupFactorygetSharedInstance()Popupを取得するために使用できる共有PopupFactoryを返します。static voidsetSharedInstance(PopupFactory factory)Popupの取得に使用されるPopupFactoryを設定します。
 
- 
- 
- 
メソッドの詳細- 
setSharedInstancepublic static void setSharedInstance(PopupFactory factory) Popupの取得に使用されるPopupFactoryを設定します。factoryがnullの場合、IllegalArgumentExceptionをスローします。- パラメータ:
- factory- 共有PopupFactory
- 例外:
- IllegalArgumentException-- factoryがnullである場合
- 関連項目:
- getPopup(java.awt.Component, java.awt.Component, int, int)
 
 - 
getSharedInstancepublic static PopupFactory getSharedInstance() Popupを取得するために使用できる共有PopupFactoryを返します。- 戻り値:
- 共有PopupFactory
 
 - 
getPopuppublic 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のContents
- x- 初期のx画面座標
- y- 初期のy画面座標
- 戻り値:
- Contentsを含むPopup
- 例外:
- IllegalArgumentException- contentsがnullの場合
 
 - 
getPopupprotected 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のContents
- x- 初期のx画面座標
- y- 初期のy画面座標
- isHeavyWeightPopup- Popupが重たくなる必要がある場合はtrue、それ以外の場合はポップアップ型がポップアップ・ファクトリによって選択されます。
- 戻り値:
- Contentsを含むPopup
- 例外:
- IllegalArgumentException- contentsがnullの場合
 
 
- 
 
-