您的位置:程序门 -> java -> j2se / 基础类



大家帮我看看我的程序中哪个函数过时了


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


大家帮我看看我的程序中哪个函数过时了
发表于:2007-02-27 22:33:11 楼主
import   java.awt.*   ;
import   java.applet.*   ;

public   class   first   extends   applet{
/*public   void   paint(graphics   g)   {
g.drawstring( "hello ",100,100)   ;
}*/
button   b1   =   new   button( "button1 ")   ;
button   b2   =   new   button( "button2 ")   ;
public   void   init(){
add(b1)   ;
add(b2)   ;
}
public   boolean   action(event   e1   ,   object   args){
if(e1.target.equals(b1))
showstatus( "b1 ")   ;
else   return   super.action(e1,args)   ;
return   true   ;
}
}
发表于:2007-02-28 11:31:551楼 得分:0
action
@deprecated
public   boolean   action(event   evt,object   what)已过时。  
从   jdk   version   1.1   开始,应该将此组件作为组件(激发操作事件)上的   actionlistener   来注册。
发表于:2007-02-28 11:47:522楼 得分:0
action啊!
不是说得很清楚了么?
通过actionlistener来注册啊!
就是
b1.addactionlistener(this)
b2.addactionlistener(this)
然后action的事件在另外写,就ok了!
发表于:2007-02-28 11:49:283楼 得分:0
比如
actionperformed(){
    if   (b1点击)   {
        ……
    }
    if   (b2点击)   {
        ……
    }
}


快速检索

最新资讯
热门点击