标题:谁能帮我看看Applet的一个最简单的程序
只看楼主
小玲子zhl
Rank: 2
等 级:论坛游民
帖 子:15
专家分:30
注 册:2014-10-23
结帖率:50%
已结贴  问题点数:20 回复次数:1 
谁能帮我看看Applet的一个最简单的程序
import java.applet.Applet;                                 
import java.awt.Button;                                    
import java.awt.Color;                                      
import java.awt.Graphics;                                   
public class TestApp extends Applet{                        
    Button bt;                                             
     void Applet()                                          
    {                                                      
        bt=new Button("确定");                                
        bt.setBackground(Color.BLUE);                       
        add(bt);                                            
    }                                                      
    public void paint(Graphics g)                           
    {                                                      
        g.drawString("调用add方法在容器中添加按钮", 20, 80);            
    }                                                      
    public void init()                                      
    {                                                      
        Applet smp=new Applet();                           
    }                                                      
}                                                           
为什么运行之后没有按钮
搜索更多相关主题的帖子: public import 
2014-12-10 21:00
日知己所无
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:38
帖 子:427
专家分:2071
注 册:2014-3-22
得分:20 
程序代码:
import java.applet.Applet;
import java.awt.Button;
import java.awt.Color;
import java.awt.Graphics;

@SuppressWarnings("serial")
public class TestApp extends Applet {
    Button bt;

    public void paint(Graphics g) {
        g.drawString("调用add方法在容器中添加按钮", 20, 80);
    }

    public void init() {
        bt = new Button("确定");
        bt.setBackground(Color.BLUE);
        add(bt);
    }
}
2014-12-12 23:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-439817-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.198915 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved