Event for btnHistory(undone)!

This commit is contained in:
Asaad Dadoush 2020-12-09 23:29:06 +03:00
parent 938ffa9b69
commit f397003d32
2 changed files with 67 additions and 10 deletions

50
src/GUI_History.java Normal file
View File

@ -0,0 +1,50 @@
import java.awt.Color;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class GUI_History {
private static JFrame frame;
private static JLabel Time;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
GUI_History window = new GUI_History();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public GUI_History() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame("History");
frame.getContentPane().setBackground(new Color(70, 70, 70));
frame.getContentPane().setForeground(new Color(0, 0, 0));
frame.getContentPane().setLayout(null);
frame.setLocationRelativeTo(null);
frame.revalidate();
frame.setLocation(200,150);
frame.setAutoRequestFocus(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

View File

@ -31,7 +31,7 @@ public class MakkahCity {
private static final InputListener inputListener = new InputListener(); private static final InputListener inputListener = new InputListener();
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;
//GUI
private static boolean exit_flag; private static boolean exit_flag;
private static Checkbox autoModeCheckBox; private static Checkbox autoModeCheckBox;
private static JFrame makkahFrame; private static JFrame makkahFrame;
@ -126,7 +126,7 @@ public class MakkahCity {
streetTable.setRowHeight(25); streetTable.setRowHeight(25);
streetTable.setAutoCreateRowSorter(true); streetTable.setAutoCreateRowSorter(true);
JScrollPane streetScroll = new JScrollPane(streetTable); JScrollPane streetScroll = new JScrollPane(streetTable);
streetScroll.setBounds(50,100,1046,329); streetScroll.setBounds(50,100,1216,329);
//District table //District table
districtTable = new JTable(districtData,districtColNames); districtTable = new JTable(districtData,districtColNames);
@ -144,11 +144,11 @@ public class MakkahCity {
districtTable.setAutoCreateRowSorter(true); districtTable.setAutoCreateRowSorter(true);
districtTable.setRowHeight(25); districtTable.setRowHeight(25);
districtTable.revalidate(); districtTable.revalidate();
districtScroll.setBounds(50,478,1046,105); districtScroll.setBounds(50,478,1216,105);
//Buttons //Buttons
JButton btnViewRoutes = new JButton("View Routes"); JButton btnViewRoutes = new JButton("View Routes");
btnViewRoutes.setBounds(1149, 33, 157, 29); btnViewRoutes.setBounds(1307, 33, 166, 29);
btnViewRoutes.setFont(new Font("Rockwell", Font.PLAIN, 16)); btnViewRoutes.setFont(new Font("Rockwell", Font.PLAIN, 16));
btnViewRoutes.setBackground(new Color(9,9,9)); btnViewRoutes.setBackground(new Color(9,9,9));
btnViewRoutes.setForeground(Color.white); btnViewRoutes.setForeground(Color.white);
@ -158,7 +158,7 @@ public class MakkahCity {
}); });
JButton btnViewBuses = new JButton("View Buses"); JButton btnViewBuses = new JButton("View Buses");
btnViewBuses.setBounds(1149, 82, 157, 29); btnViewBuses.setBounds(1307, 76, 166, 29);
btnViewBuses.setFont(new Font("Rockwell", Font.PLAIN, 16)); btnViewBuses.setFont(new Font("Rockwell", Font.PLAIN, 16));
btnViewBuses.setBackground(new Color(9,9,9)); btnViewBuses.setBackground(new Color(9,9,9));
btnViewBuses.setForeground(Color.white); btnViewBuses.setForeground(Color.white);
@ -168,13 +168,13 @@ public class MakkahCity {
}); });
JButton btnViewCampaigns = new JButton("View Campaigns"); JButton btnViewCampaigns = new JButton("View Campaigns");
btnViewCampaigns.setBounds(1149, 130, 157, 29); btnViewCampaigns.setBounds(1307, 119, 166, 29);
btnViewCampaigns.setFont(new Font("Rockwell", Font.PLAIN, 16)); btnViewCampaigns.setFont(new Font("Rockwell", Font.PLAIN, 16));
btnViewCampaigns.setBackground(new Color(9,9,9)); btnViewCampaigns.setBackground(new Color(9,9,9));
btnViewCampaigns.setForeground(Color.white); btnViewCampaigns.setForeground(Color.white);
JButton btnViewStreet = new JButton("View Street"); JButton btnViewStreet = new JButton("View Street");
btnViewStreet.setBounds(1149, 182, 157, 29); btnViewStreet.setBounds(1307, 159, 166, 29);
btnViewStreet.setFont(new Font("Rockwell", Font.PLAIN, 16)); btnViewStreet.setFont(new Font("Rockwell", Font.PLAIN, 16));
btnViewStreet.setBackground(new Color(9,9,9)); btnViewStreet.setBackground(new Color(9,9,9));
btnViewStreet.setForeground(Color.white); btnViewStreet.setForeground(Color.white);
@ -183,9 +183,15 @@ public class MakkahCity {
btnExit.setBackground(new Color(9,9,9)); btnExit.setBackground(new Color(9,9,9));
btnExit.setFont(new Font("Rockwell", Font.PLAIN, 16)); btnExit.setFont(new Font("Rockwell", Font.PLAIN, 16));
btnExit.setForeground(Color.white); btnExit.setForeground(Color.white);
btnExit.setBounds(1149, 622, 157, 29); btnExit.setBounds(1307, 623, 166, 29);
btnExit.addActionListener(actionEvent -> exit_flag = true); btnExit.addActionListener(actionEvent -> exit_flag = true);
JButton btnBrowseHistory = new JButton("Browse History");
btnBrowseHistory.setBounds(1307, 199, 166, 29);
btnBrowseHistory.setBackground(new Color(9,9,9));
btnBrowseHistory.setFont(new Font("Rockwell", Font.PLAIN, 16));
btnBrowseHistory.setForeground(Color.white);
//Label //Label
JLabel lblStreets = new JLabel("Streets History"); JLabel lblStreets = new JLabel("Streets History");
lblStreets.setFont(new Font("Rockwell", Font.PLAIN, 24)); lblStreets.setFont(new Font("Rockwell", Font.PLAIN, 24));
@ -322,16 +328,17 @@ public class MakkahCity {
makkahFrame.getContentPane().add(lblMinimumTripValue); makkahFrame.getContentPane().add(lblMinimumTripValue);
makkahFrame.getContentPane().add(lblMaximumTrip); makkahFrame.getContentPane().add(lblMaximumTrip);
makkahFrame.getContentPane().add(lblMinimumTrip); makkahFrame.getContentPane().add(lblMinimumTrip);
makkahFrame.getContentPane().add(btnBrowseHistory);
//Frame Settings //Frame Settings
makkahFrame.getContentPane().setBackground(new Color(70, 70, 70)); makkahFrame.getContentPane().setBackground(new Color(70, 70, 70));
makkahFrame.getContentPane().setForeground(new Color(0, 0, 0)); makkahFrame.getContentPane().setForeground(new Color(0, 0, 0));
makkahFrame.setBounds(100,100,1404,777); makkahFrame.setBounds(100,100,1519,777);
makkahFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); makkahFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
makkahFrame.getContentPane().setLayout(null); makkahFrame.getContentPane().setLayout(null);
makkahFrame.setLocationRelativeTo(null); makkahFrame.setLocationRelativeTo(null);
makkahFrame.revalidate(); makkahFrame.revalidate();
makkahFrame.setLocation(700, 200); makkahFrame.setLocation(200,150);
makkahFrame.setAutoRequestFocus(false); makkahFrame.setAutoRequestFocus(false);
makkahFrame.setVisible(true); makkahFrame.setVisible(true);