赛迪网 > IT技术 Java > 技术动态
  IT资讯搜索
 
IT产品搜索

JAVA基础应用: 单机版管理系统源代码 (1)

发布时间:2007.03.29 01:36     来源:CN-JAVA    作者:jettang

package jettang;

import java.lang.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;

//////////////////////////////////////////////


//主类
public class STU {
public STU() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}

public static void main(String args[]) {
new Frm_Main();
}

private void jbInit() throws Exception {
}
}


//主框架,数据库
class Frm_Main implements ActionListener { //throws IOException
public static final int EXIT_ON_CLOSE = 0;
public JFrame frame;
public Container c;
public JMenuBar menuBar;
public JMenu mainMenu1;
public JMenu mainMenu2;
public JMenu mainMenu3;
public JMenuItem subMenu1[] = new JMenuItem[5];
public JMenuItem subMenu2[] = new JMenuItem[7];
public JMenuItem subMenu3[] = new JMenuItem[2];
JButton toolBarButton[] = new JButton[8];
public JToolBar toolBar;
//////////////////////////////////////////////
String strTip[] = {"姓名查询...", "添加信息...",
"删除...", "修改...", "修改确认...",
"添加确认...", "删除确认...", "关于产品信息:)"};
//////////////////////////////////////////////
// String id = new String();
String name = new String();
String sex = new String();
String age = new String();
String classid = new String();
String department = new String();
String call = new String();
//////////////////////////////////////////////
Connection con;
ResultSet rs;
Statement st;
// ResultSetMetaData rsmd;
// Vector columnHeads=new Vector();
// Vector rows = new Vector();
// Vector currentRow=new Vector();

///////////////////////////////////////////////
public JLabel classidL = new JLabel("班级");
public JLabel nameL = new JLabel("姓名");
public JLabel sexL = new JLabel("性别");
public JLabel ageL = new JLabel("年龄");
public JLabel departmentL = new JLabel("单位");
public JLabel callL = new JLabel("电话");
public JLabel tittleLabel = new JLabel();
//////////////////////////////////////////////
public JTextField classidT = new JTextField();
public JTextField nameT = new JTextField();
public JTextField sexT = new JTextField();
public JTextField ageT = new JTextField();
public JTextField departmentT = new JTextField();
public JTextField callT = new JTextField();
public JTextArea textT = new JTextArea();
//////////////////////////////////////////////

//////////////////////////////////////////////
public Frm_Main() {
/////////////////////////////////////////////////
frame = new JFrame("学籍管理系统V1.0");
c = frame.getContentPane();
c.setLayout(null);
menuBar = new JMenuBar();
toolBar = new JToolBar();
toolBar.setFloatable(false);
frame.setJMenuBar(menuBar);
frame.setResizable(false);
////////////////////////////////////////////////
mainMenu1 = new JMenu("管理");
String str1[] = {"添加", "删除", "查询", " ", "关闭"};
for (int i = 0; i < 5; i++) {
if (i == 3) {
mainMenu1.addSeparator();
} else {

subMenu1[i] = new JMenuItem(str1[i]);
subMenu1[i].addActionListener(this);
mainMenu1.add(subMenu1[i]);
}
}
menuBar.add(mainMenu1);
/////////////////////////////////////////////////
mainMenu2 = new JMenu("操作");
String str2[] = {"查询", "添加", "删除", "修改",
"提交修改", "提交添加", "提交删除"};
for (int i = 0; i < 7; i++) {
subMenu2[i] = new JMenuItem(str2[i]);
subMenu2[i].addActionListener(this);
mainMenu2.add(subMenu2[i]);
}
menuBar.add(mainMenu2);
/////////////////////////////////////////////////
mainMenu3 = new JMenu("集体查询");
String str3[] = {"按班级...", "按单位..."};
for (int i = 0; i < 2; i++) {
subMenu3[i] = new JMenuItem(str3[i]);
subMenu3[i].addActionListener(this);
mainMenu3.add(subMenu3[i]);
}
menuBar.add(mainMenu3);
////////////////////////////////////////////////
String strToolBar[] = {"查询", "添加", "删除", "修改", "提交修改",
"提交添加", "提交删除", "关于"};

for (int i = 0; i < 8; i++) {

toolBarButton[i] = new JButton(strToolBar[i]);
toolBarButton[i].setToolTipText(strTip[i]);
toolBarButton[i].addActionListener(this);
toolBar.add(toolBarButton[i]);

}
toolBar.setLocation(0, 0);
toolBar.setSize(400, 30);
c.add(toolBar);
////////////////////////////////////////////////
classidL.setLocation(35, 40);
classidL.setSize(40, 20);
//classidL.setFont(new Font("",Font.BOLD,12));
c.add(classidL);

classidT.setLocation(90, 40);
classidT.setSize(200, 20);
//classidT.setEnabled(false);
c.add(classidT);

nameL.setLocation(35, 70);
nameL.setSize(40, 20);
c.add(nameL);

nameT.setLocation(90, 70);
nameT.setSize(200, 20);
c.add(nameT);

sexL.setLocation(35, 100);
sexL.setSize(40, 20);
c.add(sexL);

sexT.setLocation(90, 100);
sexT.setSize(200, 20);
c.add(sexT);

ageL.setLocation(35, 130);
ageL.setSize(40, 20);
c.add(ageL);

ageT.setLocation(90, 130);
ageT.setSize(200, 20);
c.add(ageT);

departmentL.setLocation(35, 160);
departmentL.setSize(40, 20);
c.add(departmentL);

departmentT.setLocation(90, 160);
departmentT.setSize(200, 20);
c.add(departmentT);

callL.setLocation(35, 190);
callL.setSize(40, 20);
c.add(callL);

callT.setLocation(90, 190);
callT.setSize(200, 20);
c.add(callT);
/////////////////////////////////////////////////
tittleLabel.setText("----------集体查询结果--------");
tittleLabel.setSize(300, 20);
tittleLabel.setLocation(10, 210);
c.add(tittleLabel);
////////////////////////////////////////////
textT.setSize(400, 300);
textT.setLocation(10, 240);
c.add(textT, 14);

///////////////////////////////////////////////
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500, 650);
frame.setLocation(200, 200);
frame.setVisible(true);
conDB();

}

