帮忙改错???不明白呀!!! class LoginDialog does not have a constructor which takes no parameters, since there is a LoginDialog(JFrame parent) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果要写一个LoginDialog class的测试程序,应该怎么写?我还需要加什么method在test里面吗?? tryclass test { static JFrame f; public static void main(String[] args) { f = new JFrame("This is a test"); f.setSize(400, 150); Container content = f.getContentPane(); content.setBackground(Color.white); content.setLayout(new FlowLayout()); JButton jb = new JButton("Click Me"); jb.addActionListener(new ActionListener() { public void actionPerformed ( ActionEvent ae ) { LoginDialog ld = new LoginDialog(f); ld.userText = new JTextField("zongyi"); ld.pwText = new JPasswordField("zongyi"); ld.show(); } }); content.add(jb); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { System.exit(0); } }); f.setVisible(true); } } LOGINDIALOG里面没有无参数的构造函数,你改一下好了,或者在调用上改,或者在类里改,都可以 请教各位如何在swing中调用word 用DOM4J如何遍历取出XML文件中的值 classloader相关基础知识 如何将控件的背景设置为一张图片或者如何用一个控件将图片导入Eclipse 怎样创建这样的jar文件? 请大家推荐本专门讲SWING的好书 java与jsp问题? 我想编写一个windows form,在里面如何实现浏览网页的功能?调用什么组件? 大神求救。为什么把一堆程序封装成方法之后出现编译出现需要.class 寻找JServer 请问java怎么实现传递引用? 大哥大姐,小弟想知道那里有支持JAVA的免费服务器啊??
class test
{
static JFrame f;
public static void main(String[] args)
{ f = new JFrame("This is a test");
f.setSize(400, 150);
Container content = f.getContentPane();
content.setBackground(Color.white);
content.setLayout(new FlowLayout());
JButton jb = new JButton("Click Me");
jb.addActionListener(new ActionListener() {
public void actionPerformed ( ActionEvent ae )
{
LoginDialog ld = new LoginDialog(f);
ld.userText = new JTextField("zongyi");
ld.pwText = new JPasswordField("zongyi");
ld.show();
} }); content.add(jb);
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent event)
{
System.exit(0);
}
}); f.setVisible(true);
}
}
你改一下好了,或者在调用上改,或者在类里改,都可以