|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Objectjava.awt.event.ComponentAdapter
to.tetramorph.starbase.util.WindowMoveHandler
public class WindowMoveHandler
フレームやダイアログのサイズと位置が変化したら、その位置情報をPreferncesに 保管する。 JFrameなどのコンポーネントにaddComponentListener()をつかって、このクラスの インスタンスを登録する。 リスナに登録しておけば勝手にウィンドウの位置を保管してくれて、setBounsを使えば 保管されていた位置を、コンポーネントに再セットしてくれる。
使い方: public class ☆ extends JFrame { WindowMoveHandler winmove = new WindowMoveHandler("☆.BOUNDS", this); addComponentListener(winmove); winmove.setBounds(); }2009/02/27 Config.systemに値を保持するのをやめPreferencesを使うようにした。 これにより設定値はレジストリに書きこまれることになる。 2011/07/29 レジストリを使うのをやめた。 2011/07/30 ComponentではなくWindowをコンストラクタで受け取るようにした。
フィールドの概要 | |
---|---|
protected String |
key
コンストラクタで指定されたkeyの写し |
protected Window |
window
コンストラクタで指定されたwindowの写し |
コンストラクタの概要 | |
---|---|
WindowMoveHandler(String key,
Window component)
オブジェクトを作成する。 |
メソッドの概要 | |
---|---|
void |
componentMoved(ComponentEvent e)
ウィンドウの位置が変わると呼び出される。 |
void |
componentResized(ComponentEvent e)
ウィンドウがリサイズされると呼び出される。 |
void |
setBounds()
コンストラクタで指定したコンポーネントに、コンストラクタで指定したキーの プロパティ値(Rectangleによるウィンドウの位置とサイズ)をセットする。 |
void |
setLocation()
|
クラス java.awt.event.ComponentAdapter から継承されたメソッド |
---|
componentHidden, componentShown |
クラス java.lang.Object から継承されたメソッド |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
フィールドの詳細 |
---|
protected final String key
protected final Window window
コンストラクタの詳細 |
---|
public WindowMoveHandler(String key, Window component)
key
- レジストリに登録するときのキー名window
- JFrameかJDialogのどちらかメソッドの詳細 |
---|
public void componentMoved(ComponentEvent e)
ComponentListener
内の componentMoved
ComponentAdapter
内の componentMoved
public void componentResized(ComponentEvent e)
ComponentListener
内の componentResized
ComponentAdapter
内の componentResized
public void setBounds()
public void setLocation()
|
|||||||||
前のクラス 次のクラス | フレームあり フレームなし | ||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |