Hist view with states

This commit is contained in:
HeshamTB 2020-12-16 17:42:26 +03:00
parent 9cf847ad46
commit a795117895
3 changed files with 29 additions and 29 deletions

View File

@ -150,4 +150,9 @@ class State implements Serializable {
public Date getAllArrivedToHotelsTime() {
return allArrivedToHotelsTime;
}
public Date getStateTime() {
return stateTime;
}
}

View File

@ -1,50 +1,42 @@
import java.awt.Color;
import java.awt.EventQueue;
import java.util.Date;
import java.util.List;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JPanel;
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() {
private List<State> states;
public GUI_History(List<State> states) {
this.states = states;
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);
JPanel panel = new JPanel();
panel.setBounds(10, 11, 1228, 727);
frame.getContentPane().add(panel);
panel.setLayout(null);
JComboBox<Date> comboBox = new JComboBox<Date>();
comboBox.setBounds(453, 46, 302, 42);
for (State state : states) {
comboBox.addItem(state.getStateTime());
}
panel.add(comboBox);
frame.setLocationRelativeTo(null);
frame.revalidate();
frame.setLocation(200,150);
frame.setAutoRequestFocus(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}

View File

@ -208,6 +208,9 @@ public class MakkahCity {
btnBrowseHistory.setBackground(new Color(9,9,9));
btnBrowseHistory.setFont(new Font("Rockwell", Font.PLAIN, 16));
btnBrowseHistory.setForeground(Color.white);
btnBrowseHistory.addActionListener(e -> {
GUI_History hist = new GUI_History(dataManeger.getStates());
});
//Label
JLabel lblStreets = new JLabel("Streets");