Swing/PaletteInternalFrame のバックアップ(No.2)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- Swing/PaletteInternalFrame へ行く。
- category: swing
folder: PaletteInternalFrame
title: JInternalFrameの縁の装飾を変更してパレット化する
tags: [JInternalFrame, JDesktopPane, MetalLookAndFeel]
author: aterai
pubdate: 2016-03-21T22:17:29+09:00
description: パレット化したJInternalFrameをJDesktopPaneのパレットレイヤーに追加します。
image:
概要
パレット化したJInternalFrame
をJDesktopPane
のパレットレイヤーに追加します。
Screenshot

Advertisement
サンプルコード
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);
View in GitHub: Java, Kotlin解説
JInternalFrame#putClientProperty("JInternalFrame.isPalette", Boolean.TRUE);
で、パレット化MetalLookAndFeel
でのみ有効
JDesktopPane#add(palette, JDesktopPane.PALETTE_LAYER);
でパレットレイヤーに追加- パレットレイヤーは、デフォルトレイヤー(
JDesktopPane.DEFAULT_LAYER
)の一つ上のレイヤーで、常にその下のレイヤーに配置れさたコンポーネントより上に表示される
- パレットレイヤーは、デフォルトレイヤー(
- パレット化した
JInternalFrame
をデフォルトではマウス操作でアイコン化することはできない?JInternalFrame#setIcon(boolean)
メソッドを使用すればアイコン化することは可能- 最大化はパレットのタイトルバーをダブルクリック、クローズはタイトルバー右端のボタンをクリックで可能