Swing/RelocatedIcon のバックアップの現在との差分(No.19)
- バックアップ一覧
- 差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/RelocatedIcon へ行く。
- 1 (2007-05-15 (火) 17:51:17)
- 2 (2007-11-01 (木) 13:59:23)
- 3 (2008-05-19 (月) 21:57:40)
- 4 (2008-05-20 (火) 16:36:16)
- 5 (2008-12-10 (水) 21:27:26)
- 6 (2011-10-04 (火) 16:58:32)
- 7 (2013-02-10 (日) 00:03:09)
- 8 (2013-08-20 (火) 14:38:21)
- 9 (2013-08-27 (火) 18:02:12)
- 10 (2014-11-01 (土) 00:46:09)
- 11 (2014-11-25 (火) 03:03:31)
- 12 (2015-01-21 (水) 18:37:10)
- 13 (2016-04-26 (火) 15:24:34)
- 14 (2016-09-15 (木) 16:34:44)
- 15 (2017-10-25 (水) 15:45:49)
- 16 (2017-11-02 (木) 15:34:40)
- 17 (2019-03-15 (金) 17:24:57)
- 18 (2020-12-24 (木) 12:05:39)
- 19 (2022-08-20 (土) 22:15:25)
- 20 (2023-06-09 (金) 11:16:24)
- 追加された行はこの色です。
- 削除された行はこの色です。
--- category: swing folder: RelocatedIcon title: DesktopManagerでアイコンの再配置 tags: [DesktopManager, JDesktopPane, JInternalFrame] author: aterai pubdate: 2007-01-15T12:27:58+09:00 description: JDesktopPaneのサイズが変更されたとき、アイコン化しているJInternalFrameの再配置を行います。 image: https://lh6.googleusercontent.com/_9Z4BYR88imo/TQTRm01W30I/AAAAAAAAAhc/eBhL-DDKkSo/s800/RelocatedIcon.png --- * 概要 [#summary] `JDesktopPane`のサイズが変更されたとき、アイコン化している`JInternalFrame`の再配置を行います。[https://bugs.openjdk.java.net/browse/JDK-4765256 [JDK-4765256] REGRESSION: Icons in JDesktopPane not repositioned when pane is resized - Java Bug System]からソースコードの大部分を引用しています。 `JDesktopPane`のサイズが変更されたとき、アイコン化している`JInternalFrame`の再配置を行います。[https://bugs.openjdk.org/browse/JDK-4765256 [JDK-4765256] REGRESSION: Icons in JDesktopPane not repositioned when pane is resized - Java Bug System]からソースコードの大部分を引用しています。 #download(https://lh6.googleusercontent.com/_9Z4BYR88imo/TQTRm01W30I/AAAAAAAAAhc/eBhL-DDKkSo/s800/RelocatedIcon.png) * サンプルコード [#sourcecode] #code(link){{ class ReIconifyDesktopManager extends DefaultDesktopManager { public void reIconifyFrame(JInternalFrame jif) { deiconifyFrame(jif); Rectangle r = getBoundsForIconOf(jif); iconifyFrame(jif); jif.getDesktopIcon().setBounds(r); } } private void doReIconify(JDesktopPane desktopPane) { DesktopManager dm = desktopPane.getDesktopManager(); if (dm instanceof ReIconifyDesktopManager) { ReIconifyDesktopManager rdm = (ReIconifyDesktopManager) dm; for (JInternalFrame f: desktopPane.getAllFrames()) { if (f.isIcon()) { rdm.reIconifyFrame(f); } } } } }} * 解説 [#explanation] 上記のサンプルでは、`JDesktopPane`がリサイズされた場合、以下のような手順で再配置を行っています。 - `JDesktopPane`がリサイズされた場合、以下のような手順で再配置を実行 -- `GTKLookAndFeel`を使用する場合、アイコンの移動自体がデフォルトでは不可なのでこの設定は無意味になる + アイコン化した`JInternalFrame`を一旦元のサイズと位置に復元 + アイコン化した場合の位置を再計算 + 再びアイコン化 + 再計算した位置への移動 ---- - `GTKLookAndFeel`を使用する場合、アイコンの移動自体がデフォルトでは不可なのでこの設定は無意味になる * 参考リンク [#reference] - [https://bugs.openjdk.java.net/browse/JDK-4765256 [JDK-4765256] REGRESSION: Icons in JDesktopPane not repositioned when pane is resized - Java Bug System] - [https://bugs.openjdk.org/browse/JDK-4765256 [JDK-4765256] REGRESSION: Icons in JDesktopPane not repositioned when pane is resized - Java Bug System] -- via: [https://community.oracle.com/thread/1374482 Swing - JInternalFrame - iconify in a JDesktopPane] - [https://bugs.openjdk.java.net/browse/JDK-4110799 [JDK-4110799] JInternalFrame icon position unchanged w/ resize - Java Bug System] - [https://bugs.openjdk.org/browse/JDK-4110799 [JDK-4110799] JInternalFrame icon position unchanged w/ resize - Java Bug System] -- [http://d.hatena.ne.jp/tori31001/20060901 JInternalFrameは最初にアイコン化しておかないと位置が更新されない] -- [[JInternalFrameを一番手前に表示>Swing/LayeredPane]] * コメント [#comment] #comment - [https://bugs.openjdk.java.net/browse/JDK-6647340 [JDK-6647340] Minimized JInternalFrame icons appear in incorrect positions if the main frame is resized - Java Bug System]は、`1.7.0 b38`で修正済み。 -- &user(aterai); &new{2008-12-10 (水) 21:27:26}; - `Windows7` + `WindowsLookAndFeel`で`JDesktopPane`の背景が黒になる: [https://bugs.openjdk.java.net/browse/JDK-7012008 Bug ID: JDK-7012008 JDesktopPane - Wrong background color with Win7+WindowsLnf] -- &user(aterai); &new{2011-10-04 (火) 16:58:32}; // [https://bugs.openjdk.java.net/browse/JDK-7012008 JDK-7012008 JDesktopPane - Wrong background color with Win7+WindowsLnf - Java Bug System] // [https://bugs.openjdk.java.net/browse/JDK-7008416 Bug ID: 7008416 JDesktopPane - Wrong background color with Win7+WindowsLnf] -- &user(aterai); &new{2011-10-04 (火) 16:58:32}; - [https://bugs.openjdk.org/browse/JDK-6647340 [JDK-6647340] Minimized JInternalFrame icons appear in incorrect positions if the main frame is resized - Java Bug System]は、`1.7.0 b38`で修正済み。 -- &user(aterai); &new{2008-12-10 (水) 21:27:26}; - `Windows7` + `WindowsLookAndFeel`で`JDesktopPane`の背景が黒になる: [https://bugs.openjdk.org/browse/JDK-7012008 Bug ID: JDK-7012008 JDesktopPane - Wrong background color with Win7+WindowsLnf] -- &user(aterai); &new{2011-10-04 (火) 16:58:32}; // [https://bugs.openjdk.org/browse/JDK-7012008 JDK-7012008 JDesktopPane - Wrong background color with Win7+WindowsLnf - Java Bug System] // [https://bugs.openjdk.org/browse/JDK-7008416 Bug ID: 7008416 JDesktopPane - Wrong background color with Win7+WindowsLnf] -- &user(aterai); &new{2011-10-04 (火) 16:58:32}; #comment