Hello i wanted to ask for help .
here is my program :-
i wanted to display the new blah() if we click on button2 but it is not happeningimport java.awt.Graphics; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.Scanner; public class AGod { public JFrame window = new JFrame("A. God"); public JFrame window1 = new JFrame("A. God"); public JLabel Text1 = new JLabel("Choose your Colour :-",JLabel.CENTER); public JButton button2 = new JButton("Heavenly Blue"); public JButton button3 = new JButton("Deadly Red"); public JButton button4 = new JButton("Cutey Pink"); public JButton button5 = new JButton("Simple Black"); public Scanner scan = new Scanner(System.in); public AGod() { window.setSize(700,400); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setLayout(new GridLayout(1,4)); window.setBackground(Color.gray); Text1.setToolTipText("Doesn\'t matter much ..."); window.add(Text1); window.add(button2); window.add(button3); window.add(button4); window.add(button5); //button2.addActionLisetener(this); //button3.addActionLisetener(this); //button4.addActionLisetener(this); //button5.addActionLisetener(this); window.setVisible(true); } public class blah { Graphics g; public blah() { window1.setSize(700,400); window1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); g.drawRect (20, 30, 300, 100); g.drawRect (20, 60, 300, 20); window1.setVisible(true); } public void actionPerformed(ActionEvent a) { if (a.getSource() == button2) { new blah(); } } } public static void main(String[] args) { new AGod(); } }