替换JFrame窗口左上角图标的方法

版权声明:[email protected] https://blog.csdn.net/weixin_43198122/article/details/84864004

用MyEclipse写了一个JFrame界面,最后发现左上角图标有点碍眼在这里插入图片描述,于是想把它换掉,代码如下:`package com.hbsd.study;

import javax.swing.ImageIcon;
import javax.swing.JFrame;

public class Test extends JFrame {
public Test(){
super(" Music~");
ImageIcon icon=new ImageIcon(“2.png”);
this.setIconImage(icon.getImage());
this.setBounds(400, 400, 600, 400);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
public static void main(String[] args) {
Test test=new Test();
}
}
`

猜你喜欢

转载自blog.csdn.net/weixin_43198122/article/details/84864004
今日推荐