📄 fcoursesetting.java~37~
字号:
package untitled2;import javax.swing.*;import java.awt.*;import com.borland.jbcl.layout.*;import com.borland.dbswing.*;import javax.swing.border.*;import java.awt.event.*;import Digital_Campus_DataModule.*;import javax.swing.*;import java.awt.*;import com.borland.jbcl.layout.*;import java.awt.event.*;import java.sql.SQLException;import java.sql.DriverManager;import java.sql.Connection;import com.borland.dbswing.*;import Digital_Campus_DataModule.*;import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;import javax.swing.border.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2006</p> * <p>Company: </p> * @author not attributable * @version 1.0 */public class FCourseSetting extends JFrame { String num[]=new String[]{"1","2","3","4","5","6","7","8"}; XYLayout xYLayout1 = new XYLayout(); JLabel jLTerm = new JLabel(); JLabel jLGrade = new JLabel(); JButton jBCourseAdd = new JButton(); JPanel jPCouseSet = new JPanel(); Border border1; TitledBorder titledBorder1; JComboBox jCBChooseCouse = new JComboBox(); JLabel jLChooseCouse = new JLabel(); JLabel jLClassNum = new JLabel(); JPanel jPCouseShow = new JPanel(); Border border2; TitledBorder titledBorder2; Border border3; TitledBorder titledBorder3; JLabel jLClassNumber = new JLabel(); DB_DataModule dB_DataModule_CourseSet; JComboBox jCBTerm = new JComboBox(); JComboBox jCBGrade = new JComboBox(); JLabel jLabel2 = new JLabel(); JComboBox jComboBox2 = new JComboBox(); JComboBox jComboBox1 = new JComboBox(); JLabel jLabel1 = new JLabel(); JLabel jLabel3 = new JLabel(); JComboBox jComboBox3 = new JComboBox(num); JPanel jPCourseTime = new JPanel(); JPanel jPanel1 = new JPanel(); TitledBorder titledBorder4; public FCourseSetting() { try { jbInit(); } catch(Exception ex) { ex.printStackTrace(); } } void jbInit() throws Exception { border1 = BorderFactory.createEmptyBorder(); titledBorder1 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140)),"课程设置"); border2 = BorderFactory.createLineBorder(SystemColor.controlText,1); titledBorder2 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140)),"课程设置预览"); border3 = BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140)); titledBorder3 = new TitledBorder(border3,"上课时间设置"); dB_DataModule_CourseSet = Digital_Campus_DataModule.DB_DataModule.getDataModule(); titledBorder4 = new TitledBorder(BorderFactory.createEtchedBorder(Color.white,new Color(148, 145, 140)),"上课时间"); this.getContentPane().setLayout(xYLayout1); this.setDefaultCloseOperation(HIDE_ON_CLOSE); this.setLocale(new java.util.Locale("zh", "CN", "")); this.setResizable(false); this.setSize(new Dimension(800, 600)); this.setTitle("课程设置"); this.addWindowListener(new FCourseSetting_this_windowAdapter(this)); jLTerm.setFont(new java.awt.Font("Dialog", 0, 14)); jLTerm.setText("学期:"); jLTerm.setBounds(new Rectangle(31, 23, 45, 20)); jLGrade.setFont(new java.awt.Font("Dialog", 0, 14)); jLGrade.setText("年级:"); jLGrade.setBounds(new Rectangle(221, 24, 60, 18)); jBCourseAdd.setBounds(new Rectangle(666, 23, 61, 21)); jBCourseAdd.setText("添加"); jBCourseAdd.addActionListener(new FCourseSetting_jBCourseAdd_actionAdapter(this)); jPCouseSet.setLayout(null); jPCouseSet.setFont(new java.awt.Font("Dialog", 0, 13)); jPCouseSet.setBorder(titledBorder1); jPCouseSet.setDebugGraphicsOptions(0); jCBChooseCouse.setBounds(new Rectangle(560, 24, 73, 18)); jLChooseCouse.setFont(new java.awt.Font("Dialog", 0, 13)); jLChooseCouse.setText("所学科目:"); jLChooseCouse.setBounds(new Rectangle(494, 22, 76, 20)); jLClassNum.setFont(new java.awt.Font("Dialog", 0, 13)); jLClassNum.setText("班级数"); jLClassNum.setBounds(new Rectangle(379, 24, 57, 20)); jPCouseShow.setAutoscrolls(false); jPCouseShow.setBorder(titledBorder2); jPCouseShow.setLayout(null); jLClassNumber.setText("jLabel4"); jLClassNumber.setBounds(new Rectangle(422, 25, 34, 16)); jCBTerm.setBounds(new Rectangle(81, 23, 116, 22)); jCBGrade.setBounds(new Rectangle(257, 24, 82, 22)); jCBGrade.addActionListener(new FCourseSetting_jCBGrade_actionAdapter(this)); jLabel2.setFont(new java.awt.Font("Dialog", 0, 12)); jLabel2.setToolTipText(""); jLabel2.setText("开始时间:"); jLabel2.setBounds(new Rectangle(206, 29, 65, 20)); jComboBox2.setBounds(new Rectangle(465, 27, 95, 20)); jComboBox1.setBounds(new Rectangle(275, 29, 82, 19)); jLabel1.setFont(new java.awt.Font("Dialog", 0, 12)); jLabel1.setLocale(java.util.Locale.getDefault()); jLabel1.setDebugGraphicsOptions(0); jLabel1.setText("节数:"); jLabel1.setBounds(new Rectangle(67, 32, 44, 18)); jLabel3.setFont(new java.awt.Font("Dialog", 0, 12)); jLabel3.setText("结束时间:"); jLabel3.setBounds(new Rectangle(384, 28, 79, 19)); jComboBox3.setBounds(new Rectangle(121, 30, 56, 19)); jPCourseTime.setBorder(titledBorder3); jPCourseTime.setLayout(null); jPanel1.setBorder(titledBorder4); jPCouseSet.add(jLGrade, null); jPCouseSet.add(jLTerm, null); jPCouseSet.add(jBCourseAdd, null); jPCouseSet.add(jCBChooseCouse, null); jPCouseSet.add(jLClassNumber, null); jPCouseSet.add(jLClassNum, null); jPCouseSet.add(jLChooseCouse, null); jPCouseSet.add(jCBTerm, null); jPCouseSet.add(jCBGrade, null); this.getContentPane().add(jPanel1, new XYConstraints(433, 164, 352, 402)); this.getContentPane().add(jPCourseTime, new XYConstraints(8, 83, 779, 69)); jPCourseTime.add(jComboBox3, null); jPCourseTime.add(jLabel1, null); jPCourseTime.add(jLabel2, null); jPCourseTime.add(jComboBox1, null); jPCourseTime.add(jLabel3, null); jPCourseTime.add(jComboBox2, null); this.getContentPane().add(jPCouseShow, new XYConstraints(10, 161, 408, 416)); this.getContentPane().add(jPCouseSet, new XYConstraints(5, 8, 783, 65)); } public static void main(String[] args) { FCourseSetting FCourseSetting = new FCourseSetting(); } void jBCourseAdd_actionPerformed(ActionEvent e) { } void this_windowActivated(WindowEvent e) { String sql = "SELECT * FROM term "; Connection con = null; try{ con = DBConnection.getConnection(); PreparedStatement ps = con.prepareStatement(sql); ResultSet rs = ps.executeQuery(); while(rs.next()) { jCBTerm.addItem(rs.getString("term_id")); } sql = "SELECT * FROM grade"; ps = con.prepareStatement(sql); rs = ps.executeQuery(); while(rs.next()) { jCBGrade.addItem(rs.getString("grade_name")); } DbUtil.close(rs); DbUtil.close(ps); }catch(Exception ee){ ee.printStackTrace(); }finally{ DbUtil.close(con); } jCBChooseCouse.addItem("语文"); jCBChooseCouse.addItem("数学"); jCBChooseCouse.addItem("英语"); jCBChooseCouse.addItem("物理"); jCBChooseCouse.addItem("化学"); } void jCBGrade_actionPerformed(ActionEvent e) { String sql = "SELECT COUNT(class_id) AS class_count "+ "FROM class "+ "WHERE (grade_name = '"+jCBGrade.getSelectedItem().toString()+"')"; Connection con = null; try{ con = DBConnection.getConnection(); PreparedStatement ps = con.prepareStatement(sql); System.out.print(sql) ; System.out.print(jCBGrade.getSelectedItem().toString()) ; ResultSet rs = ps.executeQuery(); jLClassNumber.setText(String.valueOf(rs.getString("class_count")) ); DbUtil.close(rs); DbUtil.close(ps); }catch(Exception ee){ ee.printStackTrace(); }finally{ DbUtil.close(con); } }}class FCourseSetting_jBCourseAdd_actionAdapter implements java.awt.event.ActionListener { FCourseSetting adaptee; FCourseSetting_jBCourseAdd_actionAdapter(FCourseSetting adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jBCourseAdd_actionPerformed(e); }}class FCourseSetting_this_windowAdapter extends java.awt.event.WindowAdapter { FCourseSetting adaptee; FCourseSetting_this_windowAdapter(FCourseSetting adaptee) { this.adaptee = adaptee; } public void windowActivated(WindowEvent e) { adaptee.this_windowActivated(e); }}class FCourseSetting_jCBGrade_actionAdapter implements java.awt.event.ActionListener { FCourseSetting adaptee; FCourseSetting_jCBGrade_actionAdapter(FCourseSetting adaptee) { this.adaptee = adaptee; } public void actionPerformed(ActionEvent e) { adaptee.jCBGrade_actionPerformed(e); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -