📄 database.java
字号:
/*
* @(#)Database.java 1.0 06/06/23
* @作者:林宝尉
*/
package myprojects.database;
import javax.swing.*; //插入javax.swing包
import java.awt.*; //插入java.awt包
import java.awt.event.*; //插入java.awt.event包
import java.awt.image.*;
import java.sql.*;
import myprojects.ButtonsAction.*;
class Database {
int i=0;
Icon image;
JFrame f=new JFrame();
JButton button_Student;
JButton button_Class;
JButton button_Corse;
JButton button_Result;
JButton button_Teacher;
JButton button_Print;
JButton button_Delete;
JButton button_Exit;
JLabel label_IMAGE=new JLabel();
JLabel label_wel;
JLabel label_we;
JPanel panel_Sno;
Container c=f.getContentPane();
GridBagLayout gbLayoutObj;
GridBagConstraints gbcObj;
Object[] options={"确定"};
public Database() {
gbLayoutObj=new GridBagLayout();
gbcObj=new GridBagConstraints();
c.setLayout(gbLayoutObj);
c.setBackground(Color.cyan);
label_wel=new JLabel("欢迎使用学籍管理系统");
Font ft=new Font("宋体",Font.BOLD,24);
label_wel.setFont(ft);
gbcObj.anchor=GridBagConstraints.WEST;
gbcObj.gridx=0;
gbcObj.gridy=0;
gbLayoutObj.setConstraints(label_wel,gbcObj);
c.add(label_wel);
label_we=new JLabel("作者---林宝尉");
Font ftt=new Font("隶书",Font.BOLD,22);
label_we.setFont(ftt);
gbcObj.anchor=GridBagConstraints.CENTER;
gbcObj.gridx=0;
gbcObj.gridy=1;
gbLayoutObj.setConstraints(label_we,gbcObj);
c.add(label_we);
//panel_Sno=new JPanel();
//FlowLayout flayout11;
//flayout11=new FlowLayout(FlowLayout.RIGHT,0,0);
//panel_Sno.setLayout(flayout11);
image =new ImageIcon("3.gif");
label_IMAGE.setIcon(image);
gbcObj.anchor=GridBagConstraints.WEST;
gbcObj.gridx=1;
gbcObj.gridy=1;
//panel_Sno.add(label_IMAGE);
gbLayoutObj.setConstraints(label_IMAGE,gbcObj);
c.add(label_IMAGE);
button_Student=new JButton("学生基本信息录入");
gbcObj.anchor=GridBagConstraints.WEST;
gbcObj.gridx=1;
gbcObj.gridy=2;
gbLayoutObj.setConstraints(button_Student,gbcObj);
c.add(button_Student);
button_Student.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent asd)
{
String str1=new String("点击确定进入。");
JOptionPane.showOptionDialog(null,str1,
"提示!",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,
options[0]);
new Button_Student();
return;
}});
button_Class=new JButton("班级基本信息录入");
gbcObj.anchor=GridBagConstraints.WEST;
gbcObj.gridx=1;
gbcObj.gridy=3;
gbLayoutObj.setConstraints(button_Class,gbcObj);
c.add(button_Class);
button_Class.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent asd)
{
String str1=new String("点击确定进入。");
JOptionPane.showOptionDialog(null,str1,
"提示!",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,
options[0]);
new Button_Class();
return;
}});
button_Corse=new JButton("课程基本信息录入");
gbcObj.anchor=GridBagConstraints.WEST;
gbcObj.gridx=1;
gbcObj.gridy=4;
gbLayoutObj.setConstraints(button_Corse,gbcObj);
c.add(button_Corse);
button_Corse.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent asd)
{
String str1=new String("点击确定进入。");
JOptionPane.showOptionDialog(null,str1,
"提示!",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,
options[0]);
new Button_Corse();
return;
}});
button_Result=new JButton("成绩基本信息录入");
gbcObj.anchor=GridBagConstraints.WEST;
gbcObj.gridx=1;
gbcObj.gridy=5;
gbLayoutObj.setConstraints(button_Result,gbcObj);
c.add(button_Result);
button_Result.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent asd)
{
String str1=new String("点击确定进入。");
JOptionPane.showOptionDialog(null,str1,
"提示!",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,
options[0]);
new Button_Result();
return;
}});
button_Teacher=new JButton("教师基本信息录入");
gbcObj.anchor=GridBagConstraints.WEST;
gbcObj.gridx=1;
gbcObj.gridy=6;
gbLayoutObj.setConstraints(button_Teacher,gbcObj);
c.add(button_Teacher);
button_Teacher.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent asd)
{
String str1=new String("点击确定进入。");
JOptionPane.showOptionDialog(null,str1,
"提示!",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,
options[0]);
new Button_Teacher();
return;
}});
button_Print=new JButton("基本信息查询打印");
gbcObj.anchor=GridBagConstraints.WEST;
gbcObj.gridx=1;
gbcObj.gridy=7;
gbLayoutObj.setConstraints(button_Print,gbcObj);
c.add(button_Print);
button_Print.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent asd)
{
String str1=new String("点击确定进入。");
JOptionPane.showOptionDialog(null,str1,
"提示!",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,
options[0]);
new Button_Print();
return;
}});
button_Delete=new JButton("基本信息数据删除");
gbcObj.anchor=GridBagConstraints.WEST;
gbcObj.gridx=1;
gbcObj.gridy=8;
gbLayoutObj.setConstraints(button_Delete,gbcObj);
c.add(button_Delete);
button_Delete.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent asd)
{
String str1=new String("点击确定进入。");
JOptionPane.showOptionDialog(null,str1,
"提示!",JOptionPane.DEFAULT_OPTION,
JOptionPane.WARNING_MESSAGE,null,options,
options[0]);
new Button_Delete();
return;
}});
f.setSize(500,500);
f.setTitle("Database");
f.setBackground(Color.cyan);
f.setBounds(200,200,500,500);
f.setVisible(true);
}
public static void main(String args[]) {
System.out.println("Starting Database...");
Database mainFrame = new Database();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -