Tambahkan Icon di JInternalFrame (Java)


untuk menambahkan icon pada title bar di JInternal Frame sangat sederhana yaitu dengan cara:


JInternalFrame internalFrame = new JInternalFrame();
ImageIcon icon = new ImageIcon(getClass().getResource("/jinternalframe/images/icon2.png"));
internalFrame.setFrameIcon(icon);

atau dengan menggunakan URL :


JInternalFrame internalFrame = new JInternalFrame();
ImageIcon icon;
try {
icon = new ImageIcon(new URL("http://icons.iconarchive.com/icons/dapino/office-men/128/Man-Grey-icon.png"));
internalFrame.setFrameIcon(icon);
} catch (MalformedURLException ex) {
ex.printStackTrace();
}

selamat mencoba! 😀

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s