教程說明實驗二_第1頁
教程說明實驗二_第2頁
教程說明實驗二_第3頁
教程說明實驗二_第4頁
教程說明實驗二_第5頁
已閱讀5頁,還剩8頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、中南大學SSD4課程實驗實驗題目exercise2學生學生學號3901130813專業(yè)班級1306需求分析觀察所給程序,模仿實現(xiàn)其所有功能。詳細設計模擬界面布局。實現(xiàn)焦點設置,按鈕響應,用戶使用說明框提示等功能。在“Enter a number:”之后輸入 1-7 選擇顯示相應段落,點擊“Display”按鈕可在“UARcomponent description:”的文本框里顯示出對應內容。若輸入會有框提示。在“Enter a search string:”之后輸入想要查找的字符串,點擊“Search”按鈕會出現(xiàn)提框,然后會在“Found at:”下面顯示出該字符串出現(xiàn)的位置。示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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論