public class Window extends JFrame implements ActionListener{
public static void main(String[] args) {
new Window();
}
public Window() {
ImageIcon fileIcon = new ImageIcon ("assets/icon.png");
ImageIcon exitIcon = new ImageIcon ("assets/exit.png");
JButton exitButton = new JButton("Label");
JLabel text = new JLabel("Luminate Media");
JPanel panel = new JPanel();
setTitle("Luminate");
setIconImage(fileIcon.getImage());
setBounds(0, 688, 1366, 40);
setLayout(null);
setUndecorated(true);
setResizable(false);
setVisible(true);
setAlwaysOnTop(true);
getContentPane().setBackground(Color.DARK_GRAY);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
text.setFont(new Font("dandelion in the spring", Font.PLAIN, 32));
text.setBounds(0, 0, 0, 0);
text.setHorizontalAlignment(SwingConstants.CENTER);
text.setSize(0, 0);
text.setForeground(Color.black);
text.setHorizontalAlignment(0);
exitButton.setBorder(null);
exitButton.setBounds(1326, 0, 40, 40);
exitButton.setIcon(exitIcon);
exitButton.addActionListener(this);
panel.setLayout(null);
panel.setBackground(Color.DARK_GRAY);
panel.add(exitButton);
panel.add(text);
add(panel);
}
public static void load() {
//MY PROBLEM IS HERE
//HOW DO I CALL THE public Window(){
//AS THIS IS NOT THE MAIN CLASS
}
@Override
public void actionPerformed(ActionEvent e) {
// ALSO I NEED THE CODE THE END THE ENTIRE APPLICATION HERE
}
}
you can probably see the error and I am unsure of why it is happening. So I am just extremely curious of how to call the window into the load method and if possible could someone tell me the code to end the entire application ?