I'd like to add an ImageIcon
or comparable to a JInternalFrame
's titlebar such that the [x] icon is east-most, the iconable icon is second east-most, and a custom icon is third east-most. Is this doable?
Asked
Active
Viewed 7,661 times
5

Jason Plank
- 2,336
- 5
- 31
- 40

farm ostrich
- 5,881
- 14
- 55
- 81
-
There is no easy way to do this. This is the responsibility of the LAF. – camickr Aug 06 '11 at 00:11
-
@camickr is correct, but the icons are [there](http://stackoverflow.com/questions/6762984/java-swing-application-message-dialog-help/6766983#6766983) if you want to use them in some other way. – trashgod Aug 06 '11 at 03:27
3 Answers
0
This worked for me:
ImageIcon icon = new ImageIcon(ClassLoader.getSystemResource("Iconos/icono.png"));
this.setFrameIcon(icon);

Mogsdad
- 44,709
- 21
- 151
- 275
-1
for obtain for parent frame : // parent is container jDesktopPane -> parent = new JFrame ()
this.setFrameIcon(new javax.swing.ImageIcon(this.parent.getIconImage()));

joeuyuni
- 1
-1
JInternalFrame jInternalFrame1 = new JInternalFrame("Test Internal Frame",false,false,false,false);
try {
URL url = new URL("images/icon.gif");
ImageIcon icon = new ImageIcon(url);
jInternalFrame1.setFrameIcon(icon);
}
catch (MalformedURLException ex)
{
//whatever you want to put here
}

MNet
- 79
- 1
- 2
- 7
-
2this will change the default top-left icon, not add an additional one? Ya? – farm ostrich Aug 06 '11 at 00:02