图书添加界面代码java 图书代码在哪里

java图书管理界面系统的源代码

java swing 登陆界面code

创新互联-专业网站定制、快速模板网站建设、高性价比洪洞网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式洪洞网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖洪洞地区。费用合理售后完善,10余年实体公司更值得信赖。

/*

* Login.java

*

* Created on __DATE__, __TIME__

*/

package com.agen.library.window;

import java.awt.Image;

import java.awt.Toolkit;

import javax.swing.JOptionPane;

import javax.swing.UIManager;

import javax.swing.UnsupportedLookAndFeelException;

import com.agen.library.factory.DAOFactory;

import com.agen.library.util.GlobalUser;

import com.agen.library.vo.User;

/**

*

* @author __USER__

*/

public class Login extends javax.swing.JFrame {

/**

*

*/

private static final long serialVersionUID = -2176093732040600809L;

/** Creates new form Login */

public Login() {

super("易云图书管理软件V1.0");

Image ime = Toolkit.getDefaultToolkit().getImage(

getClass().getResource("/images/ico.png"));

try {

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

} catch (ClassNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (InstantiationException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (IllegalAccessException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (UnsupportedLookAndFeelException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

setIconImage(ime);

initComponents();

setLocationRelativeTo(null);

this.setResizable(false);

}

/**

* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

// GEN-BEGIN:initComponents

// editor-fold defaultstate="collapsed" desc="Generated Code"

private void initComponents() {

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jTextField1 = new javax.swing.JTextField();

jPasswordField1 = new javax.swing.JPasswordField();

jButton1 = new javax.swing.JButton();

jButton2 = new javax.swing.JButton();

jLabel1 = new javax.swing.JLabel();

jMenuBar1 = new javax.swing.JMenuBar();

jMenu1 = new javax.swing.JMenu();

jMenuItem1 = new javax.swing.JMenuItem();

jMenu2 = new javax.swing.JMenu();

jMenuItem2 = new javax.swing.JMenuItem();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

addKeyListener(new java.awt.event.KeyAdapter() {

public void keyPressed(java.awt.event.KeyEvent evt) {

formKeyPressed(evt);

}

public void keyTyped(java.awt.event.KeyEvent evt) {

formKeyTyped(evt);

}

});

jLabel2.setFont(new java.awt.Font("微软雅黑", 0, 14));

jLabel2.setText("\u7528\u6237\u540d\uff1a");

jLabel3.setFont(new java.awt.Font("微软雅黑", 0, 14));

jLabel3.setText("\u5bc6 \u7801\uff1a");

jTextField1.setFont(new java.awt.Font("微软雅黑", 0, 14));

jTextField1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jTextField1ActionPerformed(evt);

}

});

jPasswordField1.setFont(new java.awt.Font("微软雅黑", 0, 12));

jPasswordField1.addKeyListener(new java.awt.event.KeyAdapter() {

public void keyTyped(java.awt.event.KeyEvent evt) {

jPasswordField1KeyTyped(evt);

}

});

jButton1.setBackground(new java.awt.Color(223, 216, 216));

jButton1.setFont(new java.awt.Font("微软雅黑", 0, 14));

jButton1.setText("\u767b\u9646");

jButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton1ActionPerformed(evt);

}

});

jButton2.setBackground(new java.awt.Color(223, 216, 216));

jButton2.setFont(new java.awt.Font("微软雅黑", 0, 14));

jButton2.setText("\u53d6\u6d88");

jButton2.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton2ActionPerformed(evt);

}

});

jLabel1.setIcon(new javax.swing.ImageIcon(

getClass().getResource("/images/login_main.jpg"))); // NOI18N

jMenu1.setText("File");

jMenu1.setFont(new java.awt.Font("微软雅黑", 0, 14));

jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(

java.awt.event.KeyEvent.VK_Q,

java.awt.event.InputEvent.CTRL_MASK));

jMenuItem1.setText("Exit");

jMenuItem1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jMenuItem1MouseClicked(evt);

}

});

jMenuItem1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jMenuItem1ActionPerformed(evt);

}

});

jMenu1.add(jMenuItem1);

jMenuBar1.add(jMenu1);

jMenu2.setText("Help");

jMenu2.setFont(new java.awt.Font("微软雅黑", 0, 14));

jMenuItem2.setText("About");

jMenuItem2.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jMenuItem2ActionPerformed(evt);

}

});

jMenu2.add(jMenuItem2);

jMenuBar1.add(jMenu2);

setJMenuBar(jMenuBar1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(

getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(layout

.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel1)

.addGroup(

layout.createSequentialGroup()

.addContainerGap()

.addGroup(

layout.createParallelGroup(

javax.swing.GroupLayout.Alignment.TRAILING,

false)

.addComponent(

jLabel2,

javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(

javax.swing.GroupLayout.Alignment.LEADING,

layout.createSequentialGroup()

.addComponent(

jLabel3)

.addPreferredGap(

javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(

layout.createParallelGroup(

javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(

layout.createSequentialGroup()

.addGap(10,

10,

10)

.addComponent(

jButton1)

.addGap(47,

47,

47)

.addComponent(

jButton2))

.addComponent(

jPasswordField1)

.addComponent(

jTextField1,

javax.swing.GroupLayout.DEFAULT_SIZE,

197,

Short.MAX_VALUE))

.addContainerGap()))));

layout.setVerticalGroup(layout

.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(

layout.createSequentialGroup()

.addComponent(jLabel1)

.addPreferredGap(

javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(

layout.createParallelGroup(

javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel2)

.addComponent(

jTextField1,

javax.swing.GroupLayout.PREFERRED_SIZE,

24,

javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(

javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(

layout.createParallelGroup(

javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel3)

.addComponent(

jPasswordField1,

javax.swing.GroupLayout.PREFERRED_SIZE,

23,

javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(

javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(

layout.createParallelGroup(

javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jButton1)

.addComponent(jButton2))

.addContainerGap(

javax.swing.GroupLayout.DEFAULT_SIZE,

Short.MAX_VALUE)));

pack();

}// /editor-fold

// GEN-END:initComponents

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

About.start();

}

private void jPasswordField1KeyTyped(java.awt.event.KeyEvent evt) {

if (evt.getKeyChar() == '\n') {

String name = jTextField1.getText(); // 获取用户名

String pass = String.valueOf(jPasswordField1.getPassword());// 获取密码

User user = null;

// 未输入用户名

if (name.equals("") || name == null) {

JOptionPane.showMessageDialog(this, "用户名不允许为空!", "cuowu", 0);

return;

}

try {

user = DAOFactory.getIUserDAOInstance().findById(name);

if (user != null) {

if (user.getPass() != null user.getPass().equals(pass)) {

GlobalUser.LOGIN_USER = user; // 记录当前用户

// 进入主界面

Main.start();

this.dispose();

} else {

JOptionPane.showMessageDialog(this, "用户名或密码错误!");

return;

}

}

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

if (user == null) {

JOptionPane.showMessageDialog(this, "用户名或密码错误!", "消息", 0);

return;

}

}

}

private void formKeyTyped(java.awt.event.KeyEvent evt) {

}

private void formKeyPressed(java.awt.event.KeyEvent evt) {

}

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jTextField1.setText("");

jPasswordField1.setText("");

jTextField1.requestFocus();

}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

String name = jTextField1.getText(); // 获取用户名

String pass = String.valueOf(jPasswordField1.getPassword());// 获取密码

User user = null;

// 未输入用户名

if (name.equals("")) {

JOptionPane.showMessageDialog(this, "用户名不允许为空!");

return;

}

try {

user = DAOFactory.getIUserDAOInstance().findById(name);

if (user != null) {

if (user.getPass() != null user.getPass().equals(pass)) {

GlobalUser.LOGIN_USER = user; // 记录当前用户

// 进入主界面

Main.start();

this.dispose();

} else {

JOptionPane.showMessageDialog(this, "用户名或密码错误!", "消息", 0);

return;

}

}

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

if (user == null) {

JOptionPane.showMessageDialog(this, "用户名或密码错误!", "消息", 0);

return;

}

}

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {

if (JOptionPane.showConfirmDialog(this, "你确定要退出吗?", "提示",

JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {

System.exit(0);

}

}

private void jMenuItem1MouseClicked(java.awt.event.MouseEvent evt) {

System.exit(1);

}

/**

* @param args

* the command line arguments

*/

public static void main(String args[]) {

// System.out.println(Login.class.getResource("src/images/images/login_main.jpg"));

// new javax.swing.ImageIcon(

// Login.class.getResource("../../../../images/login_main.jpg"));

// new Login().setVisible(true);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Login().setVisible(true);

}

});

}

// GEN-BEGIN:variables

// Variables declaration - do not modify

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton2;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JMenu jMenu1;

private javax.swing.JMenu jMenu2;

private javax.swing.JMenuBar jMenuBar1;

private javax.swing.JMenuItem jMenuItem1;

private javax.swing.JMenuItem jMenuItem2;

private javax.swing.JPasswordField jPasswordField1;

private javax.swing.JTextField jTextField1;

// End of variables declaration//GEN-END:variables

}

java图书管理系统代码

最近好多人要这份源码啊感觉..有建表脚本..使用mysql数据库..建表之后就可以直接运行了.

采用JAVA设计一个小型图书管理程序(只要增删查改)

使用java语言设计一款小型图书管理系统,能够通过主界面根据关键字查询图书信息,能够添加图书信息和删除过去图书信息

用Java语言编程实现一个图书管理系统的主菜单。

#include iostream

#include string //C++磁盘操作头文件

#include istream

#include fstream

#include iomanip//自定义输出宽度

using namespace std;

struct Book //结构类型

{

string bookname;//书名

string author;//作者名

Book *next;

};

class BookList

{

public:

BookList(){first=new Book;first-next=NULL;}

int NewBook();

void SOldBook();

void testread();

void testwrite();

void DisplayBook();

~BookList();

private:

Book *first;

int j;

};

int BookList::NewBook()

{

Book *s;s=new Book; //为插入的新书申请结点

Book *q;q=new Book;

Book *p;p=new Book;

cout"输入新书书名:";

cins-bookname;

cout"输入作者:";

cins-author;

p=first;q=first; //建立链表

if(first-next==NULL)//如果原链表为空,把新书的结点插入到链表中

{

first-next=s; //头插法

s-next=NULL;

}

else{

while(p-next-booknames-bookname)//按书名排序插入

{

p=p-next;

if(p-next==NULL)break;

}

s-next=p-next;

p-next=s;

}

return 1;

}

void BookList::SOldBook() //查询

{

Book *s;s=new Book;

Book *p;p=new Book;

cout"输入你要查询的书名:";

cins-bookname;

p=first-next;

while(p-bookname!=s-bookname)

{

p=p-next;//接着查找下一个结点

if(p==NULL)break;

}

if(p==NULL)

cout"你所查询的书没找到!"endl;

else

cout"找到:《"p-bookname"》 "p-authorendl;

}

void BookList::testread()

{

ifstream in;j=0;//读出文件流

in.open("BookList.txt",ios::in);//以读的形式打开原文件

if(!in)

{

cerr"错误!不能打开文件!";

exit(1);

}

Book *q;q=new Book;

Book *p;p=new Book;

p=first;

cout"从BookList.txt中读出已有图书如下:"endl;

while(!in.eof())//判断文件是否为空

{

inq-booknameq-author;//从文件里面读到链表

coutq-bookname" "q-authorendl;

j++;

p-next=q;

p=q;

q-next=new Book;

q=q-next;

}

p-next=NULL;

cout"共有图书"j"本"endlendl;

in.close();

}

void BookList::DisplayBook()

{

j=0;

cout"本馆现有书籍有:"endl;

Book *p;p=new Book;

p=first-next;

while(p!=NULL) //输出链表中的元素

{

coutp-bookname" "p-authorendl;

p=p-next;

j++;

}

cout"共有图书"j"本"endl;

}

void BookList::testwrite()

{

ofstream out; //写入文件流

out.open("BookList.txt",ios::out);

if(!out)

{

cerr"错误!不能打开文件!";

exit(1);

}

Book *p;p=new Book;

for(p=first-next;p!=NULL;p=p-next)

{

outp-bookname'\t'p-authorendl; //把链表中的元素写到文件中

}

out.close();

}

BookList::~BookList() //析构函数

{

Book *p;p=new Book;

Book *q;q=new Book;

p=first-next;

while(p)

{

q=p;

p=p-next;

delete q;

}

}

void main()

{

char s;

int i,k,count=0;

BookList L; //定义对象

L.testread(); //把文件中的内容读到链表中

while(1)

{

char *menu[]={"输入新书","查询旧书","显示所有图书","退出",""}; //字符串指针数组

for(i=0;menu[i][0]!='\0';i++)

couti+1"、 "menu[i]endl;

cink;

switch(k)

{

case 1:count=L.NewBook();break;

case 2:L.SOldBook();break;

case 3:L.DisplayBook();break;

default:if(k!=4)cout"输入错误!"endl;break;

}

if(k==4)

{ if(count)

{ cout"修改后的BookList.txt未保存,是否保存?(y/n):";

cins;

if(s=='y')

L.testwrite();

}

break;

}

}

}

Java web 程序设计: 在数据库中建立一个表:T_BOOK,包含图书ID、图书名称、图书价格。

涉及到页面不刷新技术,这是在考察AJAX,在页面写入AJAX,利用AJAX进行访问action,调用action里的方法,要在页面写好JS

求一个java图书管管理软件登陆界面系统代码

package pack_view;

import java.awt.BorderLayout;

import java.awt.Dimension;

import java.awt.Font;

import java.awt.Graphics;

import java.awt.GridLayout;

import java.awt.Image;

import java.awt.Toolkit;

import java.awt.event.ActionEvent;

import java.awt.event.FocusEvent;

import java.awt.event.KeyAdapter;

import java.awt.event.KeyEvent;

import java.awt.event.MouseAdapter;

import java.awt.event.MouseEvent;

import java.awt.event.WindowEvent;

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.Statement;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JPasswordField;

import javax.swing.JTextField;

import javax.swing.UIManager;

import javax.swing.UnsupportedLookAndFeelException;

import javax.swing.plaf.multi.MultiLookAndFeel;

import pack_DB.DB;

public class Login extends JFrame{

/**

* 登陆界面

*/

private static final long serialVersionUID = 1L;

JFrame jf = new JFrame();

private JPanel panel_all ;

private JPanel panel1 = new JPanel();

private JPanel panel2= new JPanel();

private JPanel panel3 = new JPanel();

private JPanel panel4 = new JPanel();

private JLabel jLabel_title;

private JLabel jLabel_name = new JLabel();

private JLabel jLabel_password = new JLabel();

private JTextField jTextField_name = new JTextField(15);

private JPasswordField jPasswordField = new JPasswordField(15);

private JButton jb1 = new JButton();

private JButton jb2 = new JButton();

private Font font;

String cid="";

String passwd ="";

//加载背景图片

// private ImageIcon imageicon;

// private Image image;

public Login() {

jf.setTitle("客户端登陆");

jf.setSize(350, 300);

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();//把用户的显示器屏幕的尺寸(长和宽)赋值给变量screenSize

Dimension frameSize = jf.getSize();

if (frameSize.height screenSize.height) {

frameSize.height = screenSize.height;

}

if (frameSize.width screenSize.width) {

frameSize.width = screenSize.width;

}

//把弹出的对话框窗口放置在屏幕中间

jf.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);

// imageicon = new ImageIcon(ClassLoader

// .getSystemResource("res/backgound.jpg".toString()));

panel_all = new JPanel(){

public void paintComponent(Graphics g){

super.paintComponents(g);

// image = imageicon.getImage();

// if(image != null)

// g.drawImage(image,0,0,getWidth(),getHeight(),this);

}

};

font=new Font("宋体正文", 0,20);

jLabel_title = new JLabel(new ImageIcon(ClassLoader

.getSystemResource("res/Login.jpg".toString())));

jLabel_title.setFont(font);

jLabel_title.setText("用户登陆");

jLabel_name.setFont(new java.awt.Font("Dialog", 0, 14));

jLabel_name.setText("用户名:");

jLabel_password.setFont(new java.awt.Font("Dialog", 0, 14));

jLabel_password.setText("密 码:");

jb1.setFont(new java.awt.Font("Dialog", 0, 18));

jb1.setText("确 认");

jb2.setText("取 消");

jb2.setFont(new java.awt.Font("Dialog", 0, 18));

jTextField_name.addKeyListener(new KeyAdapter()

{

public void keyPressed(KeyEvent e)

{

if(e.getKeyCode()==KeyEvent.VK_ENTER)

{

jb1.doClick();

}

}});

jPasswordField.addKeyListener(new KeyAdapter()

{

public void keyPressed(KeyEvent e)

{

if(e.getKeyCode()==KeyEvent.VK_ENTER)

{

jb1.doClick();

}

}});

panel1.add(jLabel_name);

panel1.add(jTextField_name);

panel2.add(jLabel_password);

panel2.add(jPasswordField);

panel3.add(jb1);

panel3.add(jb2);

panel4.add(jLabel_title);

panel_all.setLayout(new GridLayout(4,1));

panel_all.add(panel4);

panel_all.add(panel1);

panel_all.add(panel2);

panel_all.add(panel3);

panel_all.setOpaque(false);

jf.setLayout(new BorderLayout());

jf.add(panel_all);

jb1.addMouseListener(new MouseAdapter(){

public void mouseClicked(MouseEvent me){

// if(lc.validate(jTextField_name.getText().trim(),new String(jPasswordField.getPassword()).trim())){

// doLogin();

// new MainFrame();

// }

// else

// JOptionPane.showMessageDialog(null, "Password doesn't match account,please try again!");

}

});

jb2.addMouseListener(new MouseAdapter(){

public void mouseClicked(MouseEvent me){

System.exit(0);

}

});

jf.setVisible(true);

jf.repaint();

jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

/* public void doLogin(){

cid=jTextField_name.getText().trim();

passwd=jPasswordField.getText().trim();

String sql = "select *from customer where "+"cid='"+cid+"' and password='"+passwd+"'";

if (DB.connectDB()) {

if (DB.query(sql)){

System.out.print("登陆成功");

jf.dispose();

new MainFrame(cid);

return;

} else {

System.out.print("登陆失败");

return;

}

}

}

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

new Login();

}

}


网页标题:图书添加界面代码java 图书代码在哪里
链接地址:http://ybzwz.com/article/dodecee.html