Exit Button
This commit is contained in:
parent
54421ee9e6
commit
e14ed99d42
@ -1,6 +1,8 @@
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.table.DefaultTableModel;
|
import javax.swing.table.DefaultTableModel;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
@ -30,6 +32,8 @@ public class MakkahCity {
|
|||||||
private static final Thread t = new Thread(inputListener,"InputThread-Makkah");
|
private static final Thread t = new Thread(inputListener,"InputThread-Makkah");
|
||||||
private static boolean isAllRoutSet;
|
private static boolean isAllRoutSet;
|
||||||
|
|
||||||
|
private static boolean exit_flag;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
t.start();
|
t.start();
|
||||||
@ -160,8 +164,8 @@ public class MakkahCity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void checkInput() {
|
private static void checkInput() {
|
||||||
//TODO: check GUI static variables and pause accordingly.
|
|
||||||
String input = "";
|
String input = "";
|
||||||
|
if (exit_flag) System.exit(0);
|
||||||
if (inputListener.hasNew()){
|
if (inputListener.hasNew()){
|
||||||
input = inputListener.getInput();
|
input = inputListener.getInput();
|
||||||
if (input.equals("m")){
|
if (input.equals("m")){
|
||||||
@ -858,7 +862,7 @@ public class MakkahCity {
|
|||||||
btnExit.setBackground(new Color(211, 211, 211));
|
btnExit.setBackground(new Color(211, 211, 211));
|
||||||
btnExit.setBounds(766, 428, 72, 23);
|
btnExit.setBounds(766, 428, 72, 23);
|
||||||
streetsFrame.getContentPane().add(btnExit);
|
streetsFrame.getContentPane().add(btnExit);
|
||||||
|
btnExit.addActionListener(actionEvent -> exit_flag = true);
|
||||||
//window
|
//window
|
||||||
streetsFrame.getContentPane().setBackground(new Color(0, 0, 0));
|
streetsFrame.getContentPane().setBackground(new Color(0, 0, 0));
|
||||||
streetsFrame.getContentPane().setForeground(SystemColor.inactiveCaptionBorder);
|
streetsFrame.getContentPane().setForeground(SystemColor.inactiveCaptionBorder);
|
||||||
|
Loading…
Reference in New Issue
Block a user