教程说明实验二_第1页
教程说明实验二_第2页
教程说明实验二_第3页
教程说明实验二_第4页
教程说明实验二_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、中南大学SSD4课程实验实验题目exercise2学生学生学号3901130813专业班级1306需求分析观察所给程序,模仿实现其所有功能。详细设计模拟界面布局。实现焦点设置,按钮响应,用户使用说明框提示等功能。在“Enter a number:”之后输入 1-7 选择显示相应段落,点击“Display”按钮可在“UARcomponent description:”的文本框里显示出对应内容。若输入会有框提示。在“Enter a search string:”之后输入想要查找的字符串,点击“Search”按钮会出现提框,然后会在“Found at:”下面显示出该字符串出现的位置。示7附录impo

2、rt java.awt.event.KeyEvent; import javax.swing.JOptionPane;/*To change this license header, choose License Headers in Project Properties.To change this template file, choose Tools | Templatesand open the templatehe editor.*/*author lenovo*/public claewJFrame extends javax.swing.JFrame public sic Str

3、ing s; public siccoun=0;public siccount(String ss,String st) String a= new String(ss);index=a.indexOf(st); if(index!=-1)coun+; a=a.substring(index+1); return count(a,st);elsereturn coun;/* Creates new form NewJFrame*/public NewJFrame() s=new String8;s1=This should be a unique identifier for the pure

4、s of filing. If moren one is working on the project or moren oneysis technique is being used, this identifiercould contain letters and numbers. For exle, if Chris Smind Joo are bothng an ysis, the identifier might be CS1 or JK75. If both a heuristic evaluation and a think-aloud usability study were

5、used, the identifiers might be HE6 or TA89. Follow the unique identifier with the word Problem, if the report pertains to a usability problem of theerface, or the words Good Feature, if it describes an aspect of theerface you feel should be pin anyredesign.;s2=This description will be used as the na

6、me of this UAR when you talk about its relation to other UARs. Make the name as short as sible (about three to five words) but still descriptive and distinguishable from other aspects of the system. If this UAR is about a problem (as op ed to a good feature), make sure you have a name t describes th

7、e problem, rather n a solution.;s3=This is the objective supporting material t justifies your identifying the aspe worthy of report. This section needs to contain enough information for a reader of this UAR to understand what triggered the report. For an HE report, for instance, this could be an ima

8、ge of a cluttered screen and the heuristic about aesthetics and minimalist design. In a think-aloud study this is usually what was on the screen (a screen shot or description), what the user did (keystrokes, mouse movements), what the system did in response to any user actions, and what the user sai

9、d. You need to include enough pertinent information about the identification of an aspect for the reader to understand what the yst was thinking when the aspect was identified (for HE) or what the user was trying to do when the aspect either hindered or facili ed his or her progress.;s4=This is your

10、 re ion of the evidence. t is, for a think-aloud usability test, why you think what happened happened, or, for an HE, why you think the aspect was designed the way it was. You need to provide enough content his explanation for the reader to understand the problem-even if they do not know the system

11、oras well as you do.;s5=This is your reasoning about how important it is to either fix this problem or preserve this good feature. This includes how frequently the users will experience this aspect, whether they are likely to learn how it works, whether it will affect new users, casual users, experi

12、enced users, etc.;s6=If this aspect is a problem (as oped to a good feature to be pin the next verof the software), this is the place to proe a solution. It is not nesary to have a solution as soon as you identify a problem-you might find after yzing the wholeerface t many problems are related and c

13、l be fixed by making a singroad change instead of making several small changes. However, if you do proe asible solution, report anypotential design trade-offst you see;s7=It is often the case t UARs are related to each other. This is where you record which UARs this one is related to and a s ement a

14、bout how it is related. Make sure tall the related UARs po to each other. It is a common mistake to enter the po er o a newly created UAR, but neglect to go back to the previous ones t it relates to and update their UARs.;ponents(); jButton1.setMnemonic(KeyEvent.VK_D); jButton2.setMnemonic(KeyEvent.

15、VK_S); jButton3.setMnemonic(KeyEvent.VK_X); jTextField1.requestFocus();/*This method is called from withhe constructor to initialize the form.WARNING: Do NOT modify this code. The content of this method is alwaysregenerated by the Form Editor.*/ SuppressWarnings(unchecked)/ private voidponents() jLa

16、bel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new j

