📄 resultpanel.java
字号:
/* * ResultPanel.java * * Created on 2004年1月22日, 下午1:55 */package romulus.Manager;/** * * @author S */public class ResultPanel extends javax.swing.JPanel implements javax.swing.event.TreeSelectionListener{ /** Creates new form ResultPanel */ public ResultPanel(ManagerToolSet mts) { initComponents(); this.mts = mts; try{ this.ResultTree.setModel(mts.getResultTree(false, false, false)); this.ResultTree.addTreeSelectionListener(this); } catch(Exception e){ e.printStackTrace(); firePropertyChange(RomulusManagerClientFrame.ShowMSGProp, RomulusManagerClientFrame.ExitMSGProp, "Errors"); } } /** 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. */ private void initComponents() {//GEN-BEGIN:initComponents java.awt.GridBagConstraints gridBagConstraints; ButtonGroup = new javax.swing.ButtonGroup(); ScrollPane = new javax.swing.JScrollPane(); ResultTree = new javax.swing.JTree(); QueryPanel = new javax.swing.JPanel(); RadioButton_Test = new javax.swing.JRadioButton(); RadioButton_Student = new javax.swing.JRadioButton(); CheckBox_Take = new javax.swing.JCheckBox(); CheckBox_Pass = new javax.swing.JCheckBox(); InfoLabel = new javax.swing.JLabel(); setLayout(new java.awt.BorderLayout()); setFont(getFont()); ScrollPane.setFont(getFont()); ResultTree.setFont(getFont()); ScrollPane.setViewportView(ResultTree); add(ScrollPane, java.awt.BorderLayout.CENTER); QueryPanel.setLayout(new java.awt.GridBagLayout()); QueryPanel.setFont(getFont()); RadioButton_Test.setFont(getFont()); RadioButton_Test.setSelected(true); RadioButton_Test.setText("\u57fa\u4e8e\u8003\u8bd5\u7684\u67e5\u8be2"); ButtonGroup.add(RadioButton_Test); RadioButton_Test.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RadioButton_TestActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; QueryPanel.add(RadioButton_Test, gridBagConstraints); RadioButton_Student.setFont(getFont()); RadioButton_Student.setText("\u57fa\u4e8e\u5b66\u751f\u7684\u67e5\u8be2"); ButtonGroup.add(RadioButton_Student); RadioButton_Student.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RadioButton_StudentActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; QueryPanel.add(RadioButton_Student, gridBagConstraints); CheckBox_Take.setFont(getFont()); CheckBox_Take.setText("\u663e\u793a\u5b8c\u6210\u8003\u8bd5"); CheckBox_Take.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { CheckBox_TakeItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; QueryPanel.add(CheckBox_Take, gridBagConstraints); CheckBox_Pass.setFont(getFont()); CheckBox_Pass.setText("\u663e\u793a\u53ca\u683c\u8003\u8bd5"); CheckBox_Pass.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { CheckBox_PassItemStateChanged(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; QueryPanel.add(CheckBox_Pass, gridBagConstraints); add(QueryPanel, java.awt.BorderLayout.NORTH); InfoLabel.setFont(getFont()); InfoLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); InfoLabel.setText("The Infomation"); add(InfoLabel, java.awt.BorderLayout.SOUTH); }//GEN-END:initComponents private void CheckBox_TakeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_CheckBox_TakeItemStateChanged try{ this.ResultTree.setModel(mts.getResultTree(this.RadioButton_Student.isSelected(), this.CheckBox_Take.isSelected(), this.CheckBox_Pass.isSelected())); } catch(Exception e){ e.printStackTrace(); firePropertyChange(RomulusManagerClientFrame.ShowMSGProp, RomulusManagerClientFrame.ExitMSGProp, "Errors"); } }//GEN-LAST:event_CheckBox_TakeItemStateChanged private void CheckBox_PassItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_CheckBox_PassItemStateChanged try{ this.ResultTree.setModel(mts.getResultTree(this.RadioButton_Student.isSelected(), this.CheckBox_Take.isSelected(), this.CheckBox_Pass.isSelected())); } catch(Exception e){ e.printStackTrace(); firePropertyChange(RomulusManagerClientFrame.ShowMSGProp, RomulusManagerClientFrame.ExitMSGProp, "Errors"); } }//GEN-LAST:event_CheckBox_PassItemStateChanged private void RadioButton_StudentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RadioButton_StudentActionPerformed try{ this.ResultTree.setModel(mts.getResultTree(true, this.CheckBox_Take.isSelected(), this.CheckBox_Pass.isSelected())); } catch(Exception e){ e.printStackTrace(); firePropertyChange(RomulusManagerClientFrame.ShowMSGProp, RomulusManagerClientFrame.ExitMSGProp, "Errors"); } }//GEN-LAST:event_RadioButton_StudentActionPerformed private void RadioButton_TestActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RadioButton_TestActionPerformed try{ this.ResultTree.setModel(mts.getResultTree(false,this.CheckBox_Take.isSelected(), this.CheckBox_Pass.isSelected())); } catch(Exception e){ e.printStackTrace(); firePropertyChange(RomulusManagerClientFrame.ShowMSGProp, RomulusManagerClientFrame.ExitMSGProp, "Errors"); } }//GEN-LAST:event_RadioButton_TestActionPerformed public void valueChanged(javax.swing.event.TreeSelectionEvent treeSelectionEvent) { try{ javax.swing.tree.TreePath path = treeSelectionEvent.getPath(); Object[] info = path.getPath(); if(info.length == 3){ if(this.RadioButton_Student.isSelected()){ this.InfoLabel.setText(mts.getInfo(info[1].toString(), info[2].toString())); } else{ this.InfoLabel.setText(mts.getInfo(info[2].toString(), info[1].toString())); } } else{ this.InfoLabel.setText("Select to get information."); } } catch(Exception e){ e.printStackTrace(); firePropertyChange(RomulusManagerClientFrame.ShowMSGProp, RomulusManagerClientFrame.ExitMSGProp, "Errors"); } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel InfoLabel; private javax.swing.JScrollPane ScrollPane; private javax.swing.JCheckBox CheckBox_Pass; private javax.swing.JPanel QueryPanel; private javax.swing.ButtonGroup ButtonGroup; private javax.swing.JRadioButton RadioButton_Test; private javax.swing.JTree ResultTree; private javax.swing.JRadioButton RadioButton_Student; private javax.swing.JCheckBox CheckBox_Take; // End of variables declaration//GEN-END:variables private ManagerToolSet mts;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -