JButton和JLabel都可以加载图片。如果您想在JButton或JLabel中显示图片,可以使用以下代码:
```java
ImageIcon icon = new ImageIcon("path/to/image.jpg");
button.setIcon(icon);
label.setIcon(icon);
```
```java
ImageIcon icon = new ImageIcon("path/to/image.jpg");
button.setIcon(icon);
label.setIcon(icon);
```
Jbutton 和jlabel都不能加载图片吗
JButton和JLabel都可以加载图片。如果您想在JButton或JLabel中显示图片,可以使用以下代码:```javaImageIcon icon = new ImageIcon("path/to/image.jpg");button.setIcon(。下面小编给大家分享Jbutton 和jlabel都不能加载图片吗,希望能帮助到大家。 Jbutton 和jlabel都不能加载图片吗文档下载网址链接:
推荐度:





点击下载完整版文档为doc格式