第一范文网 - 专业文章范例文档资料分享平台

java课程设计

来源:用户分享 时间:2025/10/27 21:36:58 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

static Connection conn = null; static PreparedStatement ps = null; static ResultSet rs = null; public static boolean add(Manger manger) { try { Class.forName(\ conn = DriverManager.getConnection( \ \ ps = conn .prepareStatement(\

MangerTable(MangerName,MangerId,MangerPass,MangerIdentify) values(?,?,?,?)\ ps.setString(1, manger.getMangerName()); ps.setString(2, manger.getMangerId()); ps.setString(3, manger.getMangerPass()); ps.setString(4, manger.getMangerIdentify()); ps.execute(); } catch (Exception e) { e.printStackTrace(); } finally { try { ps.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return false; } public static boolean find(String name, String pass, String identify) { try { Class.forName(\ conn = DriverManager.getConnection(

into

1

3 \ \ ps = conn.prepareStatement(\ ps.setString(1, name); rs = ps.executeQuery(); while (rs.next()) { String pass1 = rs.getString(\ System.out.println(pass1); String identify2 = rs.getString(\ if (pass1.equals(pass) && identify.equals(identify2.trim())) { return true; } }

} catch (Exception e) { e.printStackTrace(); } finally { if (rs != null) { try { rs.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { ps.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } }

return false;

}

}

管理员界面代码:

package Frame;

1

4 import javax.swing.*;

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

import java.awt.event.*;

public class MangerJieMian extends JFrame implements ActionListener{ JMenuItem jtm1=null; JMenuItem jtm2=null; // JMenuItem jtm3=null; JMenuItem jtm4=null; // JMenuItem jtm5=null; JMenuItem jtm6=null; // JMenuItem jtm7=null; // JMenuItem jtm8=null; JMenuItem jtm9=null; JMenuItem jtm10=null; JMenuItem jtm11=null; JMenuItem jtm12=null; public MangerJieMian() { this.setTitle(\管理员菜单\ JMenuBar menubar1 = new JMenuBar(); //创建菜单栏 this.setJMenuBar(menubar1); //设置此窗体的菜单栏 数:放置于该窗体的菜单栏 JMenu menu1 = new JMenu(\航班管理\ //创建3个菜单 JMenu menu2 = new JMenu(\旅客管理\ JMenu menu3 = new JMenu(\票务管理\ JMenu menu4 = new JMenu(\系统帮助\ menubar1.add(menu1); //将菜单添加进菜单栏 menubar1.add(menu2); menubar1.add(menu3); menubar1.add(menu4); jtm1 = new JMenuItem(\查询航班信息\ jtm2 = new JMenuItem(\更改航班信息\ // jtm3 = new JMenuItem(\校验登陆信息\ jtm4 = new JMenuItem(\退出\

// jtm5 = new JMenuItem(\旅客信息录入\ jtm6 = new JMenuItem(\删除用户信息\ // jtm7 = new JMenuItem(\取票信息\ // jtm8 = new JMenuItem(\退票信息\ jtm9 = new JMenuItem(\订票信息\ // jtm10 = new JMenuItem(\退订信息\ jtm10 = new JMenuItem(\查询订票信息\ jtm11 = new JMenuItem(\系统指南\ jtm12 = new JMenuItem(\关于我们\

参1

5 menu1.add(jtm1); menu1.addSeparator(); menu1.add(jtm2); menu1.addSeparator(); //将新分隔符追加到菜单的末尾

// menu1.add(item3); // menu1.addSeparator(); menu1.add(jtm4);

// menu2.add(jtm5); menu2.addSeparator(); menu2.add(jtm6); // menu3.add(jtm7); // menu3.addSeparator(); // menu3.add(jtm8); // menu3.addSeparator(); menu3.add(jtm9); menu3.addSeparator(); menu3.add(jtm10); menu4.add(jtm11); menu4.addSeparator(); menu4.add(jtm12); jtm1.addActionListener(this); jtm2.addActionListener(this); // jtm3.addActionListener(this); jtm4.addActionListener(this); // jtm5.addActionListener(this); jtm6.addActionListener(this); // jtm7.addActionListener(this); // jtm8.addActionListener(this); jtm9.addActionListener(this); jtm10.addActionListener(this); jtm11.addActionListener(this); jtm12.addActionListener(this); this.show(); this.setBounds(100, 100, 500, 300); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }

// public static void main(String[] args) { // MangerJieMian mj = new MangerJieMian();

1

6

搜索更多关于: java课程设计 的文档
java课程设计.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c1ee1y9t4ix3x5ie1kmyo_4.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top