MCPcopy Create free account
hub / github.com/SuwaidAslam/E-Learning-System-Java-GUI-Application / Main

Class Main

src/javasemesterproject/Main.java:25–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23import javax.swing.Timer;
24
25public class Main extends JFrame implements ActionListener{
26 JPanel headerPanel, mainPanel, footerPanel;
27 JButton LoginButton, SignupButton;
28 JLabel title, footerLbl, mainScreenLbl;
29 JMenuBar menuBar;
30 JMenu file, about;
31 JMenuItem aboutProject,aboutDevelopers, exit;
32 public static Main main;
33 public Main(){
34 super("E-Learning System");
35 setSize(1280,720);
36 setLocation(35,30);
37 setLayout(new BorderLayout());
38 this.main = this;
39
40 ImageIcon icon = new ImageIcon(ClassLoader.getSystemResource("javasemesterproject/icons/systemIcon.png"));
41 setIconImage(icon.getImage());
42
43 headerPanel = new JPanel(new BorderLayout());
44 add(headerPanel, BorderLayout.NORTH);
45
46 mainPanel = new JPanel();
47 mainPanel.setLayout(null);
48 add(mainPanel, BorderLayout.CENTER);
49
50 footerPanel = new JPanel(new BorderLayout());
51 add(footerPanel, BorderLayout.SOUTH);
52
53
54 //Header Code
55 aboutProject = new JMenuItem("About Project");
56 aboutDevelopers = new JMenuItem("About Developers");
57 menuBar = new JMenuBar();
58 about = new JMenu("About");
59 exit = new JMenuItem("Exit");
60 // Adding Shortcut key to close the window
61 KeyStroke ctrlE = KeyStroke.getKeyStroke(KeyEvent.VK_E, Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask());
62 exit.setAccelerator(ctrlE);
63 file = new JMenu("File");
64 file.add(exit);
65 about.add(aboutProject); about.add(aboutDevelopers);
66 exit.addActionListener(this);
67 aboutDevelopers.addActionListener(this);
68 aboutProject.addActionListener(this);
69 menuBar.add(file);
70 menuBar.add(about);
71
72
73 headerPanel.add(menuBar,BorderLayout.NORTH);
74 ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("javasemesterproject/icons/MainTitle.png"));
75 Image i2 = i1.getImage().getScaledInstance(1280 ,96 ,Image.SCALE_DEFAULT);
76 ImageIcon i3 = new ImageIcon(i2);
77 title = new JLabel(i3);
78 headerPanel.add(title, BorderLayout.CENTER);
79
80
81 JLabel clock = new JLabel();
82 clock.setHorizontalAlignment(JLabel.RIGHT);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected