I'm developing the homepage of a simple game, what I want is to add a button on the screen where when I click on the game to start, follow below my code of how I'm setting up the menu and bringing the background, the code behind the image I put like the button, but I am not able to assign the click action to it, I do not know what would be the best way to do this, I accept ideas.
public Menu(){
setFocusable(true);
setDoubleBuffered(true);
ImageIcon referencia = new ImageIcon("res\images\fundo.png");
fundo = referencia.getImage();
emJogo = true; //iniciar jogo
timer = new Timer(5, this);
timer.start();
ImageIcon referencia2 = new ImageIcon("res\images\btn1.png");
jogar = referencia2.getImage();
}
public void paint(Graphics g){
Graphics2D graficos = (Graphics2D) g;
graficos.drawImage(fundo, 0, 0, null);
graficos.drawImage(jogar, 0, 0, null);
g.dispose();
}