图书管理系统 出现的问题

来源:互联网 发布:软件防火墙有哪些 编辑:程序博客网 时间:2024/06/05 20:40

1

在主界面上侧单击右键  会弹出  右键菜单

但是在主界面中间 单击右键 没有反应

 

2

查找的时候

 


   JButtonbutton_ok = new JButton("确定",new ImageIcon("ok.png"));
   southPanel.add(button_ok);
   button_ok.addActionListener(newActionListener(){
   public voidactionPerformed(ActionEvent e)
   {
    Filef1 =SearchFrame.this.getClassName();
    
    File[]f = f1.listFiles();
    
    
    try{
     FileInputStreamfr = new FileInputStream(f[0]);
     ObjectInputStreamobo = new ObjectInputStream(fr);
     
     boolean exist = false;//用来判断有没有查到
     do{
      
      book_search=(Book)obo.readObject();
         System.out.println(book_search);
      if(book_search.toString().contains(textField.getText()))
      {
       exist =true;
       Object[][] book=new Object[1][];
       
           book[0][0]=book_search.getNumber();
         book[0][1]=book_search.getName();
         book[0][2]=book_search.getAuthor();
         book[0][3]=book_search.getPress();
         book[0][4]=book_search.getCount();
       
       String [] book_info = {"编号","书名 ","作者","出版社","数量"};
       table_search = new JTable(book,book_info);
       
       
                          new SearchResult();
       
      }
      
       
      }while(book_search==null);
     
     
     //当没有检索到书的时候显示结果
     if(!exist){
      JLabellabel_result = new JLabel("没有检索到该书!!");
      JOptionPane.showConfirmDialog(SearchFrame.this,label_result,"图书管理系统检索结果",JOptionPane.PLAIN_MESSAGE,JOptionPane.OK_OPTION , newImageIcon("result.png"));
     }
     
     obo.close();
     
    }catch(InvalidClassExceptione3)
    {
     e3.printStackTrace();
    }
    catch(ClassNotFoundException e1) {
     
     e1.printStackTrace();
    }catch(StreamCorruptedExceptione4){
     e4.printStackTrace();
    }catch(OptionalDataExceptione5)
    {
     e5.printStackTrace();
    }catch(FileNotFoundExceptione6)
    {
     
    }
    catch(IOException e2) {
    
     e2.printStackTrace();
    }
   }
   });

里没有反应 只有查不到的时候才会弹出 提示查询不到的界面

 

最关键的问题 是 添加书目可以实现  确实以对象的形式写到文本文档里了

 

但是  尝试了很多次

 

读出来 不知道怎么放到  查询结果 或者是 主界面里

主界面 运行的时候自动显示

中间 进行操作  主界面的 JTabel 怎把状态更改(刷新)?

0 0
原创粉丝点击