当前位置: 技术问答>java相关
如何把JAVA应用程序窗口上的咖啡杯图标换掉?(记得有人提过这个问题的,但是找不到了)
来源: 互联网 发布时间:2015-01-21
本文导语: | import java.awt.*; import javax.swing.*; public class Test { public static void main(String args[]) { Toolkit kit = Toolkit.getDefaultToolkit(); JWindow theWindow = new JWindow(); JLabel theLabel = new JLabel(new ImageIcon("a.jpg")); theLabel.se...
|
import java.awt.*;
import javax.swing.*;
public class Test {
public static void main(String args[]) {
Toolkit kit = Toolkit.getDefaultToolkit();
JWindow theWindow = new JWindow();
JLabel theLabel = new JLabel(new ImageIcon("a.jpg"));
theLabel.setBorder(BorderFactory.createRaisedBevelBorder());
theWindow.getContentPane().add(theLabel,BorderLayout.CENTER);
theWindow.setLocation(280,180);
theWindow.setSize(400,300);
theWindow.show();
}
}
import javax.swing.*;
public class Test {
public static void main(String args[]) {
Toolkit kit = Toolkit.getDefaultToolkit();
JWindow theWindow = new JWindow();
JLabel theLabel = new JLabel(new ImageIcon("a.jpg"));
theLabel.setBorder(BorderFactory.createRaisedBevelBorder());
theWindow.getContentPane().add(theLabel,BorderLayout.CENTER);
theWindow.setLocation(280,180);
theWindow.setSize(400,300);
theWindow.show();
}
}
|
........ extends Frame{
.
.
.
Image img = Toolkit.getDefaultToolkit().getImage("图片路径及名称");
setIconImage(img);
.
.
.
}
.
.
.
Image img = Toolkit.getDefaultToolkit().getImage("图片路径及名称");
setIconImage(img);
.
.
.
}
|
http://www.csdn.net/expert/topic/213/213508.shtm