Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用我在 Photoshop 中制作的图像作为我的 GUI 的背景。我怎么做?我还制作了一些我想在执行操作后在按钮背景中显示的图像......
对于 JButton,使用这个:
JButton button = new JButton("Button Name", new ImageIcon("foo.png");
面板更有趣一些。不过,这是一个很好的方法:
ImagePanel panel = new ImagePanel(new ImageIcon("foo.png").getImage());