クラスPopupFactory

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
関連項目:
  • コンストラクタのサマリー

    コンストラクタ
    コンストラクタ
    説明
    PopupFactoryを構築します。
  • メソッドのサマリー

    修飾子と型
    メソッド
    説明
    getPopup(Component owner, Component contents, int x, int y)
    Component contentsを含むComponent ownerPopupを作成します。
    protected Popup
    getPopup(Component owner, Component contents, int x, int y, boolean isHeavyWeightPopup)
    Component contentsを含むComponent ownerPopupを作成します。
    Popupを取得するために使用できる共有PopupFactoryを返します。
    static void
    Popupの取得に使用されるPopupFactoryを設定します。

    クラスオブジェクトで宣言されたメソッド

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    修飾子と型
    メソッド
    説明
    protected Object
    このオブジェクトのコピーを作成して、返します。
    boolean
    このオブジェクトと他のオブジェクトが等しいかどうかを示します。
    protected void
    削除予定のため非推奨: このAPI要素は、将来のバージョンで削除される可能性があります。
    最終決定は非推奨であり、将来のリリースで削除される可能性があります。
    final Class<?>
    このObjectの実行時クラスを返します。
    int
    このオブジェクトに対するハッシュ・コード値を返します。
    final void
    このオブジェクトのモニターで待機中のスレッドを1つ再開します。
    final void
    このオブジェクトのモニターで待機中のすべてのスレッドを再開します。
    オブジェクトの文字列表現を返します。
    final void
    現在のスレッドが目覚めるまで待機します。通常、notifiedまたはinterruptedです。
    final void
    wait(long timeoutMillis)
    現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。
    final void
    wait(long timeoutMillis, int nanos)
    現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。
  • コンストラクタの詳細

    • PopupFactory

      public PopupFactory()
      PopupFactoryを構築します。
  • メソッドの詳細

    • setSharedInstance

      public static void setSharedInstance(PopupFactory factory)
      Popupの取得に使用されるPopupFactoryを設定します。 factoryがnullの場合、IllegalArgumentExceptionをスローします。
      パラメータ:
      factory - 共有PopupFactory
      スロー:
      IllegalArgumentException - factoryがnullである場合
      関連項目:
    • getSharedInstance

      public static PopupFactory getSharedInstance()
      Popupを取得するために使用できる共有PopupFactoryを返します。
      戻り値:
      共有PopupFactory
    • getPopup

      public Popup getPopup(Component owner, Component contents, int x, int y) throws IllegalArgumentException
      コンポーネントcontentsを含むコンポーネントownerPopupを作成します。ownerは、どのWindow (新しいPopup)がPopupの作成先のComponentの親となるかを指定するために使用します。 ownerがnullの場合、有効な親がないことを示します。xyには、Popupを最初に配置する位置を指定します。 画面サイズまたはその他のパラメータに基づいて、Popupxおよびyに表示されない場合があります。
      パラメータ:
      owner - マウスの座標の基準になるComponent。nullも可
      contents - PopupのContents
      x - 初期のx画面座標
      y - 初期のy画面座標
      戻り値:
      Contentsを含むPopup
      スロー:
      IllegalArgumentException - contentsがnullの場合
    • getPopup

      protected Popup getPopup(Component owner, Component contents, int x, int y, boolean isHeavyWeightPopup) throws IllegalArgumentException
      Component contentsを含むComponent ownerPopupを作成します。 コンポーネントownerを含むウィンドウが親ウィンドウとして使用されます。 ownerがnullの場合、有効な親がないことを示します。xyには、Popupを最初に配置する位置を指定します。 画面サイズまたはその他のパラメータに基づいて、Popupxおよびyに表示されない場合があります。isHeavyWeightPopupは、Popupが重いかどうかを指定します。 trueを渡すと、Popup型が強制的に重量になります。そうしないと、Popup型がPopupファクトリによって選択されます。 軽量Popupウィンドウは、重量の(ネイティブ・ピア)ウィンドウより効率的ですが、軽量コンポーネントと重量コンポーネントはGUIでよく混在しません。 このメソッドは、PopupFactoryサブクラスでのみ使用されます。
      パラメータ:
      owner - マウスの座標の基準になるComponent。nullも可
      contents - PopupのContents
      x - 初期のx画面座標
      y - 初期のy画面座標
      isHeavyWeightPopup - ポップアップが重い場合はtrue、そうでない場合はポップアップ・ファクトリによってポップアップ・タイプが選択されます。
      戻り値:
      Contentsを含むPopup
      スロー:
      IllegalArgumentException - contentsがnullの場合