JTextField调用不了getText()方法,求教!!!
importacm.program.*;importjavax.swing.*;importjava.awt.event.*;publicclassJTextFielde...
import acm.program.*;
import javax.swing.*;
import java.awt.event.*;
public class JTextField extends Program{
private static final long serialVersionUID = 3L;
public void run(){
TF = new JTextField();
add(new JLabel("Contain: "), SOUTH);
add(TF, SOUTH);
TF.addActionListeners(this);
}
public void actionPerformed(ActionEvent e){
if(e.getSource() == TF.getText())
println(TF);
}
private JTextField TF;
}
TF.getText()是我自己输上去的,老是报错,说:The method getText() is undefined for the type JTextField,为什么不行啊,跪求大神!!! 展开
import javax.swing.*;
import java.awt.event.*;
public class JTextField extends Program{
private static final long serialVersionUID = 3L;
public void run(){
TF = new JTextField();
add(new JLabel("Contain: "), SOUTH);
add(TF, SOUTH);
TF.addActionListeners(this);
}
public void actionPerformed(ActionEvent e){
if(e.getSource() == TF.getText())
println(TF);
}
private JTextField TF;
}
TF.getText()是我自己输上去的,老是报错,说:The method getText() is undefined for the type JTextField,为什么不行啊,跪求大神!!! 展开
2个回答
Storm代理
2023-08-29 广告
2023-08-29 广告
"StormProxies是全球大数据IP资源服务商,其住宅代理网络由真实的家庭住宅IP组成,可为企业或个人提供满足各种场景的代理产品。点击免费测试(注册即送1G流量)StormProxies有哪些优势?1、IP+端口提取形式,不限带宽,I...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询