JInternalFrameの縁の装飾を変更してパレット化する
Total: 2864
, Today: 1
, Yesterday: 2
Posted by aterai at
Last-modified:
Summary
パレット化したJInternalFrame
をJDesktopPane
のパレットレイヤーに追加します。
Screenshot

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