⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 book.java~8~

📁 用jBuilder实现的背单词软件
💻 JAVA~8~
字号:
package vocabulary;import java.awt.*;import javax.swing.*;import com.borland.jbcl.layout.*;import java.awt.event.*;import java.util.Vector;import java.util.Random;import javax.swing.event.*;import java.io.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author not attributable * @version 1.0 */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));    //this.setSize(1000,800);  }  void jComboBox1_actionPerformed(ActionEvent e) {    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();                               String[] sBookName = new String[iBookNum];                       while ((sLine = br.readLine())!= null) {                               sBookName[i] = sLine;                               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 );               }                     jTextField1.setText((new Integer(iStartPos)).toString());               jTextField2.setText((new Integer(iReviewNum)).toString());               jTextField3.setText((new Integer(iScanRate)).toString());  }}class Book_jComboBox1_actionAdapter implements java.awt.event.ActionListener {  Book adaptee;  Book_jComboBox1_actionAdapter(Book adaptee) {    this.adaptee = adaptee;  }  public void actionPerformed(ActionEvent e) {    adaptee.jComboBox1_actionPerformed(e);  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -