Swing/PaletteInternalFrame のバックアップの現在との差分(No.3)
- バックアップ一覧
- 差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/PaletteInternalFrame へ行く。
- 1 (2017-07-22 (土) 19:12:40)
- 2 (2018-03-02 (金) 14:11:42)
- 3 (2020-03-12 (木) 21:08:44)
- 4 (2021-08-27 (金) 11:48:16)
- 追加された行はこの色です。
- 削除された行はこの色です。
--- category: swing folder: PaletteInternalFrame title: JInternalFrameの縁の装飾を変更してパレット化する tags: [JInternalFrame, JDesktopPane, MetalLookAndFeel] author: aterai pubdate: 2016-03-21T22:17:29+09:00 description: パレット化したJInternalFrameをJDesktopPaneのパレットレイヤーに追加します。 image: https://lh3.googleusercontent.com/-WI8tV2GL8no/Vu_vV8kqSCI/AAAAAAAAOQ4/Os6hBhlLlCYP7L87Qkn_RBlFp8qkUEZrwCCo/s800-Ic42/PaletteInternalFrame.png --- * 概要 [#summary] パレット化した`JInternalFrame`を`JDesktopPane`のパレットレイヤーに追加します。 #download(https://lh3.googleusercontent.com/-WI8tV2GL8no/Vu_vV8kqSCI/AAAAAAAAOQ4/Os6hBhlLlCYP7L87Qkn_RBlFp8qkUEZrwCCo/s800-Ic42/PaletteInternalFrame.png) * サンプルコード [#sourcecode] #code(link){{ JInternalFrame palette = new JInternalFrame("Palette", true, false, true, true); palette.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE); palette.setBounds(0, 0, 120, 120); palette.setMinimumSize(new Dimension(50, 50)); palette.add(new JScrollPane(new JTree())); palette.setVisible(true); desktop.add(palette, JDesktopPane.PALETTE_LAYER); }} * 解説 [#explanation] - `JInternalFrame#putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);`で、パレット化 - `JInternalFrame#putClientProperty("JInternalFrame.isPalette", Boolean.TRUE)`でパレット化 -- `MetalLookAndFeel`でのみ有効 - `JDesktopPane#add(palette, JDesktopPane.PALETTE_LAYER);`でパレットレイヤーに追加 -- パレットレイヤーは、デフォルトレイヤー(`JDesktopPane.DEFAULT_LAYER`)の一つ上のレイヤーで、常にその下のレイヤーに配置れさたコンポーネントより上に表示される - `JDesktopPane#add(palette, JDesktopPane.PALETTE_LAYER)`でパレットレイヤーに追加 -- パレットレイヤーはデフォルトレイヤー(`JDesktopPane.DEFAULT_LAYER`)の一つ上のレイヤーで常にその下のレイヤーに配置れさたコンポーネントより上に表示される - パレット化した`JInternalFrame`をデフォルトではマウス操作でアイコン化することはできない? -- `JInternalFrame#setIcon(boolean)`メソッドを使用すればアイコン化することは可能 -- 最大化はパレットのタイトルバーをダブルクリック、クローズはタイトルバー右端のボタンをクリックで可能 * 参考リンク [#reference] - [https://docs.oracle.com/javase/jp/8/docs/api/javax/swing/plaf/metal/MetalInternalFrameUI.html#IS_PALETTE MetalInternalFrameUI.IS_PALETTE (Java Platform SE 8)] * コメント [#comment] #comment #comment