JInternalFrameのタイトルバーに表示されるアイコンを変更する
Total: 4208, Today: 2, Yesterday: 0
Posted by aterai at
Last-modified:
Summary
JInternalFrameのタイトルバー左上隅に表示されるアイコンを各JInternalFrame毎に設定します。
Screenshot

Advertisement
Source Code Examples
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, KotlinDescription
JInternalFrame#setFrameIcon(Icon)メソッドを使用して各JInternalFrameに異なる色の16x16アイコンを設定WindowsLookAndFeelではアイコン化したときJInternalFrame#setFrameIcon(Icon)で設定したIconを拡大した画像がJInternalFrame.JDesktopIconとして使用されるMotifLookAndFeelではJInternalFrame#setFrameIcon(Icon)で設定したアイコンは無視され表示されない(デフォルトアイコンも表示しない)