forked from bryanjiang117/Teamfight-Tactics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.java
52 lines (51 loc) · 1.7 KB
/
Menu.java
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
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
class Menu extends JPanel implements ActionListener {
private JLabel title;
private JButton play,instruction;
private ImageIcon logo;
public Menu(){
this.setPreferredSize(new Dimension(1300,700));
logo = new ImageIcon("TitleLogo.png");
play = new JButton("Play");
instruction = new JButton("Instructions");
title = new JLabel(logo);
play.addActionListener(this);
play.setBackground(new Color(246,178,61));
play.setOpaque(true);
play.setBorder(BorderFactory.createBevelBorder(0));
play.setFont(new Font("SansSerif",Font.PLAIN,30));
instruction.addActionListener(this);
instruction.setBackground(new Color(246,178,61));
instruction.setOpaque(true);
instruction.setBorder(BorderFactory.createBevelBorder(0));
instruction.setFont(new Font("SansSerif",Font.PLAIN,30));
this.setBackground(Color.ORANGE);
this.setLayout(null);
title.setBounds(0,20,1300,350);
play.setBounds(400,400,500,75);
instruction.setBounds(400,550,500,75);
this.add(title);
this.add(play);
this.add(instruction);
}
public void paintComponent(Graphics g){
super.paintComponent(g);
g.setFont(new Font("SansSerif",Font.PLAIN,20));
g.drawString("By:Bryan Jiang and Eric Chen",1000,650);
}
public void actionPerformed(ActionEvent event){
try{
if(event.getSource()==play){
TFT.LoadGame();
}
if(event.getSource()==instruction){
TFT.LoadInstructions();
}
}
catch(FileNotFoundException e){
}
}
}