0

我正在尝试使用我在 Photoshop 中制作的图像作为我的 GUI 的背景。我怎么做?我还制作了一些我想在执行操作后在按钮背景中显示的图像......

4

1 回答 1

2

对于 JButton,使用这个:

JButton button = new JButton("Button Name", new ImageIcon("foo.png");

面板更有趣一些。不过,这是一个很好的方法:

ImagePanel panel = new ImagePanel(new ImageIcon("foo.png").getImage());
于 2011-12-04T03:24:37.583 回答