SWT/AWT的问题:怎样在listener中访问其他控件? 其他的也没几行,主要的代码就是这些了!是不是我必须要把label声明为final啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 label.setBounds (shell.getClientArea ()); 你的这些代码是不是写在STATIC方法内的?如果是你的LABALE要定义成FINAL 我给你个简单的代码:这是第一种方法:public class myframe extends Frame{ …… TextFiled txt; Button bon; …… myframe() { …… txt = new TextFiled(10); bon = new Button("OK"); bon.addActionListener(action); }; ……}class action implements ActionListener { TextFiled text; action(TextFiled t) { text = t; } public void AcitonPerformed(ActionEvent e) { text.setText("Ok!"); }}这是第二种方法:public class myframe extends Frame{ …… TextFiled txt; Button bon; …… myframe() { …… txt = new TextFiled(10); bon = new Button("OK"); bon.addActionListener(action); }; …… class action implements ActionListener //这个就称为内部类! { public void AcitonPerformed(ActionEvent e) { txt.setText("Ok!"); } }} myeclipse的debug--F5,F6的作用和F8一样 关于JAVA中的LOOP! 菜鸟求助! 关于java连接SQL Server 2000的一个问题 请高手赐教 一个诡异的笔试题关于String和StringBuffer 各位大哥救命啊! 难题 讨论任何一天是星期几的算法! 关于类之间的调用 高分求解,大虾请进! Java程序可否在Windows下和Linux下绑定为可执行的exe程序? jButton1按钮事件里try{}catch(这里怎么写){} 哪里有JAVA-API 的下载?最好是.zip 格式的!
这是第一种方法:public class myframe extends Frame
{
……
TextFiled txt;
Button bon;
……
myframe()
{
……
txt = new TextFiled(10);
bon = new Button("OK");
bon.addActionListener(action);
};
……
}
class action implements ActionListener
{
TextFiled text;
action(TextFiled t)
{
text = t;
}
public void AcitonPerformed(ActionEvent e)
{
text.setText("Ok!");
}
}这是第二种方法:
public class myframe extends Frame
{
……
TextFiled txt;
Button bon;
……
myframe()
{
……
txt = new TextFiled(10);
bon = new Button("OK");
bon.addActionListener(action);
};
……
class action implements ActionListener //这个就称为内部类!
{
public void AcitonPerformed(ActionEvent e)
{
txt.setText("Ok!");
}
}
}