-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathListMenu.java
More file actions
27 lines (22 loc) · 815 Bytes
/
Copy pathListMenu.java
File metadata and controls
27 lines (22 loc) · 815 Bytes
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
import GLOOP.GLObjekt;
import javax.swing.*;
import java.awt.*;
public class ListMenu {
public ListMenu() {
JFrame frame = new JFrame();
frame.setTitle("Objects");
frame.setLocationRelativeTo(null);
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0, 1));
JLabel title = new JLabel("All Objects:");
panel.add(title);
for (GLObjekt obj : Main.objectList) {
JButton button = new JButton(Main.objectName.get(Main.objectList.indexOf(obj))); // Button with name of the object
button.addActionListener(e -> Util.attributesChanger(obj)); // Open the attributes changer on button press
panel.add(button);
}
frame.add(panel);
frame.pack();
frame.setVisible(true);
}
}