Add Action for ViewRoutes
This commit is contained in:
parent
4a5b9cf964
commit
6b7f7eee11
47
src/EventControll.java
Normal file
47
src/EventControll.java
Normal 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());
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user