-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.java
131 lines (93 loc) · 2.75 KB
/
example.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
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class example implements ActionListener {
JButton button4 = new JButton("Lesson 1.4");
JButton button3 = new JButton("Lesson 1.3");
JButton button2 = new JButton("Lesson 1.2");
JButton button = new JButton("Lesson 1.1");
public static void main (String[] args)
{
example l = new example();
l.window();
}
public void window()
{
//LABEL
JPanel panel = new JPanel();
panel.setLayout(null);
JLabel label = new JLabel();
panel.setSize(500,200);
label.setText("Algebra 1");
label.setLocation(0, 0);
JLabel label2 = new JLabel();
label2.setText("Chapter 1 - Lines");
label2.setForeground(Color.black);
label.setBounds(258, -30, 300, 140);
label2.setBounds(35,100,200,50);
JLabel into = new JLabel();
into.setText("An lesson-based education game");
into.setForeground(Color.black);
into.setBounds(240,-20,500,200);
panel.add(into);
JLabel chapter2 = new JLabel();
JLabel blah = new JLabel();
panel.add(blah);
panel.add(chapter2);
chapter2.setText("Chapter 2 - Graphs");
chapter2.setForeground(Color.black);
chapter2.setBounds(280,100,200,50);
//SET FONT FOR LABEL
Font fun = new Font("Tahoma", Font.BOLD,16);
Font font = new Font("Tahoma", Font.BOLD,50);
Font font2 = new Font("Tahoma", Font.BOLD,20);
chapter2.setFont(font2);
into.setFont(fun);
//FRAME
JFrame frame = new JFrame("Test");
frame.setVisible(true);
frame.setSize(800,600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel.setBackground(Color.white);
panel.add(label);
panel.add(label2);
label.setFont(font);
label2.setFont(font2);
label.setForeground(Color.PINK);
frame.add(panel);
ImageIcon i = new ImageIcon("Images/allilogo.gif", "BPawn");
button.setIcon(i);
panel.add(button);
button.setBounds(20, 140, 100, 25);
button.addActionListener (this);
panel.add(button2);
button2.setToolTipText("Click for Lesson 1.2");
JButton button3 = new JButton("Lesson 1.3");
panel.add(button3);
panel.add(button4);
button3.setBounds(20, 168, 100, 25);
button4.setBounds(125,168, 100, 25);
button2.setBounds(125,140,100,25);
button2.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
if(arg0.getSource()==button){
P j = new P();
j.setVisible(true);
j.pop();
}
if(arg0.getSource()==button2){
P2 j = new P2();
j.setVisible(true);
j.pop();
}
if(arg0.getSource()==button3){
}
if(arg0.getSource()==button4){
}
}
}