Swing/RelocatedIcon のバックアップ差分(No.1)
- バックアップ一覧
- 現在との差分 を表示
- 現在との差分 - 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)
- 追加された行はこの色です。
- 削除された行はこの色です。
TITLE:DesktopManagerでアイコンの再配置 #navi(../) *DesktopManagerでアイコンの再配置 [#pe96a24f] >編集者:[[Terai Atsuhiro>terai]]~ 作成日:2007-01-15~ 更新日:&lastmod; #contents **概要 [#w9d38ffd] JDesktopPaneのサイズが変更されたとき、アイコン化しているJInternalFrameの再配置を行います。[[Bug ID: 4765256 REGRESSION: Icons in JDesktopPane not repositioned when pane is resized>http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4765256]]からソースコードの大部分を引用しています。 #screenshot **サンプルコード [#v3086042] #code{{ class ReIconifyDesktopManager extends DefaultDesktopManager { public void reIconifyFrame(JInternalFrame jif) { deiconifyFrame(jif); Rectangle r = getBoundsForIconOf(jif); iconifyFrame(jif); jif.getDesktopIcon().setBounds(r); } } ...... ReIconifyDesktopManager rdm = new ReIconifyDesktopManager(); desktop.setDesktopManager(rdm); desktop.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent ce) { JDesktopPane dp = (JDesktopPane)ce.getComponent(); ReIconifyDesktopManager dm = (ReIconifyDesktopManager)dp.getDesktopManager(); JInternalFrame[] jif = dp.getAllFrames(); for(int i=0;i<jif.length;i++) { if(jif[i].isIcon()) dm.reIconifyFrame(jif[i]); } } }); ...... }} -&jnlp; -&jar; -&zip; **解説 [#q4580c19] 上記のサンプルでは、JToggleButtonが選択されている場合、再配置を行っています。 JDesktopPaneがリサイズされた場合、以下のような手順で再配置を行っています。 -アイコン化したJInternalFrame を一旦、元のサイズと位置に復元 -アイコン化した場合の位置を再計算 -再びアイコン化 -再計算した位置への移動 **参考リンク [#j6e9b199] - [[Bug ID: 4765256 REGRESSION: Icons in JDesktopPane not repositioned when pane is resized>http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4765256]] -- [[JInternalFrame - iconify in a JDesktopPane>http://forum.java.sun.com/thread.jspa?threadID=5122847]] - [[Bug ID: 4110799 JInternalFrame icon position unchanged w/ resize>http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4110799]] -- [[JInternalFrameは最初にアイコン化しておかないと位置が更新されない>http://d.hatena.ne.jp/tori31001/20060901]] -- [[JInternalFrameを一番手前に表示>Swing/LayeredPane]] **コメント [#u2043794] #comment