I want to have a thread and in this thread i want to make a JFrame window
i try this but i think it doesn't work correct:
It only opens a JFrame without the label tha i add on lines:29-30 and also i can't close it from x in the window.( it only dissapear the window, but back it still running).Where is the problem?
i try this but i think it doesn't work correct:
Code:
public class AboutWindow implements Runnable
{
Thread hello ;
public AboutWindow()
{
hello = new Thread();
hello.start();
}
public static void main(String[] args)
{
AboutWindow hd = new AboutWindow();
}
public void run( )
{
JFrame tes = new JFrame();
tes.setVisible(true);
tes.setSize(400,330); //300,200
tes.setLocation(450,200);
Container contentPane = tes.getContentPane();
tes.setLayout(new BorderLayout());
tes.setResizable(false);
tes.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
contentPane.setBackground(Color.CYAN);
JLabel th = new JLabel("heloo");
contentPane.add(th,BorderLayout.CENTER);
}
}
Comment