-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGFX_Start.java
More file actions
30 lines (25 loc) · 879 Bytes
/
Copy pathGFX_Start.java
File metadata and controls
30 lines (25 loc) · 879 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
28
29
30
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class GFX_Start extends JFrame {
private boolean simulationRunning = false;
private JButton startStopButton;
public GFX_Start() {
setTitle("Simulation Control");
setSize(200, 100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
startStopButton = new JButton("Start");
startStopButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
simulationRunning = !simulationRunning;
startStopButton.setText(simulationRunning ? "Stop" : "Start");
}
});
add(startStopButton);
}
public boolean isSimulationRunning() {
return simulationRunning;
}
}