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

📄 viewaction.java~35~

📁 简单的硬盘配置界面
💻 JAVA~35~
字号:
package informationsystem.gui;

import java.awt.event.*;
import informationsystem.gui.MainWindow;
import informationsystem.database.DBHandler;
import informationsystem.information.Student;

public class ViewAction
    implements ActionListener {
  private MainWindow window;
  private DBHandler db = new DBHandler();

  public ViewAction(MainWindow window) {
    this.window = window;
  }

  /**
   * Invoked when an action occurs.
   *
   * @param e ActionEvent
   * @todo Implement this java.awt.event.ActionListener method
   */
  public void actionPerformed(ActionEvent e) {
    try {
      String number = this.window.jTextField1.getText();
    // String capacity = this.window.jTextField2.getText();    //*****************************
      //以下是通过输入价格来查询硬盘的相关信息
      if (db.validate(number)) {      // 增加了&&db.validate(capacity)
        Student student = new Student(number);
       // Student st = new Student(capacity);  //*****************增加
        this.window.jTextField5.setText(student.getApplyType());
        this.window.jTextField2.setText(student.getName());  //*******************
        this.window.jTextField3.setText(student.getDepartment());
        this.window.jTextField4.setText(student.getBelongClass());
        this.window.jTextField1.setText(student.getNo());
        this.window.jTextPane1.setText(student.getNo()+","+student.getName()+","
                                       +student.getDepartment()+","
                                       +student.getBelongClass()+","+student.getApplyType()
                                         +"—————:"+student.getDetailContent());
  //************************************************

 /* //以下是使硬盘的具体信息在ta区域内显示
  Object eo=e.getSource();
   if (eo==this.window.jButton6)
      this.window.ta.setText(student.getDetailContent());
  ////以上是使硬盘的具体信息在ta区域内显示*/
      }
      else {
        this.window.jTextField1.setText("");
        this.window.jTextPane1.setText("数据库中没有您查询的价格和容量!");
      }
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }
  }
}

⌨️ 快捷键说明

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