This repository has been archived by the owner on Jan 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainFrame.java
145 lines (113 loc) · 3.97 KB
/
MainFrame.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import javax.swing.JFrame;
import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
public class MainFrame extends JFrame implements ActionListener{
/**
*
*/
private static final long serialVersionUID = 1L;
public static JButton button2020;
public static JButton button2019;
public static JButton button2018;
public static JLabel WVRlabel;
public static JLabel WVRScouting;
//private static JLabel appName;
private JFrame frame;
private int teamnum;
public ImageIcon backpic;
public MainFrame(JFrame indexFrames, int teamnumIndex) {
if (indexFrames == null) {
frame = new JFrame();
teamnum = 33;
} else {
frame = indexFrames;
teamnum = teamnumIndex;
}
backpic = new ImageIcon("fieldimg.png");
button2020 = new JButton();
button2020.setBounds(700, 400, 200, 100);
button2020.setText("2020");
button2020.addActionListener(this);
button2020.setFocusable(false);
button2019 = new JButton();
button2019.setBounds(500, 400, 200, 100);
button2019.setText("2019");
button2019.addActionListener(this);
button2019.setFocusable(false);
button2018 = new JButton();
button2018.setBounds(300, 400, 200, 100);
button2018.setText("2018");
button2018.addActionListener(this);
button2018.setFocusable(false);
ImageIcon WVRicon = new ImageIcon(new ImageIcon("WVRshrinked.png").getImage().getScaledInstance(292, 150, Image.SCALE_DEFAULT));
WVRlabel = new JLabel();
WVRlabel.setIcon(WVRicon);
WVRlabel.setBounds(454, 50, 292, 150);
WVRlabel.setFocusable(false);
WVRlabel.setHorizontalAlignment(JLabel.CENTER);
WVRlabel.setForeground(new Color(0xFFFFFF));
WVRlabel.setVerticalAlignment(JLabel.CENTER);
WVRScouting = new JLabel();
WVRScouting.setBounds(400, 200, 400, 150);
WVRScouting.setText("FRC Scouting App");
WVRScouting.setFocusable(false);
WVRScouting.setHorizontalAlignment(JLabel.CENTER);
WVRScouting.setFont(new Font("MV Boli", Font.PLAIN,40));
WVRScouting.setForeground(new Color(0xFFFFFF));
WVRScouting.setVerticalAlignment(JLabel.CENTER);
frame.add(WVRlabel);
frame.add(button2018);
frame.add(button2019);
frame.add(button2020);
frame.add(WVRScouting);
if (indexFrames == null) {
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // When the X is clicked, the window closes
frame.setResizable(false); // Keeps a consistent window size.
frame.setSize(1200,600); // In pixels, the size of the widow. (width x height)
Color customColor = new Color(108, 211, 235); //Creates a background color
frame.getContentPane().setBackground(customColor);
frame.setLayout(null);
}
frame.setTitle("WVR Scouting App: Main Frame"); // Titles the Window
frame.setVisible(false);
frame.setVisible(true); // Makes the frame visible
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if (e.getSource()==button2020) {
//frame.remove(WVRlabel);
//frame.remove(button2018);
//frame.remove(button2019);
//frame.remove(button2020);
//frame.removeAll();
//frame.setVisible(true);
WVRScouting.setVisible(false);
button2018.setVisible(false);
button2019.setVisible(false);
button2020.setVisible(false);
WVRlabel.setVisible(false);
new IndexFrame(frame, teamnum, 2020);
} else if (e.getSource()==button2019) {
WVRScouting.setVisible(false);
button2018.setVisible(false);
button2019.setVisible(false);
button2020.setVisible(false);
WVRlabel.setVisible(false);
new IndexFrame(frame, teamnum, 2019);
} else if (e.getSource()==button2018) {
WVRScouting.setVisible(false);
button2018.setVisible(false);
button2019.setVisible(false);
button2020.setVisible(false);
WVRlabel.setVisible(false);
new IndexFrame(frame, teamnum, 2018);
}
}
}