//以上是框架设计

1 2 3 下一页>>


[ 发表评论 ] 字体[  ] [ 打印 ] [ 进入博客 ] [ 进入论坛 ]  [ 推荐给朋友 ]
  相关文章
· 在无线J2ME设备上实现超文本传输协议 (03-28) · String和stringBuffer类字符串的区别 (03-27)
· 浅析Java语言中两种异常使用间的差别 (03-27) · JAVA基础应用:日期时间选择控件(代码) (03-27)
· 基于java的图片文件格式转换和线性缩放 (03-26) · JAVA基础:Javascript Cookie管理(程序) (03-26)
· JAVA基础应用: 处理Java中的日期问题 (03-26) · 教程:比较Java EE 5平台和J2EE 1.4平台 (03-26)
· JAVA基础应用: 如何实现希尔排序算法 (03-26) · JAVA应用: 浮点数转化为大写中文金额 (03-26)
  客户需求反馈表
* 姓  名:
更多资料  了解方案  认识厂商
* 单位名称:
* 联系电话:
* 电子邮件:
  赛迪推荐  
  手机·资费 ·新品·导购·评测·手机资费·宽带
手机搜索  诺基亚 N73 MOTO Z6
  IT产品 ·笔记本·台式机·服务器·打印·投影
IT产品搜索 
  IT技术 ·开发·网管·安全·数据库·操作系统
  博客·论坛 ·曾剑秋·项立刚·Java学习·网管