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();
}
}
} 展开
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();
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询