Swing/CloseInternalFrame のバックアップソース(No.4)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - 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(../) RIGHT:Posted by [[aterai]] at 2008-05-05 *JInternalFrameを閉じる [#uf3146bf] JInternalFrameを閉じます。 -&jnlp; -&jar; -&zip; //#screenshot #ref(http://lh3.ggpht.com/_9Z4BYR88imo/TQTJcTXtdNI/AAAAAAAAAUY/zL_wkJJa_Ks/s800/CloseInternalFrame.png) **サンプルコード [#y0ad6085] #code{{ closeSelectedFrameAction1 = new AbstractAction() { public void actionPerformed(ActionEvent e) { JInternalFrame f = desktop.getSelectedFrame(); if(f!=null) { desktop.getDesktopManager().closeFrame(f); } } }; }} #code{{ closeSelectedFrameAction2 = new AbstractAction() { public void actionPerformed(ActionEvent e) { JInternalFrame f = desktop.getSelectedFrame(); if(f!=null) { f.doDefaultCloseAction(); } } }; }} #code{{ closeSelectedFrameAction3 = new AbstractAction() { public void actionPerformed(ActionEvent e) { try{ JInternalFrame f = desktop.getSelectedFrame(); if(f!=null) { f.setClosed(true); } }catch(java.beans.PropertyVetoException ex) { ex.printStackTrace(); } } }; }} #code{{ disposeSelectedFrameAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { JInternalFrame f = desktop.getSelectedFrame(); if(f!=null) { f.dispose(); } } }; }} **解説 [#v8ddc342] 上記のサンプルでは、選択されているJInternalFrameをツールバーのボタンやESCキー((OSがWindowsの場合のデフォルトは、Ctrl+F4))で閉じることができます。 - RED -- JInternalFrame#dispose メソッドを使用 -- 閉じた後、他のフレームに選択状態が移動しない - GREEN -- DesktopManager#closeFrame メソッドを使用 - BLUE -- JInternalFrame#doDefaultCloseAction メソッドを使用 //-- JInternalFrame#setDefaultCloseOperation の設定に従う - YELLOW -- JInternalFrame#setClosed(true) メソッドを使用 ---- JDK 1.5 + WindowsL&F では、JInternalFrameを閉じたとき、アイコン化されているJInternalFrameには選択状態は移動しません。 //**参考リンク **コメント [#o6a47604] #comment