JAVA求助,Eclipse提示我”public class Study extends JFrame{“这个地方出错,怎么修都修不好。

packageStudy;importjava.awt.*;importjava.awt.Event.*;importjavax.swing.*;importjava.a... package Study;
import java.awt.*;
import java.awt.Event.*;

import javax.swing.*;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Set;
public class Study {
private static final AbstractButton SendBt = null;
public static void main(String[] arg) {
Object f;
((Window) f).addWindowListener(new MyWindowListener());
System.out.println("Wating...");
System.out.println("Downloading...");
System.out.println("Finding update");
System.out.println("3");
System.out.println("2");
System.out.println("1");
System.out.println("Now system start");
System.out.println("Counting......");
int c=5;
while (c<=100){
System.out.println(c=+c);
c++;
}
if (c<100){
System.out.println("......");
}else{
System.out.println("Counting is over");
}
}
JButton sendBt;
JTextField inputfield;
JTextArea chatContent;
public class Study extends JFrame{
public Study() {
this.setLayout(new BorderLayout());
chatContent=new JTextArea(12,34);
JScrollPane showPanel=new JScrollPane(chatContent);
chatContent.setEditable(false);
JPanel inputPanel=new JPanel();
inputfield=new JTextField(20);
SendBt=new JButton("Send");//定义按钮名字 ;
SendBt.addActionListener(new ActionListener(){
public void actionPerformed1(ActionEvent e){
String content=inputfield.getText();
if(content !=null && !content.trim().equals("")){
chatContent.append("My self:"+content+"\n");
}else{chatContent.append("System"+"Massage could not be empty "
+",please check your input is available."+"\n");
}
inputfield.setText("");
}
});
Label label=new Label("Chat Massage");
inputPanel.add(label);
inputPanel.add(inputfield);
inputPanel.add(sendBt);
this.add(showPanel,BorderLayout.CENTER);
this.add(inputPanel,BorderLayout.SOUTH);
this.setTitle("Chat");
this.setSize(840,600);
this.setDefaultCloseOperation(JFrame.EXT_ON_CLOSE);
this.setVisible(true);
}
public static void main(String[]args){
new Study ();
}
}
class MyWindowListener extends WindowAdapter {
public void windowClosing(WindowEvent e) {
Window window = (Window) e.getComponent();
window.dispose();
}
}
}
展开
 我来答
360167891
2015-03-09 · TA获得超过469个赞
知道小有建树答主
回答量:269
采纳率:0%
帮助的人:181万
展开全部
重复定义两个相同的类,上面已经有一个public class Study,下面你又定义一个public class Study extends JFrame
追问
但是改成Study2之后下面的就要出错啊
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式