btn1 = new JButton();
btn1.setText("New game");
btn1.setForeground(Color.PINK);
btn1.setFont(new Font("serif",0,20));
btn1.setBounds(130,450,200,80);
btn1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
}
});
add(btn1);
btn2 = new JButton();
btn2.setText("Exit");
btn2.setForeground(Color.PINK);
btn2.setFont(new Font("serif",0,20));
btn2.setBounds(530,450,200,80);
btn2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
add(btn2);
}
public void paintComponent (Graphics gr) {
super.paintComponent(gr);
gr.drawImage(fon, 0,0,900,600,null);
gr.setFont(new Font("serif",3,40));
gr.setColor(Color.PINK);
gr.drawString("Компьютер", 150, 50);
gr.drawString("Игрок", 150, 50);
}
}