So im trying to get a specified image as the "look" of the Jbutton but it just isnt working. any ideas?
The code:
JButton btnClose = new JButton("Close");
try {
Image img = ImageIO.read(Window.class.getResource("resources/quit_button.bmp"));
btnClose.setIcon(new ImageIcon(img));
} catch (IOException ex) {
}
btnClose.setVisible(true);
btnClose.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
frame.dispose();
}
});
My image path is: C:\Users\ *User*\workspace\Pede\pede_Exe\resources\quit_button.bmp