11智能在线
新记
java 如何用swing创建一个带图标的按钮
如题所述
举报该文章
相关建议 推荐于2018-04-05
JButton有个构造函数是JButton(Icon icon),就是用来创建带图标的按钮的。
可以这样用,如:
JButton jb = new JButton(new ImageIcon("images/myImage.gif"));
这样得到的就是带图标的按钮了。
温馨提示:内容为网友见解,仅供参考
当前网址:
https://22.t2y.org/zz/ih66hht6c.html
其他看法
第1个回答 2012-04-09
JButton btn = new JButton(new ImageIcon(this.getClass().getResource("../images/logo.gif")));
第2个回答 2012-04-18
写个类继承jpael 在创建对象添加到里面
相似回答
大家正在搜
相关问题
java swing 创建带图标的按钮?
java怎么创建一个按钮
用Java如何编写在面板中加入带图标的按钮的程序代码
如何在javaswing中把其中一个面板上带图标的按钮中拖曳...
用java创建一个带按钮对象的窗口的程序,帮我看看哪里错了?
(急)java swing 如何让按钮的文本显示在图标下面?
Java中怎么样建立按钮数组
怎么用Java swing设置一个有是否按钮的弹框