Swing/ImmovableFrame のバックアップの現在との差分(No.5)
- バックアップ一覧
- 差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/ImmovableFrame へ行く。
- 1 (2006-01-29 (日) 17:24:14)
- 2 (2006-02-27 (月) 16:04:00)
- 3 (2006-02-27 (月) 17:10:17)
- 4 (2007-03-02 (金) 16:19:21)
- 5 (2007-09-21 (金) 12:25:11)
- 6 (2007-10-05 (金) 02:07:47)
- 7 (2009-06-09 (火) 20:28:57)
- 8 (2013-03-22 (金) 11:54:50)
- 9 (2013-08-24 (土) 22:44:25)
- 10 (2014-11-25 (火) 03:03:31)
- 11 (2015-01-21 (水) 18:36:20)
- 12 (2015-03-11 (水) 18:27:25)
- 13 (2016-09-07 (水) 14:00:48)
- 14 (2017-10-19 (木) 15:28:28)
- 15 (2018-12-05 (水) 18:47:29)
- 16 (2020-11-10 (火) 12:43:08)
- 17 (2022-11-11 (金) 14:46:01)
- 追加された行はこの色です。
- 削除された行はこの色です。
TITLE:JInternalFrameを固定 #navi(../) *JInternalFrameを固定 [#o5f11a62] >編集者:[[Terai Atsuhiro>terai]]~ 作成日:2005-10-10~ 更新日:&lastmod; --- category: swing folder: ImmovableFrame title: JInternalFrameを固定 tags: [JInternalFrame, MouseMotionListener] author: aterai pubdate: 2005-10-10T17:53:41+09:00 description: JInternalFrameをマウスなどで移動できないように固定します。 image: https://lh4.googleusercontent.com/_9Z4BYR88imo/TQTOXXz-C5I/AAAAAAAAAcQ/0qYBPzKq7js/s800/ImmovableFrame.png --- * 概要 [#summary] `JInternalFrame`をマウスなどで移動できないように固定します。 #contents #download(https://lh4.googleusercontent.com/_9Z4BYR88imo/TQTOXXz-C5I/AAAAAAAAAcQ/0qYBPzKq7js/s800/ImmovableFrame.png) **概要 [#lf0dad2e] JInternalFrameをマウスなどで移動できないように固定します。 #screenshot **サンプルコード [#a83e5c01] #code{{ BasicInternalFrameUI ui = (BasicInternalFrameUI)immovableFrame.getUI(); Component north = ui.getNorthPane(); MouseMotionListener[] actions = (MouseMotionListener[])north.getListeners(MouseMotionListener.class); for(int i=0;i<actions.length;i++) { north.removeMouseMotionListener(actions[i]); } * サンプルコード [#sourcecode] #code(link){{ BasicInternalFrameUI ui = (BasicInternalFrameUI) immovableFrame.getUI(); Component titleBar = ui.getNorthPane(); for (MouseMotionListener l: titleBar.getListeners(MouseMotionListener.class)) { titleBar.removeMouseMotionListener(l); } }} -&jnlp; -&jar; -&zip; **解説 [#k07f6217] JInternalFrameのMouseMotionListenerをすべて削除することで、マウスによる移動を不可能にしています。 * 解説 [#explanation] `JInternalFrame`の`MouseMotionListener`をすべて削除して、マウスによる移動を不可能に設定しています。 以下のようにしてタイトルバーを削除しても、移動できないフレームを作成することができます。 - 以下のようにタイトルバー自体を削除して移動できないフレームを作成する方法もある #code{{ ui.setNorthPane(null); internalframe.setBorder(BorderFactory.createEmptyBorder()); internalframe.setSize(200,50); internalframe.add(new JLabel("移動できないフレーム", SwingConstants.CENTER)); internalframe.setLocation(10,10); internalframe.pack(); ui.setNorthPane(null); internalframe.setBorder(BorderFactory.createEmptyBorder()); internalframe.setSize(200, 50); internalframe.add(new JLabel("Non-movable frame", SwingConstants.CENTER)); internalframe.setLocation(10, 10); internalframe.pack(); }} #screenshot(,screenshot2.png) #ref(https://lh3.googleusercontent.com/_9Z4BYR88imo/TQTOZ803FiI/AAAAAAAAAcU/Bj1t9F8ZKqI/s800/ImmovableFrame1.png) **参考リンク [#t17ee3f9] -[[Lock JInternalPane>http://forum.java.sun.com/thread.jspa?threadID=609043]] * 参考リンク [#reference] - [https://docs.oracle.com/javase/jp/8/docs/api/javax/swing/plaf/basic/BasicInternalFrameUI.html#getNorthPane-- BasicInternalFrameUI#getNorthPane() (Java Platform SE 8)] - [https://community.oracle.com/thread/1392111 Swing - Lock JInternalPane] **コメント [#rd25830b] * コメント [#comment] #comment #comment