JInternalFrame向标题栏添加图标

时间:2011-08-05 23:35:37

标签: java swing icons jinternalframe

我想添加一个ImageIcon或与JInternalFrame标题栏类似,以便[x]图标位于最东边,可图标图标位于第二个最东边,并且自定义图标是东部第三。这可行吗?

3 个答案:

答案 0 :(得分:0)

这对我有用:

{{1}}

答案 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
}

答案 2 :(得分:-1)

获取父框架:     // parent是容器jDesktopPane - > parent = new JFrame()

this.setFrameIcon(new javax.swing.ImageIcon(this.parent.getIconImage()));