搜索墙首页  编程技术  java  asp  ajax  php  c/c#/c++  数据库  oracle  mysql  db2  操作系统  windows  linux  股吧
首页 > 编程 > java
 1         
1楼  sjx0508 2007-05-18 23:33:18

十万火急!!谢谢!!
在   public   void   actionPerformed(ActionEvent   ae)开始提示:非法的表达式开始
把这个PUBLIC屏蔽后在下面的每个public行都出现:非法的表达式开始
各路高手救命啊
源码:

import   java.awt.*;
import   java.awt.event.*;
import   java.rmi.*;
import   java.rmi.server.*;

public   class   client   extends   Frame   implements   ActionListener,KeyListener,Notfiable{
        int   flag   =   0;
        String   s;
        String   userName;
        String   welcome;
        String   input;
        TextArea   TextArea;
        TextField   inputText;
        Label   hello;
       
        RemoteInterface   server;
        public   client(){
                        addWindowListener(new   WindowAdapter(){
                              public   void   windowClosing(WindowEvent   e){
                                            System.exit(0);
                                      }
                              });
                              Panel   up   =   new   Panel();
                              Panel   down   =   new   Panel();
                              this.add(up,BorderLayout.NORTH);
                              this.add(down,BorderLayout.SOUTH);
                              welcome   =   "hello,stone!! ";
                              hello   =   new   Label(welcome);
                              TextArea   =   new   TextArea(s,15,50,TextArea.SCROLLBARS_BOTH);
                              TextArea.setEditable(false);
                              up.add(hello,BorderLayout.NORTH);
                              up.add(TextArea,BorderLayout.SOUTH);
                             
                              inputText   =   new   TextField(35);
                              Button   send   =   new   Button( "send ");
                              down.setBackground(Color.pink);
                              down.add(inputText);
                              down.add(send);
                             
                              send.addActionListener(this);
                              inputText.addKeyListener(this);
                              try{
                                        UnicastRemoteObject.exportObject(this);
                                      }catch(RemoteException   re){
                                                re.printStackTrace();
                                              }
                    //从这里开始出错,要是把这个public屏蔽了下个public的地方又出现非法表达式的开始        
                  public   void   actionPerformed(ActionEvent   ae){
                                      if(ae.getActionCommand().equals( "send ")){
                                                try{
                                                        server.setChatText(userName+ ": "+inputText.getText());
                                                        inputText.setText(null);
                                                      }catch(RemoteException   re){
                                                                re.printStackTrace();
                                                              }
                                              }
                                      }
                                     
                            public   void   keyPressed(KeyEvent   ev){
                                        int   keyCode   =   ev.getKeyCode();
                                        if(keyCode==KeyEvent.VK_ENTER){
                                                try{
                                                                server.setChatText(userName+ ": "+inputText.getText());
                                                                inputText.setText(null);
                                                          }catch(RemoteException   re){
                                                                    re.printStackTrace();
                                                                  }
                                              }
                                      }        
                                     
                              public   void   keyReleased(KeyEvent   ev){}
                              public   void   keyTyped(KeyEvent   ev){}        
                              public   void   notify(Integer   reason){
                                        if(reason.intValue()==0){
                                                try{
                                                                input   =   server.getChatText();
                                                                s   =   TextArea.getText()+ "\r\n ";
                                                                TextArea.setText(s+input);
                                                            }catch(RemoteException   re){
                                                                        re.printStackTrace();
                                                                  }
                                              }
                                      }
                                     
                              public   static   void   main(String[]   args){
                                        if(args.length==0){
                                                    System.out.println( "USAGE:   java   <username> ");
                                                    System.exit(0);
                                                }
                                              System.setSecurityManager(new   RMISecurityManger());
                                              client   f   =   new   client();
                                              f.username   =   args[0];
                                              try{
                                                            f.server   =   (RemoteInterface)Naming.lookup( "rmi://127.0.0.1/test ");
                                                            f.server.registerForNotification(f);
                                                      }catch(Exception   e){
                                                                e.printStackTrace();
                                                              }
                                              f.setSize(400,350);
                                              f.show();                
                                      }        
                  }
      }
2楼  mq612 2007-05-20 01:56:01

//从这里开始出错,要是把这个public屏蔽了下个public的地方又出现非法表达式的开始
这句注释之前应该有个   }
main方法后面多了个   }
 1         
您的发言将按有关规定都会存档,您须为所发表后果负责,请您遵纪守法并注意语言文明。
标题:求救!!为什么出现非法的表达式开始!! !
热门关注
标题回复点击
数据库连接字符串大全(转)02325
福州地铁最新规划图,1号线2014年建成01435
UML建模工具Rational Rose 2007 破解 下载地址2928
mysql 语法手册 chm 下载0833
e的精确值是多少?[z]3766
Struts Menu开发向导0758
驱动 EPSON TM-U220PDmodel m188d ATM 301gSC 下载3736
Nginx 0.7.x + PHP 5.2.8(FastCGI)搭建胜过Apache十倍的Web服务0735
400多个JavaScript特效大全0722
VMware Workstation 5.5.1 19175+序列号0689
搜索墙@2009 www.pkwall.com all rights reserved QQ:276471788 [京ICP备09111534号]
声明:本站部分数据来源于网络,仅供参考,如有版权问题,请联系我们,我们将及时删除!转载本站请注明来源