Swing/InternalFrameTitleIcon のバックアップ(No.11)
- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- Swing/InternalFrameTitleIcon へ行く。
- 1 (2014-12-22 (月) 00:08:15)
- 2 (2015-03-09 (月) 14:46:02)
- 3 (2015-03-16 (月) 17:28:33)
- 4 (2016-03-20 (日) 20:21:45)
- 5 (2017-07-22 (土) 19:10:11)
- 6 (2018-07-20 (金) 16:51:54)
- 7 (2020-07-22 (水) 10:05:22)
- 8 (2021-12-17 (金) 11:55:51)
- 9 (2024-01-17 (水) 11:22:07)
- 10 (2025-01-03 (金) 08:57:02)
- 11 (2025-01-03 (金) 09:01:23)
- 12 (2025-01-03 (金) 09:02:38)
- 13 (2025-01-03 (金) 09:03:21)
- 14 (2025-01-03 (金) 09:04:02)
- category: swing
folder: InternalFrameTitleIcon
title: JInternalFrameのタイトルバーに表示されるアイコンを変更する
tags: [JInternalFrame, JDesktopPane, Icon]
author: aterai
pubdate: 2014-12-22T00:07:25+09:00
description: JInternalFrameのタイトルバー左上隅に表示されるアイコンを各JInternalFrame毎に設定します。
image:
Summary
JInternalFrame
のタイトルバー左上隅に表示されるアイコンを各JInternalFrame
毎に設定します。
Screenshot

Advertisement
サンプルコード
int idx = 0;
for (Color c: Arrays.asList(Color.RED, Color.GREEN, Color.BLUE)) {
String title = String.format("Document #%s", ++idx);
JInternalFrame f = new JInternalFrame(title, true, true, true, true);
desktop.add(f);
f.setFrameIcon(new ColorIcon(c));
f.setSize(240, 120);
f.setLocation(10 + 20 * idx, 20 * idx);
f.setVisible(true);
}
View in GitHub: Java, Kotlin解説
JInternalFrame#setFrameIcon(Icon)
メソッドを使用して各JInternalFrame
に異なる色の16x16
アイコンを設定WindowsLookAndFeel
ではアイコン化したときJInternalFrame#setFrameIcon(Icon)
で設定したIcon
を拡大した画像がJInternalFrame.JDesktopIcon
として使用されるMotifLookAndFeel
ではJInternalFrame#setFrameIcon(Icon)
で設定したアイコンは無視され表示されない(デフォルトアイコンも表示しない)