JADE的booktrading中GUI套用解析

JADE的booktrading中GUI套用解析

ID:37921478

大小:60.00 KB

页数:7页

时间:2019-06-02

JADE的booktrading中GUI套用解析_第1页
JADE的booktrading中GUI套用解析_第2页
JADE的booktrading中GUI套用解析_第3页
JADE的booktrading中GUI套用解析_第4页
JADE的booktrading中GUI套用解析_第5页
资源描述:

《JADE的booktrading中GUI套用解析》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、内容摘要:...              &......那末某个例子看不懂,便览java的读书还要加强一点......              &...                jade的bookTrading中关于于Agent与gui应用界面结合的例子,实则gui在jade中的套用多么简约,主要是要把jade的Agent类当成一个平常类来应用就足以了。那末某个例子看不懂,便览java的读书还要加强一点。现在我来解析一下,主要是对准BoolSellerAgent类材料和BookSellerGui类文书。大家看BookSellerGui.java的主要框架:impo

2、rtjava.awt.*;//表明要用哪些类来兑现gui界面,importjava.awt.event.*;importjavax.swing.*;/**  @authorGiovanniCaire-TILAB*/classBookSellerGuiextendsJFrame{    privateBookSellerAgentmyAgent;//该Agent作为一个分子,所以在添加图书的时机要调用该事物成员的诀要    privateJTextFieldtitleField,priceField;    BookSellerGui(BookSellerAgenta){  

3、    super(a.getLocalName());            myAgent=a;//Agent成员初始化            JPanelp=newJPanel();      p.setLayout(newGridLayout(2,2));      p.add(newJLabel("Booktitle:"));      titleField=newJTextField(15);      p.add(titleField);      p.add(newJLabel("Price:"));      priceField=newJTextFiel

4、d(15);      p.add(priceField);      getContentPane().add(p,BorderLayout.CENTER);            JButtonaddButton=newJButton("Add");      addButton.addActionListener(newActionListener(){        publicvoidactionPerformed(ActionEventev){          try{              Stringtitle=titleField.getText()

5、.trim();              Stringprice=priceField.getText().trim();              myAgent.updateCatalogue(title,Integer.parseInt(price));//调用该成员的法子对图书数据进行更新              titleField.setText("");              priceField.setText("");          }          catch(Exceptione){              JOptionPane.s

6、howMessageDialog(BookSellerGui.this,"Invalidvalues."+e.getMessage(),"Error",JOptionPane.ERROR_MESSAGE);          }        }      });      p=newJPanel();      p.add(addButton);      getContentPane().add(p,BorderLayout.SOUTH);            //Maketheagentterminatewhentheusercloses      //theGUI

7、usingthebuttonontheupperrightcorner        addWindowListener(new  WindowAdapter(){        publicvoidwindowClosing(WindowEvente){          myAgent.doDelete();//同样是调用某个方法,干什么的自己猜猜        }      });            setResizable(false);  }    publicvoidshow(){      pac

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。