JDK 1.5下提示 “super must be in first statement in cons tructor"

Gere Yeung 2005-11-04 06:37:03
//
import javax.swing.*;

public class Form extends javax.swing.JFrame
{
JTextField username = new JTextField(15);
JPasswordField password = new JPasswordField(15);
JTextArea comments = new JTextArea(4, 15);

public void Form()
{
super("Feed back");
setSize(1024, 768);
setDefaultCloseOperation(EXIT_ON_CLOSE);

JPanel pane = new JPanel();
JLabel usernameLabel = new JLabel("username:");
JLabel passwordLabel = new JLabel("password:");
JLabel commentsLabel = new JLabel("comments:");
comments.setLineWrap(true);
comments.setWrapStyleWord(true);
pane.add(usernameLabel);
pane.add(username);
pane.add(passwordLabel);
pane.add(password);
pane.add(commentsLabel);
pane.add(comments);
setContentPane(pane);

show();
}

public static void main(String args[])
{
Form input = new Form();
}
}
...全文
172 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Gere Yeung 2005-11-04
  • 打赏
  • 举报
回复
谢谢。
柯本 2005-11-04
  • 打赏
  • 举报
回复
public void Form()
构造函数不能定义返回值:
改为
public Form()
就可以了

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