Add Action for ViewRoutes

This commit is contained in:
Asaad Dadoush 2020-12-09 01:26:32 +03:00
parent 4a5b9cf964
commit 6b7f7eee11
2 changed files with 53 additions and 2 deletions

47
src/EventControll.java Normal file
View File

@ -0,0 +1,47 @@
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import java.awt.Font;
public class EventControll {
private JFrame frame;
private JLabel lblNewLabel;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
EventControll window = new EventControll();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public EventControll() {
initialize();
}
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
frame.getContentPane().add(panel, BorderLayout.CENTER);
lblNewLabel = new JLabel();
lblNewLabel.setFont(new Font("Rockwell", Font.PLAIN, 16));
panel.add(lblNewLabel);
frame.setVisible(true);
}
public void setData(Object A) {
lblNewLabel.setText(A.toString());
}
}

View File

@ -147,6 +147,10 @@ public class MakkahCity {
btnViewRoutes.setFont(new Font("Rockwell", Font.PLAIN, 16));
btnViewRoutes.setBackground(new Color(9,9,9));
btnViewRoutes.setForeground(Color.white);
btnViewRoutes.addActionListener(e -> {
EventControll t = new EventControll();
t.setData(stdRoutes[0]);
});
JButton btnViewBuses = new JButton("View Buses");
btnViewBuses.setBounds(1384, 75, 184, 29);
@ -1046,5 +1050,5 @@ public class MakkahCity {
}
}
lblDate.setText(currenttimeManager.getCurrentTime().toString());
}
}
}
}