Swing/CloseInternalFrame のバックアップの現在との差分(No.5)
- バックアップ一覧
- 差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/CloseInternalFrame へ行く。
- 1 (2008-05-08 (木) 18:58:35)
- 2 (2008-09-12 (金) 13:15:10)
- 3 (2009-02-27 (金) 16:33:24)
- 4 (2011-04-21 (木) 16:02:00)
- 5 (2013-04-23 (火) 17:22:53)
- 6 (2013-07-26 (金) 01:13:13)
- 7 (2014-11-01 (土) 00:46:09)
- 8 (2014-11-18 (火) 01:37:53)
- 9 (2015-01-01 (木) 21:41:31)
- 10 (2016-04-28 (木) 15:24:37)
- 11 (2017-08-02 (水) 15:29:11)
- 12 (2018-08-07 (火) 14:27:11)
- 13 (2020-08-08 (土) 16:29:42)
- 14 (2021-12-31 (金) 01:43:01)
- 15 (2022-08-20 (土) 22:15:25)
- 16 (2022-10-04 (火) 15:53:47)
- 追加された行はこの色です。
- 削除された行はこの色です。
TITLE:JInternalFrameを閉じる #navi(../) #tags(JInternalFrame, JDesktopPane, DesktopManager) RIGHT:Posted by &author(aterai); at 2008-05-05 *JInternalFrameを閉じる [#uf3146bf] ``JInternalFrame``を閉じます。 --- category: swing folder: CloseInternalFrame title: JInternalFrameを閉じる tags: [JInternalFrame, JDesktopPane, DesktopManager] author: aterai pubdate: 2008-05-05T20:51:51+09:00 description: 選択中のJInternalFrameをDesktopManagerなどを使用して外部から閉じる(JDesktopPaneから除去する)方法をテストします。 image: https://lh3.googleusercontent.com/_9Z4BYR88imo/TQTJcTXtdNI/AAAAAAAAAUY/zL_wkJJa_Ks/s800/CloseInternalFrame.png --- * 概要 [#summary] 選択中の`JInternalFrame`を`DesktopManager`などを使用して外部から閉じる(`JDesktopPane`から除去する)方法をテストします。 -&jnlp; -&jar; -&zip; #download(https://lh3.googleusercontent.com/_9Z4BYR88imo/TQTJcTXtdNI/AAAAAAAAAUY/zL_wkJJa_Ks/s800/CloseInternalFrame.png) //#screenshot #ref(http://lh3.ggpht.com/_9Z4BYR88imo/TQTJcTXtdNI/AAAAAAAAAUY/zL_wkJJa_Ks/s800/CloseInternalFrame.png) **サンプルコード [#y0ad6085] * サンプルコード [#sourcecode] #code(link){{ closeSelectedFrameAction1 = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { JInternalFrame f = desktop.getSelectedFrame(); if(f!=null) { if (f != null) { desktop.getDesktopManager().closeFrame(f); } } }; }} #code{{ closeSelectedFrameAction2 = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { JInternalFrame f = desktop.getSelectedFrame(); if(f!=null) { if (f != null) { f.doDefaultCloseAction(); } } }; }} #code{{ closeSelectedFrameAction3 = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { try{ try { JInternalFrame f = desktop.getSelectedFrame(); if(f!=null) { if (f != null) { f.setClosed(true); } }catch(java.beans.PropertyVetoException ex) { } catch (PropertyVetoException ex) { ex.printStackTrace(); } } }; }} #code{{ disposeSelectedFrameAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { JInternalFrame f = desktop.getSelectedFrame(); if(f!=null) { if (f != null) { f.dispose(); } } }; }} **解説 [#v8ddc342] 上記のサンプルでは、選択されている``JInternalFrame``をツールバーのボタンや``ESC``キー(``OS``が``Windows``の場合のデフォルトは、``Ctrl+F4``)で閉じることができます。 * 解説 [#explanation] 上記のサンプルでは、選択されている`JInternalFrame`をツールバーのボタンやKBD{Esc}キー(`OS`が`Windows`の場合のデフォルトはKBD{Ctrl+F4})で閉じることができます。 - ``RED`` -- ``JInternalFrame#dispose``メソッドを使用 - `RED` -- `JInternalFrame#dispose()`メソッドを使用 -- 閉じた後、他のフレームに選択状態が移動しない - ``GREEN`` -- ``DesktopManager#closeFrame``メソッドを使用 - ``BLUE`` -- ``JInternalFrame#doDefaultCloseAction``メソッドを使用 //-- ``JInternalFrame#setDefaultCloseOperation``の設定に従う - ``YELLOW`` -- ``JInternalFrame#setClosed(true)``メソッドを使用 - `GREEN` -- `DesktopManager#closeFrame(JInternalFrame)`メソッドを使用 - `BLUE` -- `JInternalFrame#doDefaultCloseAction()`メソッドを使用 - `YELLOW` -- `JInternalFrame#setClosed(true)`メソッドを使用 ---- ``JDK 1.5`` + ``WindowsLookAndFeel``では、``JInternalFrame``を閉じたとき、アイコン化されている``JInternalFrame``には選択状態は移動しません。 - `JDK 1.5` + `WindowsLookAndFeel`では`JInternalFrame`を閉じたときアイコン化されている`JInternalFrame`には選択状態は移動しない //**参考リンク **コメント [#o6a47604] * 参考リンク [#reference] - [https://mail.openjdk.org/pipermail/swing-dev/2013-April/002688.html <Swing Dev> 8 Review request for 8012004: JINTERNALFRAME NOT BEING FINALIZED AFTER CLOSING] - [https://bugs.openjdk.org/browse/JDK-4759312 JDK-4759312 JInternalFrame Not Being Finalized After Closing - Java Bug System] * コメント [#comment] #comment #comment