📄 stuframe.java
字号:
.addGap(31, 31, 31)) .addGroup(layout.createSequentialGroup() .addComponent(jButton2) .addGap(18, 18, 18) .addComponent(jButton3) .addContainerGap(25, Short.MAX_VALUE))) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(jLabel2) .addGap(44, 44, 44) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(txtGrade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtMajor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7)) .addGap(9, 9, 9) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel6) .addComponent(txtCla, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(txtID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4))) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton6)) .addGap(25, 25, 25) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton3) .addComponent(jButton4) .addComponent(jButton5)) .addGap(47, 47, 47)) ); pack(); }// </editor-fold>//GEN-END:initComponentsprivate void txtNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNameActionPerformed// TODO add your handling code here:}//GEN-LAST:event_txtNameActionPerformedprivate void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed// TODO add your handling code here://统计成绩分布情况 /*students.stat(statArr); stat = new Stat(this); stat.setVisible(true);*/ NewJFrame s =new NewJFrame(); // s.setVisible(true);}//GEN-LAST:event_jButton2ActionPerformedprivate void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed// TODO add your handling code here://调用查询成绩对话框 String id = JOptionPane.showInputDialog("请输入学号"); Student theStudent = students.seek(id); if(theStudent == null){ JOptionPane.showConfirmDialog(this , "查无此人", "查询结果", JOptionPane.DEFAULT_OPTION,JOptionPane.INFORMATION_MESSAGE); } else { /*txtID.setText(theStudent.ID); txtName.setText(theStudent.name); txtScore.setText(String.valueOf(theStudent.score));*/ //JOptionPane.showConfirmDialog(this,"学号 "+theStudent.ID+"姓名为 "+theStudent.name+"成绩是: "+theStudent.score // , "查询结果",JOptionPane.DEFAULT_OPTION,JOptionPane.INFORMATION_MESSAGE); }}//GEN-LAST:event_jButton3ActionPerformedprivate void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed// TODO add your handling code here://新增学生记录 if(!txtID.getText().equals(" ")){ students.addStudent(txtGrade.getText(),txtMajor.getText(), txtCla.getText(),txtID.getText(),txtName.getText()); jList1.setListData(students.stuList.toArray()); }}//GEN-LAST:event_jButton1ActionPerformed/*private void txtScoreKeyPressed(java.awt.event.KeyEvent evt){ if(evt.getKeyCode() == 10){ if(students.seek(txtID.getText())!= null){ students.setScore(txtID.getText(), Float.parseFloat(txtScore.getText())); jList1.setListData(students.stuList.toArray()); } }}*/ private void txtIDActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtIDActionPerformed// TODO add your handling code here: txtID.getText();}//GEN-LAST:event_txtIDActionPerformedprivate void txtClaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtClaActionPerformed// TODO add your handling code here:}//GEN-LAST:event_txtClaActionPerformedprivate void txtGradeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtGradeActionPerformed// TODO add your handling code here:}//GEN-LAST:event_txtGradeActionPerformedprivate void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed// TODO add your handling code here: NewJFrame s =new NewJFrame();}//GEN-LAST:event_jButton4ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new StuFrame().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JList jList1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTextField txtCla; private javax.swing.JTextField txtGrade; private javax.swing.JTextField txtID; private javax.swing.JTextField txtMajor; private javax.swing.JTextField txtName; // End of variables declaration//GEN-END:variablespublic float[] statArr = new float[4];private Students students = new Students();private Stat stat = null;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -