import java.awt.*;
import java.awt.event.*;
public class threadtest3 extends Frame//implements
{
public static void main(String[] args)
{
Frame f=new Frame();
f.addWindowListener(new QuitWindow());
f.resize(300,300);
f.setBackground(Color.cyan);
f.show();
threadt t=new threadt();
t.start();
while(true)
{
System.out.println("test33333333333");
}
}
public boolean handleEvent(Event evt)
{
if(evt.id==Event.WINDOW_DESTROY)
{
System.exit(0);
}
return super.handleEvent(evt);
} }
class threadt extends Thread
{
public void run()
{
while(true)
{
System.out.println("this is in thread run");
}
}
}
class QuitWindow extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
import java.awt.event.*;
public class threadtest3 extends Frame//implements
{
public static void main(String[] args)
{
Frame f=new Frame();
f.addWindowListener(new QuitWindow());
f.resize(300,300);
f.setBackground(Color.cyan);
f.show();
threadt t=new threadt();
t.start();
while(true)
{
System.out.println("test33333333333");
}
}
public boolean handleEvent(Event evt)
{
if(evt.id==Event.WINDOW_DESTROY)
{
System.exit(0);
}
return super.handleEvent(evt);
} }
class threadt extends Thread
{
public void run()
{
while(true)
{
System.out.println("this is in thread run");
}
}
}
class QuitWindow extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货