17、avax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton();jScr

18、ollPane1 = new javax.swing.JScrollPane(); jTextPane2 = new javax.swing.JTextPane(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle(Exercise 2);setName(Exercise

19、 2); / NOI18NsetResizable(false);jLabel1.setFont(new java.awt.Font(宋体, 1, 14); / NOI18N jLabel1.setText(UAR component description:);jLabel2.setFont(new java.awt.Font(宋体, 1, 14); / NOI18N jLabel2.setText(UAR compoments names:);jLabel3.setFont(new java.awt.Font(宋体, 0, 14); / NOI18N jLabel3.setText(1.

20、UAR Identfier);jLabel4.setFont(new java.awt.Font(宋体, 0, 14); / NOI18N jLabel4.setText(2. Succinct Description of the Usability Aspect);jLabel5.setFont(new java.awt.Font(宋体, 0, 14); / NOI18N jLabel5.setText(3. Evidence for the Aspect);jLabel6.setFont(new java.awt.Font(宋体, 0, 14); / NOI18N jLabel6.set

21、Text(4. Explanation of the Aspect);jLabel7.setFont(new java.awt.Font(宋体, 0, 14); / NOI18N jLabel7.setText(5. Serveity of the Promblem or Benefit of the Good Feature);jLabel8.setFont(new java.awt.Font(宋体, 0, 14); / NOI18N jLabel8.setText(6.sible Solutions and Potential Trade-offs);jLabel9.setFont(new

22、 java.awt.Font(宋体, 0, 14); / NOI18N jLabel9.setText(7. Relationship to Other Usability Aspects);jLabel10.setFont(new java.awt.Font(宋体, 0, 14); / NOI18N jLabel10.setText(Enter a number:);jLabel11.setText(Enter a search string :); jButton1.setText(Display);jButton1.addActionListener(new java.awt.event

23、.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) jButton1ActionPerformed(evt););jButton2.setText(Search);jButton2.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) jButton2ActionPerformed(evt););jButton3.set

24、Text(Exit);jButton3.addActionListener(new java.awt.event.ActionListener() public void actionPerformed(java.awt.event.ActionEvent evt) jButton3ActionPerformed(evt););jTextPane2.setEditable(false); jScrollPane1.setViewportView(jTextPane2);jLabel12.setText(Found at:);javax.swing.GroupLayoutlayout=new j

25、avax.swing.GroupLayout(getContentPane();getContentPane().setLayout(layout); layout.setHorizontalGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layoreateSequentialGroup().addContainerGap().addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).ad

26、dGroup(layoreateSequentialGroup().addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)ponent(jLabel9) ponent(jLabel8) ponent(jLabel6) ponent(jLabel5) ponent(jLabel4) ponent(jLabel7,javax.swing.GroupLayout.PREFERRED_SIZE,416, javax.swing.GroupLayout.PREFERRED_SIZE)ponent(jLabel3

27、) ponent(jLabel2,javax.swing.GroupLayout.PREFERRED_SIZE,183, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swiponentPlacem ent.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)ponent(jLabel1,java

28、x.swing.GroupLayout.PREFERRED_SIZE,226, javax.swing.GroupLayout.PREFERRED_SIZE)ponent(jScrollPane1,javax.swing.GroupLayout.PREFERRED_SIZE,259, javax.swing.GroupLayout.PREFERRED_SIZE)ponent(jLabel12).addGap(18, 18, 18).addGroup(layoreateSequentialGroup().addGroup(layoreateParallelGroup(javax.swing.Gr

29、oupLayout.Alignment.LEADING)ponent(jLabel10).addGroup(layoreateSequentialGroup()ponent(jLabel11).addGap(18, 18, 18).addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)ponent(jTextField1) ponent(jTextField2,javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE).addG

30、ap(18, 18, 18).addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)ponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)ponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, Shor

31、t.MAX_VALUE).addPreferredGap(javax.swiponentPlacem ent.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layoreateSequentialGroup()ponent(jLabel14, jav

32、ax.swing.GroupLayout.DEFAULT_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addPreferredGap(javax.swiponentPlacement.RELATED)ponent(jButton3,javax.swing.GroupLayout.PREFERRED_SIZE,72, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap().addGroup(javax.swing.GroupLayout.Alignment.TR

33、AILING, layoreateSequentialGroup()ponent(jLabel13,javax.swing.GroupLayout.PREFERRED_SIZE,169, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(83, 83, 83);layout.setVerticalGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layoreateSequentialGroup().addGap(18, 18, 18).ad

34、dGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)ponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,26, javax.swing.GroupLayout.PREFERRED_SIZE)ponent(jLabel1).addGap(5, 5, 5).addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layoreateSequ

35、entialGroup() ponent(jLabel3).addGap(13, 13, 13)ponent(jLabel4).addPreferredGap(javax.swiponentPlacement.UNRELATED)ponent(jLabel5).addPreferredGap(javax.swiponentPlacement.UNRELATED)ponent(jLabel6).addPreferredGap(javax.swiponentPlacement.UNRELATED)ponent(jLabel7).addPreferredGap(javax.swiponentPlac

36、ement.UNRELATED)ponent(jLabel8).addPreferredGap(javax.swiponentPlacement.UNRELATED)ponent(jLabel9) ponent(jScrollPane1,javax.swing.GroupLayout.PREFERRED_SIZE,225, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swiponentPlacement.UNRELATED)ponent(jLabel12).addPreferredGap(javax.swipone

37、ntPlacement.RELATED).addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)ponent(jLabel10) ponent(jTextField1,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.Grou

38、pLayout.PREFERRED_SIZE)ponent(jButton1) ponent(jLabel13,javax.swing.GroupLayout.PREFERRED_SIZE,23, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(16, 16, 16).addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)ponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE,javax.s

39、wing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layoreateParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)ponent(jLabel11) ponent(jTextField2,javax.swing.GroupLayout.PREFERRED_SIZE,javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)ponent(jButton2) ponent(j

40、Button3).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE);pack(); setLocationRelativeTo(null);/ private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) / TODO add your handling code here: System.exit(0);private void jButton1ActionPerformed(java.awt.event.ActionEvent

41、 evt) / TODO add your handling code here:tryjTextPane2.setText(segarse(jTextField1.getText(); jTextField2.requestFocus(); catch(Exception e)JOptionPane.showMessageDialog(null, Please enter values betn 1 and 7,Display Error,JOptionPane.INFORMATION_MESSAGE);jTextField1.requestFocus();private void jBut

42、ton2ActionPerformed(java.awt.event.ActionEvent evt) / TODO add your handling code here:if(jTextPane2.getText().equals()JOptionPane.showMessageDialog(null, Please select a text,Search string,JOptionPane.INFORMATION_MESSAGE);jTextField1.requestFocus();else if(jTextField2.getText().equals()JOptionPane.

43、showMessageDialog(null, Please input a string,Search string,JOptionPane.INFORMATION_MESSAGE);jTextField2.requestFocus();else if(jTextPane2.getText().indexOf(jTextField2.getText()=-1)JOptionPane.showMessageDialog(null,nostringmatches,Search string,JOptionPane.INFORMATION_MESSAGE);jTextField2.requestF

44、ocus();elseif(JOptionPane.showConfirmDialog(null, The number of occurenof+jTextField2.getText()+is +count(jTextPane2.getText(),jTextField2.getText()+nSearchthesametext?,Searchstring, JOptionPane.YES_NO_OPTION)=0)jLabel13.setText(Occuren:+1+iton: +jTextPane2.getText().indexOf(jTextField2.getText();if

45、(coun !=1)jLabel14.setText(Occuren:+coun+iton: +jTextPane2.getText().lastIndexOf(jTextField2.getText();jTextField2.requestFocus(); jTextField2.setSelectionStart(0); jTextField2.setSelectionEnd(jTextField2.getText().length();elsejTextField2.setText(null);jTextField1.setText(null); jTextPane2.setText(

46、null); jLabel14.setText(null); jTextField1.requestFocus();coun=0;/* param args thed line arguments*/public sic void main(String args) /* Set the Nimbus look and feel */* If Nimbus (roduced in Java SE 6) is not available, stay with the default lookand feel.*Fordetailssee HYPERLINK http:/d/ http:/d/javase/tutorial/uiswing/lookandfeel/plaf.html*/ try for(javax.swing.UIManager.LookAndFeelInfoinfo: javax.swing.UIManager.getInstalledLookAndFeels() if (Nimbus.equals(info.getName() javax.swing.UIManager.setLookAndFeel(info.getClaame(); break; catch (ClaotFoundExceptio

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论