📄 stumainframe.java
字号:
package com.hb.studentmanager.ui;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import com.hb.studentmanager.action.StuAction;
import com.hb.studentmanager.connection.ConnectionDateBase;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class StuMainFrame extends javax.swing.JFrame {
private JScrollPane stujScrollPane;
private JLabel namejLabel;
private JTextField stujTextField;
private JTextField classjTextField;
private JButton backjButton;
private JButton deljButton;
private JButton updatejButton;
private JButton addjButton;
private JButton selectjButton;
private JComboBox yearjComboBox2;
private JLabel yearjLabel;
private JComboBox yearjComboBox1;
private JLabel birjLabel;
private JTextField addjTextField;
private JLabel addjLabel;
private JTextField namejTextField;
public JLabel jLabel1;
private JComboBox sexjComboBox;
private JLabel sexjLabel;
private JLabel classjLabel;
private JPanel jPanel;
private JTabbedPane stujTabbedPane;
private JButton lastButton;
private JButton nextjButton;
private JButton upjButton;
private JButton headjButton;
private JTable stujTable;
private DefaultTableModel stujTableModel;
private int page=1;
StuAction sa = new StuAction();
String s1="",s2="",s3="",s4="",s5="",s6="",s7="";
/**
* Auto-generated main method to display this JFrame
*/
public static void main(String[] args) {
StuMainFrame inst = new StuMainFrame();
inst.setResizable(false);
inst.setVisible(true);
}
public StuMainFrame() {
super();
initGUI();
int width=Toolkit.getDefaultToolkit().getScreenSize().width;
int height=Toolkit.getDefaultToolkit().getScreenSize().height;
this.setLocation((width-630)/2, (height-450)/2);
}
private void initGUI() {
try {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
this.setTitle("\u5b66\u751f\u4fe1\u606f\u7ba1\u7406");
{
stujScrollPane = new JScrollPane();
getContentPane().add(stujScrollPane);
stujScrollPane.setBounds(0, 0, 623, 98);
{
gettable(s1,s2,s3,s4,s5,s6,s7);
}
}
{
headjButton = new JButton();
getContentPane().add(headjButton);
headjButton.setText("\u9996\u9875");
headjButton.setBounds(21, 119, 77, 28);
headjButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
headjButtonActionPerformed(evt);
}
});
}
{
upjButton = new JButton();
getContentPane().add(upjButton);
upjButton.setText("\u4e0a\u4e00\u9875");
upjButton.setBounds(154, 119, 77, 28);
upjButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
upjButtonActionPerformed(evt);
}
});
}
{
nextjButton = new JButton();
getContentPane().add(nextjButton);
nextjButton.setText("\u4e0b\u4e00\u9875");
nextjButton.setBounds(364, 119, 77, 28);
nextjButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
nextjButtonActionPerformed(evt);
}
});
}
{
lastButton = new JButton();
getContentPane().add(lastButton);
lastButton.setText("\u5c3e\u9875");
lastButton.setBounds(518, 119, 77, 28);
lastButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
lastButtonActionPerformed(evt);
}
});
}
{
stujTabbedPane = new JTabbedPane();
getContentPane().add(stujTabbedPane);
stujTabbedPane.setBounds(0, 182, 623, 189);
{
jPanel = new JPanel();
stujTabbedPane.addTab("查询条件", null, jPanel, null);
jPanel.setPreferredSize(new java.awt.Dimension(623, 114));
jPanel.setLayout(null);
{
namejLabel = new JLabel();
jPanel.add(namejLabel);
namejLabel.setText("\u5b66\u53f7\uff1a");
namejLabel.setBounds(7, 7, 63, 28);
}
{
classjLabel = new JLabel();
jPanel.add(classjLabel);
classjLabel.setText("\u73ed\u7ea7\uff1a");
classjLabel.setBounds(7, 56, 63, 28);
}
{
sexjLabel = new JLabel();
jPanel.add(sexjLabel);
sexjLabel.setText("\u6027\u522b\uff1a");
sexjLabel.setBounds(7, 112, 63, 28);
}
{
stujTextField = new JTextField();
jPanel.add(stujTextField);
stujTextField.setBounds(91, 7, 133, 28);
}
{
ComboBoxModel sexjComboBoxModel = new DefaultComboBoxModel();
sexjComboBox = new JComboBox();
jPanel.add(sexjComboBox);
sexjComboBox.setModel(sexjComboBoxModel);
sexjComboBox.setBounds(91, 112, 133, 28);
sexjComboBox.insertItemAt(null, 0);
sexjComboBox.addItem("男");
sexjComboBox.addItem("女");
}
{
jLabel1 = new JLabel();
jPanel.add(jLabel1);
jLabel1.setText("\u59d3\u540d\uff1a");
jLabel1.setBounds(280, 7, 63, 28);
}
{
namejTextField = new JTextField();
jPanel.add(namejTextField);
namejTextField.setBounds(364, 7, 133, 28);
}
{
addjLabel = new JLabel();
jPanel.add(addjLabel);
addjLabel.setText("\u5bb6\u5ead\u4f4f\u5740\uff1a");
addjLabel.setBounds(280, 56, 77, 28);
}
{
addjTextField = new JTextField();
jPanel.add(addjTextField);
addjTextField.setBounds(364, 56, 133, 28);
}
{
birjLabel = new JLabel();
jPanel.add(birjLabel);
birjLabel.setText("\u51fa\u751f\u65e5\u671f\uff1a");
birjLabel.setBounds(280, 112, 77, 28);
}
{
ComboBoxModel yearjComboBox1Model = new DefaultComboBoxModel();
yearjComboBox1 = new JComboBox();
jPanel.add(yearjComboBox1);
yearjComboBox1.setModel(yearjComboBox1Model);
yearjComboBox1.setBounds(364, 112, 56, 28);
yearjComboBox1.insertItemAt(null, 0);
for(int i=1970;i<=2010;i++){
yearjComboBox1.addItem(String.valueOf(i));
}
yearjComboBox1.addItem("");
}
{
yearjLabel = new JLabel();
jPanel.add(yearjLabel);
yearjLabel.setText("\u5e74");
yearjLabel.setBounds(420, 112, 21, 28);
}
{
ComboBoxModel yearjComboBox2Model = new DefaultComboBoxModel();
yearjComboBox2 = new JComboBox();
jPanel.add(yearjComboBox2);
yearjComboBox2.setModel(yearjComboBox2Model);
yearjComboBox2.setBounds(441, 112, 56, 28);
yearjComboBox2.insertItemAt(null, 0);
for(int i=1970;i<=2010;i++){
yearjComboBox2.addItem(String.valueOf(i));
}
yearjComboBox2.addItem("");
}
{
selectjButton = new JButton();
jPanel.add(selectjButton);
selectjButton.setText("\u67e5\u8be2");
selectjButton.setBounds(532, 126, 77, 28);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -