-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.java
More file actions
62 lines (48 loc) · 1.48 KB
/
Copy pathMenu.java
File metadata and controls
62 lines (48 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Menu extends JFrame implements ActionListener{
private JPanel panelS;
private JButton iniciar,salir;
private CanvasMenu fondo;
public Menu() {
super("juego ");
setSize(1800,980);
setLocationRelativeTo(null);
this.setLayout(new BorderLayout());
panelS=new JPanel();
iniciar= new JButton("START");
salir= new JButton("EXIT");
iniciar.addActionListener(this);
salir.addActionListener(this);
iniciar.setPreferredSize(new Dimension(150,60));
salir.setPreferredSize(new Dimension(150,60));
panelS.setLayout(new FlowLayout());
panelS.setOpaque(true);
panelS.setBackground(Color.BLUE);
panelS.setForeground(Color.BLUE);
panelS.add(iniciar);
panelS.add(salir);
fondo = new CanvasMenu("Space Adventure");
this.add(fondo,BorderLayout.CENTER);
this.add(panelS,BorderLayout.SOUTH);
}
@Override
public void actionPerformed(ActionEvent evento) {
// TODO Auto-generated method stub
if(evento.getSource()==iniciar){
Ventana mv =new Ventana();
mv.setVisible(true);
mv.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(false);
}else{
System.exit(0);
}
}
}