Swing/LayeredPane のバックアップの現在との差分(No.15)
TITLE:JInternalFrameを一番手前に表示
JInternalFrameを一番手前に表示
Posted by terai at 2004-06-21- category: swing folder: LayeredPane title: JInternalFrameを一番手前に表示 tags: [JLayeredPane, JInternalFrame, JDesktopPane] author: aterai pubdate: 2004-06-21T07:16:58+09:00 description: JLayeredPaneを使って、常に一番手前に表示されるJInternalFrameを作成します。 image:
概要
JLayeredPane
を使って、常に一番手前に表示されるJInternalFrame
を作成します。
Screenshot
Advertisement
概要
JLayeredPaneを使って、常に一番手前に表示されるJInternalFrameを作成します。- &jnlp;
- &jar;
- &zip;
#screenshot
サンプルコード
#spanend
#spandel
JInternalFrame iframe = new JInternalFrame("AlwaysOnTop",
#spanend
true, //resizable
false, //closable
true, //maximizable
true); //iconifiable
#spanadd
* サンプルコード [#sourcecode]
#spanend
#spanadd
#code(link){{
#spanend
#spanadd
JInternalFrame iframe = new JInternalFrame(
#spanend
"AlwaysOnTop", // title
true, // resizable
false, // closable
true, // maximizable
true); // iconifiable
iframe.setSize(180, 180);
#spandel
desktop.add(iframe, new Integer(JLayeredPane.MODAL_LAYER+1));
#spanend
#spanadd
desktop.add(iframe, Integer.valueOf(JLayeredPane.MODAL_LAYER + 1));
#spanend
iframe.setVisible(true);
解説
JDesktopPane は、JLayeredPane を継承しているので、JInternalFrame を追加するレイヤーを指定することができます。 このサンプルでは、タイトルが"AlwaysOnTop"のJInternalFrameを、JLayeredPane.MODAL_LAYERの一つ上に設定し、他のJInternalFrame(ここでは後から追加するJInternalFrame)より常に手前に表示されるように設定しています。解説
JDesktopPane
はJLayeredPane
を継承しているため、JInternalFrame
を追加するレイヤーを指定可能です。このサンプルでは、タイトルがAlwaysOnTop
のJInternalFrame
をJLayeredPane.MODAL_LAYER
の一つ上に設定し、他のJInternalFrame
(ここでは後から追加するJInternalFrame
)より常に手前に表示されるように設定しています。
参考リンク
参考リンク
コメント
- 1.5でJFrameなどは、frame.setAlwaysOnTop(true)が使えるようになっています。 -- terai
- ありがとうございます。現在GUIの作成をしていて、目下この情報を探していました。ありがとうございました -- G?
コメント
-
JDK 1.5.0
でJFrame
などは、frame.setAlwaysOnTop(true)
が使えるようになっています。 -- aterai - ありがとうございます。現在
GUI
の作成をしていて、目下この情報を探していました。ありがとうございました -- G- どういたしまして。 -- aterai