📄 frame1.java~78~
字号:
if(bHideWord) jTextArea1.append(newline); else if(bCapitalize) jTextArea1.append(" "+ (new String(sWord[iStartPos -1 + iReviewNum-count-1])).toUpperCase() ); else jTextArea1.append(" " + sWord[iStartPos -1 + iReviewNum-count-1]); if(bHideMeaning) jTextArea2.append(newline); else jTextArea2.append(" " + sMeaning[iStartPos -1 + iReviewNum-count-1]); Integer iLeftWords = new Integer(count); jLabel8.setText(iLeftWords.toString()); // Count number count--; if (count < 0) { tm.stop(); jButton1.setText("开始"); count = iReviewNum-1; } } } void jCheckBox1_actionPerformed(ActionEvent e) { bHideWord = !bHideWord; if(bHideWord) jTextArea1.setText(newline); else jTextArea1.setText(" " + sWord[iStartPos -1 + iReviewNum-count-1]); } void jCheckBox2_actionPerformed(ActionEvent e) { bHideMeaning = !bHideMeaning; if (bHideMeaning) jTextArea2.setText(newline); else jTextArea2.setText(" " + sMeaning[iStartPos -1+iReviewNum-count-1]); } void jCheckBox3_actionPerformed(ActionEvent e) { bCapitalize = !bCapitalize; if(bCapitalize) jTextArea1.setText(" "+ (new String(sWord[iStartPos-1 + iReviewNum-count-1])).toUpperCase() ); else jTextArea1.setText(" " + sWord[iStartPos -1 + iReviewNum-count-1]); } void jButton2_actionPerformed(ActionEvent e) { count = (new Integer(jLabel8.getText())).intValue() + 1; jButton3.setEnabled(true); jTextArea1.setText(""); jTextArea2.setText(""); if(bHideWord) jTextArea1.append(newline); else if(bCapitalize) jTextArea1.append(" "+ (new String(sWord[iStartPos-1 + iReviewNum-count-1])).toUpperCase() ); else jTextArea1.append(" " + sWord[iStartPos -1 + iReviewNum-count-1]); if(bHideMeaning) jTextArea2.append(newline); else jTextArea2.append(" " + sMeaning[iStartPos -1+iReviewNum-count-1]); Integer iLeftWords = new Integer(count); jLabel8.setText(iLeftWords.toString()); jButton3.setEnabled(true); if (count == iReviewNum-1) { jButton2.setEnabled(false); count = iReviewNum-2; } } void jButton3_actionPerformed(ActionEvent e) { count = (new Integer(jLabel8.getText())).intValue() - 1; jButton2.setEnabled(true); Integer iLeftWords = new Integer(count); jLabel8.setText(iLeftWords.toString()); jTextArea1.setText(""); jTextArea2.setText(""); if(bHideWord) jTextArea1.append(newline); else if(bCapitalize) jTextArea1.append(" "+ (new String(sWord[iStartPos -1 + iReviewNum-count-1])).toUpperCase() ); else jTextArea1.append(" " + sWord[iStartPos -1 + iReviewNum-count-1]); if(bHideMeaning) jTextArea2.append(newline); else jTextArea2.append(" " + sMeaning[iStartPos-1 + iReviewNum-count-1]); count--; if ( count < 0) { jButton3.setEnabled(false); count = 0; } } void jSlider1_ancestorAdded(AncestorEvent e) { delay=2000; jSlider1.setValue(delay); Integer iPace = new Integer(delay); jLabel6.setText(iPace.toString()); } void jSlider1_stateChanged(ChangeEvent e) { delay = jSlider1.getValue(); Integer iPace = new Integer(delay); jLabel6.setText(iPace.toString()); if(tm.isRunning()) { tm.stop(); tm.setDelay(delay); tm.restart(); } } void jButton4_actionPerformed(ActionEvent e) { tm.stop(); jButton1.setText("开始"); jButton2.setEnabled(false); jButton3.setEnabled(false); jButton4.setEnabled(false); Integer iLeftWords = new Integer(0); count = iReviewNum-1; jLabel8.setText(iLeftWords.toString()); } void jButton5_actionPerformed(ActionEvent e) { System.exit(0); } JMenuItem jMenuItem1 = new JMenuItem(); void jMenuItem1_actionPerformed(ActionEvent e) {// jDialog.show(); } public class Book extends JDialog { JPanel panel1 = new JPanel(); XYLayout xYLayout1 = new XYLayout(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JLabel jLabel3 = new JLabel(); JLabel jLabel4 = new JLabel(); JComboBox jComboBox1 = new JComboBox(); JTextField jTextField1 = new JTextField(); JTextField jTextField2 = new JTextField(); JTextField jTextField3 = new JTextField(); JLabel jLabel5 = new JLabel(); JRadioButton jRadioButton1 = new JRadioButton(); JRadioButton jRadioButton2 = new JRadioButton(); JRadioButton jRadioButton3 = new JRadioButton(); JRadioButton jRadioButton4 = new JRadioButton(); JButton jButton1 = new JButton(); JButton jButton2 = new JButton(); // int iStartPos = 1, iReviewNum = 100, iScanRate = 2000, iOrder = 0, iBookIndex=0; public Book(Frame frame, String title, boolean modal) { super(frame, title, modal); try { jbInit(); pack(); } catch(Exception ex) { ex.printStackTrace(); } } public Book() { this(null, "", false); } private void jbInit() throws Exception { panel1.setLayout(xYLayout1); jLabel1.setFont(new java.awt.Font("Dialog", 0, 15)); jLabel1.setText("请选择书:"); jLabel2.setFont(new java.awt.Font("Dialog", 0, 15)); jLabel2.setText("开始位置:"); jLabel3.setFont(new java.awt.Font("Dialog", 0, 15)); jLabel3.setText("复习数量:"); jLabel4.setFont(new java.awt.Font("Dialog", 0, 15)); jLabel4.setText("浏览速度:"); jComboBox1.setFont(new java.awt.Font("Dialog", 0, 15)); // jComboBox1.addActionListener(new Book_jComboBox1_actionAdapter(this)); jLabel5.setFont(new java.awt.Font("Dialog", 0, 15)); jLabel5.setText("请选择浏览方式:"); jRadioButton1.setFont(new java.awt.Font("Dialog", 0, 15)); jRadioButton1.setText("默认"); jRadioButton2.setText("顺序"); jRadioButton2.setFont(new java.awt.Font("Dialog", 0, 15)); jRadioButton3.setText("逆序"); jRadioButton3.setFont(new java.awt.Font("Dialog", 0, 15)); jRadioButton4.setText("随机 "); jRadioButton4.setFont(new java.awt.Font("Dialog", 0, 15)); jButton1.setFont(new java.awt.Font("Dialog", 0, 15)); jButton1.setText("确定"); jButton2.setFont(new java.awt.Font("Dialog", 0, 15)); jButton2.setText("取消"); jTextField1.setText(""); jTextField2.setText(""); getContentPane().add(panel1); panel1.add(jTextField2, new XYConstraints(115, 147, 101, 27)); panel1.add(jLabel1, new XYConstraints(5, 36, -1, 27)); panel1.add(jLabel4, new XYConstraints(11, 209, -1, -1)); panel1.add(jLabel3, new XYConstraints(8, 150, -1, -1)); panel1.add(jLabel2, new XYConstraints(7, 95, -1, 21)); panel1.add(jComboBox1, new XYConstraints(114, 36, 101, -1)); panel1.add(jTextField1, new XYConstraints(115, 93, 101, 27)); panel1.add(jTextField3, new XYConstraints(115, 206, 101, 27)); panel1.add(jRadioButton1, new XYConstraints(291, 76, -1, -1)); panel1.add(jRadioButton4, new XYConstraints(295, 202, -1, -1)); panel1.add(jRadioButton3, new XYConstraints(292, 160, -1, -1)); panel1.add(jRadioButton2, new XYConstraints(292, 118, -1, -1)); panel1.add(jLabel5, new XYConstraints(263, 41, -1, -1)); panel1.add(jButton1, new XYConstraints(40, 254, 90, 27)); panel1.add(jButton2, new XYConstraints(200, 255, 98, 25)); jTextField1.setText((new Integer(iStartPos)).toString()); jTextField2.setText((new Integer(iReviewNum)).toString()); jTextField3.setText((new Integer(iScanRate)).toString()); try { FileInputStream fsi = new FileInputStream("book.set"); InputStreamReader isr = new InputStreamReader(fsi); BufferedReader br = new BufferedReader(isr); String sLine; int iBookNum,i=0; sLine = br.readLine(); iBookNum = (new Integer(sLine)).intValue(); //System.out.println(iBookNum); String[] sBookName = new String[iBookNum]; while ((sLine = br.readLine())!= null) { sBookName[i] = sLine; jComboBox1.addItem(sBookName[i]); i++; } Vector vBook = new Vector(iBookNum); for( i = 0; i<iBookNum; i++) vBook.add(i,sBookName[i]); // cmbBook = new JComboBox(vBook); //jComboBox1.setSelectedIndex(iBookIndex); }catch (FileNotFoundException g) { System.out.println ("error" + g ); }catch(IOException g) { System.out.println ("error" + g ); } } void jButton1_actionPerformed(ActionEvent e) { if(tm.isRunning()) tm.stop(); sBook = (String)( jComboBox1.getSelectedItem() ); iBookIndex = jComboBox1.getSelectedIndex(); iStartPos = (new Integer(jTextField1.getText())).intValue(); iReviewNum = (new Integer(jTextField2.getText())).intValue(); iScanRate = (new Integer(jTextField3.getText())).intValue(); jSlider1.setValue(iScanRate); jButton1.setText("开始"); jButton2.setEnabled(false); jButton3.setEnabled(false);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -