📄 queryscoremenujpanel.java
字号:
/*
* QueryStudentScoreJPanel.java
*
* Created on 2007年12月14日, 下午10:04
*/
package 考试成绩分析程序;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
*
* @author drawen
*/
public class QueryScoreMenuJPanel extends javax.swing.JPanel {
/** Creates new form QueryStudentScoreJPanel */
public QueryScoreMenuJPanel(JButton text,JButton column,JButton circle) {
this.textButton=text;
this.columnButton=column;
this.circleButton=circle;
this.textButton.setEnabled(false);
this.columnButton.setEnabled(false);
this.circleButton.setEnabled(false);
initComponents();
contentPanel.add(this);
columnButton.addActionListener(handleOfButton);
textButton.addActionListener(handleOfButton);
circleButton.addActionListener(handleOfButton);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
grade = new javax.swing.JTextField();
major = new javax.swing.JTextField();
classNumber = new javax.swing.JTextField();
courseId = new javax.swing.JTextField();
confirm = new javax.swing.JButton();
reset = new javax.swing.JButton();
jLabel1.setText("\u67e5\u8be2\u6210\u7ee9\u5355\u4fe1\u606f");
jLabel2.setText("\u5e74\u7ea7\uff1a");
jLabel3.setText("\u4e13\u4e1a\uff1a");
jLabel4.setText("\u73ed\u53f7\uff1a");
jLabel5.setText("\u8bfe\u7a0b\u53f7\uff1a");
grade.setText("2005");
major.setText("\u8ba1\u7b97\u673a\u79d1\u5b66\u4e0e\u6280\u672f");
classNumber.setText("3");
courseId.setText("1001");
confirm.setText("\u786e\u5b9a");
confirm.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
confirmButtonActionListener(evt);
}
});
reset.setText("\u91cd\u7f6e");
reset.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
resetButtonActionListener(evt);
}
});
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jLabel2)
.add(jLabel3)
.add(jLabel4)
.add(jLabel5))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
.add(courseId)
.add(classNumber)
.add(major)
.add(grade, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE)))
.add(layout.createSequentialGroup()
.add(41, 41, 41)
.add(jLabel1))
.add(layout.createSequentialGroup()
.add(25, 25, 25)
.add(confirm)
.add(20, 20, 20)
.add(reset)))
.addContainerGap(203, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(19, 19, 19)
.add(jLabel1)
.add(14, 14, 14)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel2)
.add(grade, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(19, 19, 19)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel3)
.add(major, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(23, 23, 23)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel4)
.add(classNumber, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(16, 16, 16)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(jLabel5)
.add(courseId, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(40, 40, 40)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(confirm)
.add(reset))
.addContainerGap(51, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void resetButtonActionListener(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetButtonActionListener
this.textButton.setEnabled(false);
this.columnButton.setEnabled(false);
this.circleButton.setEnabled(false);
this.major.setEditable(true);
this.grade.setEditable(true);
this.classNumber.setEditable(true);
this.courseId.setEditable(true);
this.confirm.setEnabled(true);
}//GEN-LAST:event_resetButtonActionListener
private void confirmButtonActionListener(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmButtonActionListener
int grade,classNumber;
String major,courseId;
try{
grade=Integer.parseInt(this.grade.getText());
classNumber=Integer.parseInt(this.classNumber.getText());
major=this.major.getText();
courseId=this.courseId.getText();
if((scoreMenu=ScoreMenu.queryFromFile(new Class(grade,major,classNumber,0,null),
new Course(courseId,null,0,0)))==null){
JOptionPane.showMessageDialog(null,"查找不到相应的成绩单信息","查询结果",JOptionPane.ERROR_MESSAGE);
return;
}
JOptionPane.showMessageDialog(null,"查询成功,请选择显示方式","查询结果",JOptionPane.WARNING_MESSAGE);
this.textButton.setEnabled(true);
this.columnButton.setEnabled(true);
this.circleButton.setEnabled(true);
this.major.setEditable(false);
this.grade.setEditable(false);
this.classNumber.setEditable(false);
this.courseId.setEditable(false);
this.confirm.setEnabled(false);
}catch(Exception e){
JOptionPane.showMessageDialog(null,"输入数据格式有误","出错",JOptionPane.ERROR_MESSAGE);
}
}//GEN-LAST:event_confirmButtonActionListener
private void showTextAnasys(){
try{
ScoreTextAnasysJFrame scoreTextAnasys=new ScoreTextAnasysJFrame(this.scoreMenu);
scoreTextAnasys.setSize(520,400);
scoreTextAnasys.setVisible(true);
}catch(Exception e){}
}
private void showCircleAnasys(){
try{
ScoreCircleAnasysJFrame scoreCircleAnasys=new ScoreCircleAnasysJFrame(this.scoreMenu);
scoreCircleAnasys.setSize(520,400);
scoreCircleAnasys.setVisible(true);
}catch(Exception e){}
}
private void showColumnAnasys(){
try{
ScoreColumnAnasysJFrame scoreColumnAnasys=new ScoreColumnAnasysJFrame(this.scoreMenu);
scoreColumnAnasys.setSize(520,400);
scoreColumnAnasys.setVisible(true);
}catch(Exception e){}
}
private ScoreMenu scoreMenu;
private JButton textButton;
private JButton columnButton;
private JButton circleButton;
private JPanel contentPanel=new JPanel(new BorderLayout());
private HandleOfButton handleOfButton=new HandleOfButton();
// 变量声明 - 不进行修改//GEN-BEGIN:variables
javax.swing.JTextField classNumber;
javax.swing.JButton confirm;
javax.swing.JTextField courseId;
javax.swing.JTextField grade;
javax.swing.JLabel jLabel1;
javax.swing.JLabel jLabel2;
javax.swing.JLabel jLabel3;
javax.swing.JLabel jLabel4;
javax.swing.JLabel jLabel5;
javax.swing.JTextField major;
javax.swing.JButton reset;
// 变量声明结束//GEN-END:variables
class HandleOfButton implements ActionListener{
public void actionPerformed(ActionEvent e){
if(e.getSource()==columnButton)
showColumnAnasys();
else if(e.getSource()==circleButton)
showCircleAnasys();
else if(e.getSource()==textButton)
showTextAnasys();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -