-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectMain.java
More file actions
97 lines (79 loc) · 2.34 KB
/
ProjectMain.java
File metadata and controls
97 lines (79 loc) · 2.34 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
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
import java.awt.Color;
import java.awt.Panel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
* FinalProject
*
* @author Alec Posthauer - 630000913
* @author John Villanueva - 732001682
* @author Alec Flores - 731000753
*
* Section: CSCE 111-504
* Date: 4/6/2024
*/
public class ProjectMain {
public static void main(String[] args) {
// New Frame called appFrame
JFrame appFrame = new JFrame();
// set title
appFrame.setTitle("CSCE 111 Final Project - Food ");
// set default size
appFrame.setSize(1000, 700);
// set default location of frame on screen to center
appFrame.setLocationRelativeTo(null);
// Set color background
appFrame.getContentPane().setBackground(Color.gray);
// Panel to hold all buttons
JPanel panel1 = new JPanel();
appFrame.add(panel1);
panel1.setSize(50, 50);
panel1.setBackground(Color.gray);
// Button 1
JButton b1 = new JButton();
b1.setSize(50, 50);
b1.setVisible(true);
b1.setText("Recipe Generator");
panel1.add(b1);
// Button 2
JButton b2 = new JButton();
b2.setSize(50, 50);
b2.setVisible(true);
b2.setText("Food Trivia Quiz");
panel1.add(b2);
// Button 3
JButton b3 = new JButton();
b3.setSize(50, 50);
b3.setVisible(true);
b3.setText("March Madness Bracket");
panel1.add(b3);
// button 4
// button 4
JButton b4 = new JButton();
b4.setSize(50, 50);
b4.setVisible(true);
b4.setText("Video");
panel1.add(b4);
// Add ActionListener to button "RecipeGenerator"
b1.addActionListener(new RecipeGenerator());
// Add ActionListener to button "John V"
b2.addActionListener(new FoodTriviaQuiz());
// Add ActionListener to button "John V"
b3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new MarchMadnessBracket();
}
});
// action listener for the video
b4.addActionListener(new Video());
// set operation on exit
appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// close one specific frame instead of whole program
// appFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
// make Frame visible
appFrame.setVisible(true);
}
}