-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPanelGrid.java
More file actions
67 lines (51 loc) · 1.65 KB
/
Copy pathPanelGrid.java
File metadata and controls
67 lines (51 loc) · 1.65 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
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class PanelGrid implements ActionListener{
public static void mainGame(){
//creates TextFields
TextField TryOne = new TextField(24);
TextField TryTwo = new TextField(24);
TextField TryThree = new TextField(24);
TextField TryFour = new TextField(24);
TextField TryFive = new TextField(24);
TextField TrySix = new TextField(24);
//
Label basicl = new Label("SCREECH");
HomeFrame().home.add(basicl);
basicl.setAlignment(Label.LEFT);
basicl.setSize(350,100);
//adds action listener to textFields
//-- can do this to all the Try's with a loop to make code cleaner
PanelGrid p = new PanelGrid();
TryOne.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
String z = "z";
basicl.setText(z);
}
});
TryTwo.addActionListener(p);
TryThree.addActionListener(p);
TryFour.addActionListener(p);
TryFive.addActionListener(p);
TrySix.addActionListener(p);
//creates a grid
Panel grid = new Panel(new GridLayout(6,1));
grid.add(TryOne);
grid.add(TryTwo);
grid.add(TryThree);
grid.add(TryFour);
grid.add(TryFive);
grid.add(TrySix);
home.add(grid);
}
public static void main(String[]args){
mainGame();
}
/*
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}
*/
}