-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmainPanel.java
107 lines (92 loc) · 4.54 KB
/
mainPanel.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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package quizapp;
public class mainPanel extends javax.swing.JPanel {
/**
* Creates new form mainPanel
*/
public mainPanel() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
startButton = new javax.swing.JButton();
howToPlayButton = new javax.swing.JButton();
exitButton = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
jLayeredPane1 = new javax.swing.JLayeredPane();
setBackground(new java.awt.Color(255, 255, 204));
setOpaque(false);
setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
startButton.setBackground(new java.awt.Color(0, 153, 153));
startButton.setFont(new java.awt.Font("Avenir Next", 1, 24)); // NOI18N
startButton.setForeground(new java.awt.Color(102, 153, 255));
startButton.setText("Single Player");
startButton.setBorder(null);
startButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
startButtonActionPerformed(evt);
}
});
add(startButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(370, 280, 190, 30));
howToPlayButton.setFont(new java.awt.Font("Avenir Next", 1, 24)); // NOI18N
howToPlayButton.setForeground(new java.awt.Color(153, 0, 51));
howToPlayButton.setText("How To Play");
howToPlayButton.setBorder(null);
howToPlayButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
howToPlayButtonActionPerformed(evt);
}
});
add(howToPlayButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 330, -1, -1));
exitButton.setFont(new java.awt.Font("Optima", 1, 24)); // NOI18N
exitButton.setText("Exit");
exitButton.setBorder(null);
exitButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exitButtonActionPerformed(evt);
}
});
add(exitButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(820, 580, -1, -1));
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/quizapp/images/background.jpg"))); // NOI18N
add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 890, 630));
add(jLayeredPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 160, -1, 110));
}// </editor-fold>//GEN-END:initComponents
//SINGLE PLAYER INITIALIZING
private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed
QuizApp.frame.remove(this);
singleName sg = new singleName();
QuizApp.frame.add(sg);
QuizApp.frame.revalidate();
QuizApp.frame.repaint();
QuizApp.frame.setVisible(true);
}//GEN-LAST:event_startButtonActionPerformed
//EXITING THE GAME
private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitButtonActionPerformed
System.exit(0); // TODO add your handling code here:
}//GEN-LAST:event_exitButtonActionPerformed
//OPENING HOW TO PLAY
private void howToPlayButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_howToPlayButtonActionPerformed
QuizApp.frame.remove(this);
HowToPlay hp = new HowToPlay();
QuizApp.frame.add(hp);
QuizApp.frame.revalidate();
QuizApp.frame.repaint(); // TODO add your handling code here:
}//GEN-LAST:event_howToPlayButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton exitButton;
private javax.swing.JButton howToPlayButton;
private javax.swing.JLabel jLabel2;
private javax.swing.JLayeredPane jLayeredPane1;
private javax.swing.JButton startButton;
// End of variables declaration//GEN-END:variables
}