[英]JInternalFrame adding an icon to the title bar
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.我想添加一个
ImageIcon
或与JInternalFrame
的标题栏相媲美,这样 [x] 图标位于最东端,可图标图标位于最东端第二位,自定义图标位于最东端第三位。 Is this doable?这是可行的吗?
This worked for me:这对我有用:
ImageIcon icon = new ImageIcon(ClassLoader.getSystemResource("Iconos/icono.png"));
this.setFrameIcon(icon);
for get for parent frame : // parent 是容器 jDesktopPane -> parent = new JFrame ()
this.setFrameIcon(new javax.swing.ImageIcon(this.parent.getIconImage()));
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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.