-
Notifications
You must be signed in to change notification settings - Fork 1
/
Util.java
68 lines (53 loc) · 2.33 KB
/
Util.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
import GLOOP.GLObjekt;
import javax.swing.*;
import java.awt.*;
public interface Util {
// A methode to set defaults for all objects that are created
static void createObject(GLObjekt object) {
object.setzeSelbstleuchten(255, 255, 255); // Make object shine
Main.objectList.add(object); // Adds tho object to the list
}
static void attributesChanger(GLObjekt object) {
JFrame frame = new JFrame();
frame.setTitle("Change Obj");
frame.setLocationRelativeTo(null);
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0, 3));
panel.add(new JLabel()); // Spacer
JButton up = new JButton("up");
up.addActionListener(e -> object.setzePosition(object.gibX(), object.gibY() + 1, object.gibZ())); //Moves up
panel.add(up);
panel.add(new JLabel());
JButton left = new JButton("left");
left.addActionListener(e -> object.setzePosition(object.gibX() - 1, object.gibY(), object.gibZ())); //Moves down
panel.add(left);
JButton back = new JButton("back");
back.addActionListener(e -> object.setzePosition(object.gibX(), object.gibY(), object.gibZ() - 1)); //Moved back
panel.add(back);
JButton right = new JButton("right");
right.addActionListener(e -> object.setzePosition(object.gibX() + 1, object.gibY(), object.gibZ())); //Moves right
panel.add(right);
panel.add(new JLabel()); //Spacer
/*
JSlider XRot = new JSlider(SwingConstants.VERTICAL, -360, 360, 0);
XRot.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
object.setzeDrehung(XRot.getValue(), 0, 0);
}
});
panel.add(XRot);
*/
JButton front = new JButton("front");
front.addActionListener(e -> object.setzePosition(object.gibX(), object.gibY(), object.gibZ() + 1)); //Moves front
panel.add(front);
panel.add(new JLabel()); //Spacer
panel.add(new JLabel()); //Spacer
JButton down = new JButton("down");
down.addActionListener(e -> object.setzePosition(object.gibX(), object.gibY() - 1, object.gibZ())); //Moves down
panel.add(down);
frame.add(panel);
frame.pack();
frame.setVisible(true);
}
}