import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
public class jbutton extends JFrame
{
public jbutton()
{
this.setBounds(100, 100, 150, 150);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Icon icon=new ImageIcon("add.gif");
JButton button=new JButton(icon);
this.getContentPane().add(button);
}
public static void main(String arps[])
{
new jbutton();
}
}
/*
* 1 Icon icon=new ImageIcon("add.gif");貌似只有gif可以
* 2 在工程下面必须有一个gif文件
*/
装饰Jbutton
最新推荐文章于 2020-08-08 14:05:30 发布