What I'm currently trying to do is put an Image over a JButton
and still be able to click on the button. I don't mean putting an image into the button like some sort of icon. I mean having a image inside a JFrame
and a button behind that image and being able to click on it. All help is appreciated.
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JButton;
public class ButtonImage extends JFrame{
static JButton save;
JButton cancel;
ButtonImage(){
save = new JButton("Save");
cancel = new JButton("Cancel");
setLayout(new FlowLayout());
add(save);
add(cancel);
setVisible(true);
setSize(400,300);
setLocation(500,400);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLayout(null);
}
public static void main(String[]args){
new ButtonImage();
save.setBounds(100,200,90,30);
}
}