请运行帮我把字母运行调试出来!
package yan1;
import javax.swing.*;
import java.awt.*;
public class Yan2 extends JApplet
{
class yan3 extends Thread
{
public void run()
{
Font ft=new Font( "宋体 ",Font.BOLD,35);
Graphics g= getGraphics();
g.setFont(ft);
for(int i=0;i <=26;i++)
{g.setColor(Color.BLACK);
g.drawString(String.valueOf(i),195,70);
try{
sleep(100);
}
catch(InterruptedException e)
{getAppletContext().showStatus( "xian cheng 1 is error ");
}
g.setColor(getBackground());
g.drawString(String.valueOf(i),195,70);
}
}
}
class yan4 extends Thread{
public void run(){
Font ft=new Font( "宋体 ",Font.BOLD,35);
Graphics g=getGraphics();
g.setFont(ft);
char ch;
for( ch= 'A ';ch <= 'Z ';ch++);
{g.setColor(Color.BLACK);
g.drawString(String.valueOf(ch),205,120);
try{
sleep(10);
}
catch(InterruptedException e)
{
getAppletContext().showStatus( "xian cheng 2 is error ");
}
g.setColor(getBackground());
g.drawString(String.valueOf(ch),205,120);
}
}
}
public void paint(Graphics g)
{Font ft=new Font( "宋体 ",Font.BOLD,16);
g.setFont(ft);
g.drawRect(190,30,50,50);
g.drawRect(190,80,50,50);
g.drawString( "input shu zi: ",50,60);
g.drawString( "in put zi mu: ",50,110);
new yan3().start();
new yan4().start();
}
}
请运行帮我把字母运行调试出来既第二个框里的!
[解决办法]
改成现在这样就好了,改完后代码是这样的:
//package yan1;
import javax.swing.*;
import java.awt.*;
public class Yan2 extends JApplet
{
class yan3 extends Thread
{
public void run()
{
Font ft=new Font( "宋体 ",Font.BOLD,35);
Graphics g= getGraphics();
g.setFont(ft);
for(int i=0;i <=26;i++)
{g.setColor(Color.BLACK);
g.drawString(String.valueOf(i),195,70);
try{
sleep(100);
}
catch(InterruptedException e)
{getAppletContext().showStatus( "xian cheng 1 is error ");
}
g.setColor(getBackground());
g.drawString(String.valueOf(i),195,70);
}
}
}
class yan4 extends Thread
{
public void run()
{
Font ft=new Font( "宋体 ",Font.BOLD,35);
Graphics g= getGraphics();
g.setFont(ft);
char i;
for( i= 'a ';i <= 'z ';i++)
{g.setColor(Color.BLACK);
g.drawString(String.valueOf(i),205,120);
try{
sleep(100);
}
catch(InterruptedException e)
{getAppletContext().showStatus( "xian cheng 1 is error ");
}
g.setColor(getBackground());
g.drawString(String.valueOf(i),205,120);
}
}
}
public void paint(Graphics g)
{Font ft=new Font( "宋体 ",Font.BOLD,16);
g.setFont(ft);
g.drawRect(190,30,50,50);
g.drawRect(190,80,50,50);
g.drawString( "input shu zi: ",50,60);
g.drawString( "in put zi mu: ",50,110);
new yan3().start();
new yan4().start();
}
}