I just watched buckey instance messaging. It has a method called startrunning. When I call this method under Main, it works perfectly, but as soon as I used action listener to call it, the program kind of crashes and its GUI becomes  black. Please check my code. Thanks

 public static void main(String[] args) {
         client myclient= new client();
           myclient.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           myclient.startrunning();
           myclient.setVisible(true);
        }  


loginBttn.addActionListener(new ActionListener()   {

                @Override
                public void actionPerformed(ActionEvent event)
                   {
            client myclient= new client();
           myclient.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           myclient.startrunning();
           myclient.setVisible(true);
                   }
                
            } );