Topic: applet小程序未初始化问题?

  Print this page

1.applet小程序未初始化问题? Copy to clipboard
Posted by: xh20021411
Posted on: 2005-05-16 18:45

Where and how do you 运行?
IE, AppletViewer?

The code looks fine to me.


程序如下:

import java.awt.*;
import java.applet.*;

public class First extends Applet {
  
  public void init() {
  }

  public void paint(Graphics g) {
    g.drawString("Welcome to Java!!", 50, 60 );
  }
}

运行后在状态栏上显示“启动:未初始化小程序”
请问各位大虾这是怎么回事????
谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢谢!CryWilted RoseStupidQuestion

2.Re:applet小程序未初始化问题? [Re: xh20021411] Copy to clipboard
Posted by: wind520sand
Posted on: 2005-05-17 00:23

没有问题啊,我调试过了,一些ok,没有你说的啊

3.Re:applet小程序未初始化问题? [Re: xh20021411] Copy to clipboard
Posted by: xh20021411
Posted on: 2005-05-17 08:11

我有啊!!!

4.Re:applet小程序未初始化问题? [Re: xh20021411] Copy to clipboard
Posted by: why
Posted on: 2005-05-17 09:14

xh20021411 wrote:
我有啊!!!

It's totally useless only say so.
At least you have to describe your configuration.

Did you see my comment in red at the top?

Furthermore, please read 置顶索引...

5.Re:applet小程序未初始化问题? [Re: xh20021411] Copy to clipboard
Posted by: xh20021411
Posted on: 2005-05-17 17:31

还有一个和上面的运行结果一样的问题,applet程序如下:
import java.awt.*;
import java.applet.*;

class Myweb1 extends Applet implements Runnable
{
  Thread mythread=null;
  int x,y,x1,y1;
  int j,h;
  int red,green,blue;
  Font f=new Font("TimesRoman",Font.ITALIC,45);
  public void init()
  {
    x=0;
    y=25;
    x1=0;
    y1=50;
    j=0;
    h=760;
  }
  public void start()
  {
    if(mythread==null)
    mythread=new Thread(this);
    mythread.start();
  }
  public void stop()
  {
    if(mythread!=null)
    mythread.stop();
    
  }

  public void paint(Graphics g)
  {
    g.setFontRose;
    g.setColor(Color.black);
    g.fillRect(0,50,760,435);
    g.setColor(new Color((int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255)));
    x=(j<760)?(j+=1)Sadh-=1);
    if(h==0)
    {
     h=760;j=0;
    }
    g.drawString("欢迎光临Mark网页",x,y);
    for(int loop=0;loop<100;loop++)
    {
      red=(int)Math.random()*255;
      green=(int)Math.random()*255;
      blue=(int)Math.random()*255;
      x1=(int)Math.random()*760;
      y1=(int)Math.random()*435;
      g.setColor(new Color(red,green,blue));
      if((red<200)&&(green<200)&&(blue<200))
      g.drawString("*",x1,y1);
    }
  
  }
  public void run()
    {
      while(true)
      {
        repaint();
        try
        {
         Thread.sleep(50);
        }
        catch(Exception e)
        {
          System.out.printlnEnvelope;
        }
      }
    }
  
}

html:
<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="000000">
<CENTER>
<APPLET
  code  = "Myweb1.class"
  width  = "760"
  height  = "435"
  >
</APPLET>
</CENTER>
</BODY>
</HTML>
运行后还是和第一个一样,这究竟是怎么回事呀!!!!
可是运行application就可以。

6.Re:applet小程序未初始化问题? [Re: xh20021411] Copy to clipboard
Posted by: why
Posted on: 2005-05-17 21:40

Have you read one of the linked posts in 置顶索引 regarding Applet Plugin setting?
Have you tried so?

Dead If your configuration doesn't work for a simple applet like the one in your original post, how would you expect it to work for a more complex one?

Do you think posting some more code would provide more information?
And why would you ignore my questions?
1.
Where and how do you 运行?
IE, AppletViewer?
2.
It's totally useless only say so.
At least you have to describe your configuration.

Did you see my comment in red at the top?

Furthermore, please read 置顶索引...

If you don't want to communicate with me, fine, I'm happy to ignore any of your future posts.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923