JAVA程序综合设计(数据库设计).doc
《JAVA程序综合设计(数据库设计).doc》由会员分享,可在线阅读,更多相关《JAVA程序综合设计(数据库设计).doc(45页珍藏版)》请在三一办公上搜索。
1、 北华大学开放实验报告 实验项目名称: JAVA程序综合设计(数据库设计) 所属课程名称: 面对象程序设计JAVA 实 验 类 型: 设 计 型 班 级: 信 息112 一、 实验目的与要求1. 学会基于JDBC的数据库编程技术2. 了解服务器端和客户端的类3. 学会使用Sever类、GetConnection类、SocketIO和Client类等类的设计。4. 学会运用AWT和Swing组件美化系统用户界面。二、 实验环境 XP操作传统、Eclipse开发环境和JDK6.0三、 实验原理JDBC(Java Data Base Connectivity,java数据库连接)是一种用于执行SQL
2、语句的Java API,可以为多种关系数据库提供统一访问,它由一组用Java语言编写的类和接口组成。JDBC提供了一种基准,据此可以构建更高级的工具和接口,使数据库开发人员能够编写数据库应用程序。AWT(Abstract Windowing Toolkit),中文译为抽象窗口工具包,是Java提供的用来建立和设置Java的图形用户界面的基本工具。AWT由Java中的java.awt包提供,里面包含了许多可用来建立与平台无关的图形用户界面(GUI)的类,这些类又被称为组件(components)。Swing是由100%纯Java实现的,Swing组件是用Java实现的轻量级( light-wei
3、ght)组件,没有本地代码,不依赖操作系统的支持,这是它与AWT组件的最大区别。四、实验内容1、图书管理系统登录程序代码为:import java.awt.Container;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.Icon;import javax.swing.ImageIcon;import javax.swing.JApplet;import javax.swing.JButton;import
4、javax.swing.JLabel;import javax.swing.JTextField;SuppressWarnings(serial)public class t1 extends JApplet implements ActionListenerContainer cp=getContentPane();Icon ro=new ImageIcon(getClass().getResource(g1.gif);JLabel lb0=new JLabel(,ro,JLabel.CENTER);JLabel lb1=new JLabel();JTextField tf1=new JTe
5、xtField(10);JLabel lb2=new JLabel(密码:,JLabel.CENTER);JTextField tf2=new JTextField(10);JButton bt1=new JButton(登入);JButton bt2=new JButton(重置);String IP=null;public void init()cp.setLayout(new FlowLayout();cp.add(lb0);cp.add(lb1);lb1.setText(用户名:);cp.add(tf1);cp.add(lb2);cp.add(tf2);cp.add(bt1);bt1.
6、addActionListener(this);cp.add(bt2);bt2.addActionListener(this);public void actionPerformed(ActionEvent e) 运行结果:2、新书订购管理程序代码为:package jihu;import java.awt.EventQueue;import javax.swing.JFrame;import javax.swing.JPanel;import javax.swing.border.EmptyBorder;import java.awt.Font;import javax.swing.JLab
7、el;import javax.swing.GroupLayout;import javax.swing.GroupLayout.Alignment;import java.awt.Color;import java.awt.SystemColor;import javax.swing.LayoutStyle.ComponentPlacement;import javax.swing.JTextField;import javax.swing.JRadioButton;import javax.swing.JButton;import java.awt.event.ActionListener
8、;import java.awt.event.ActionEvent;import javax.swing.border.TitledBorder;import javax.swing.UIManager;import javax.swing.JComboBox;public class t2 extends JFrame private static final long serialVersionUID = 4180756712362285535L;private JPanel contentPane;private JTextField textField;private JTextFi
9、eld textField_1;private JTextField textField_2;private JTextField textField_3;private JTextField textField_4;private JTextField textField_5;private JTextField textField_6;public static void main(String args) EventQueue.invokeLater(new Runnable() public void run() try t2 frame = new t2();frame.setVis
10、ible(true); catch (Exception e) e.printStackTrace(););public t2() setFont(new Font(华文楷体, Font.BOLD, 16);setTitle(u65B0u4E66u8BA2u8D2Du7BA1u7406);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);setBounds(100, 100, 627, 410);contentPane = new JPanel();contentPane.setForeground(Color.CYAN);contentPane.s
11、etBorder(new EmptyBorder(5, 5, 5, 5);setContentPane(contentPane);JPanel panel = new JPanel();panel.setBorder(new TitledBorder(UIManager.getBorder(TitledBorder.border), u56FEu4E66u4FE1u606F, TitledBorder.LEADING, TitledBorder.TOP, null, new Color(51, 153, 255);JPanel panel_1 = new JPanel();panel_1.se
12、tBorder(new TitledBorder(null, u8BA2u8D2Du4FE1u606F, TitledBorder.LEADING, TitledBorder.TOP, null, SystemColor.textHighlight);JButton btnNewButton = new JButton(u6DFBu52A0);btnNewButton.setFont(new Font(宋体, Font.BOLD, 12);JButton btnNewButton_1 = new JButton(u9000u51FA);btnNewButton_1.addActionListe
13、ner(new ActionListener() public void actionPerformed(ActionEvent e) );btnNewButton_1.setFont(new Font(宋体, Font.BOLD, 12);GroupLayout gl_contentPane = new GroupLayout(contentPane);gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING).addComponent(panel, GroupLayout.D
14、EFAULT_SIZE, 601, Short.MAX_VALUE).addComponent(panel_1, GroupLayout.DEFAULT_SIZE, 601, Short.MAX_VALUE).addGroup(gl_contentPane.createSequentialGroup().addGap(211).addComponent(btnNewButton).addGap(33).addComponent(btnNewButton_1).addContainerGap(239, Short.MAX_VALUE);gl_contentPane.setVerticalGrou
15、p(gl_contentPane.createParallelGroup(Alignment.LEADING).addGroup(gl_contentPane.createSequentialGroup().addComponent(panel, GroupLayout.PREFERRED_SIZE, 163, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 153, GroupLayout.PREF
16、ERRED_SIZE).addPreferredGap(ComponentPlacement.UNRELATED).addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE).addComponent(btnNewButton_1).addComponent(btnNewButton).addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);JLabel lblNewLabel_5 = new JLabel(u8BA2u8D2Du65E5u671FuFF1A);lb
17、lNewLabel_5.setFont(new Font(宋体, Font.BOLD, 12);JLabel lblNewLabel_6 = new JLabel(u64CDu4F5Cu5458uFF1A);lblNewLabel_6.setFont(new Font(宋体, Font.BOLD, 12);JLabel lblNewLabel_7 = new JLabel(u6298u6263uFF1A);lblNewLabel_7.setFont(new Font(宋体, Font.BOLD, 12);JLabel lblNewLabel_8 = new JLabel(u8BA2u8D2Du
18、6570u91CFuFF1A);lblNewLabel_8.setFont(new Font(宋体, Font.BOLD, 12);JLabel lblNewLabel_9 = new JLabel(u662Fu5426u9A8Cu6536uFF1A);lblNewLabel_9.setFont(new Font(宋体, Font.BOLD, 12);textField = new JTextField();textField.setColumns(10);textField_1 = new JTextField();textField_1.setBackground(UIManager.ge
19、tColor(Button.light);textField_1.setColumns(10);textField_2 = new JTextField();textField_2.setColumns(10);textField_3 = new JTextField();textField_3.setColumns(10);JRadioButton rdbtnNewRadioButton = new JRadioButton(u662F);rdbtnNewRadioButton.setFont(new Font(宋体, Font.BOLD, 12);rdbtnNewRadioButton.s
20、etSelected(true);JRadioButton rdbtnNewRadioButton_1 = new JRadioButton(u5426);rdbtnNewRadioButton_1.setFont(new Font(宋体, Font.BOLD, 12);GroupLayout gl_panel_1 = new GroupLayout(panel_1);gl_panel_1.setHorizontalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_1.createSequenti
21、alGroup().addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addComponent(lblNewLabel_5).addComponent(lblNewLabel_6).addComponent(lblNewLabel_7).addGap(101).addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING, false).addComponent(textField_2).addComponent(textField, Alignment.TRAILING)
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- JAVA 程序综合 设计 数据库
链接地址:https://www.31ppt.com/p-2386886.html