java管理系统界面代码 java编程界面

求一个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写的学生成绩管理信息系统的源代码,要求有界面,能实现

以下方法实现了用户界面登陆

import java.awt.*;

import java.awt.event.*;

public class DengLuJieMian extends Frame implements ActionListener

{

Label username=new Label("用户名:");//使用文本创建一个用户名标签

TextField t1=new TextField();//创建一个文本框对象

Label password=new Label("密码:");//创建一个密码标签

TextField t2=new TextField();

Button b1=new Button("登陆");//创建登陆按钮

Button b2=new Button("取消");//创建取消按钮

public DengLuJieMian()

{

this.setTitle("学生信息管理系统");//设置窗口标题

this.setLayout(null);//设置窗口布局管理器

username.setBounds(50,40,60,20);//设置姓名标签的初始位置

this.add(username);// 将姓名标签组件添加到容器

t1.setBounds(120,40,80,20);// 设置文本框的初始位置

this.add(t1);// 将文本框组件添加到容器

password.setBounds(50,100,60,20);//密码标签的初始位置

this.add(password);//将密码标签组件添加到容器

t2.setBounds(120,100,80,20);//设置密码标签的初始位置

this.add(t2);//将密码标签组件添加到容器

b1.setBounds(50,150,60,20);//设置登陆按钮的初始位置

this.add(b1);//将登陆按钮组件添加到容器

b2.setBounds(120,150,60,20);//设置取消按钮的初始位置

this.add(b2);// 将取消按钮组件添加到容器

b1.addActionListener(this);//给登陆按钮添加监听器

b2.addActionListener(this);// 给取消按钮添加监听器

this.setVisible(true);//设置窗口的可见性

this.setSize(300,200);//设置窗口的大小

addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);

}

});//通过内部类重写关闭窗体的方法

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==b1)//处理登陆事件

{

String name=t1.getText();

String pass=t2.getText();

if(name!=nullpass.equals("000123"))//判断语句

{

new StudentJieMian();

}

}

}

public static void main(String args[])//主函数

{

new DengLuJieMian();

}

}

以下方法实现了学生界面设计

import java.awt.*;

import java.awt.event.*;

class StudentJieMian extends Frame implements ActionListener

{

MenuBar m=new MenuBar();//创建菜单栏

Menu m1=new Menu("信息");//创建菜单“信息”

MenuItem m11=new MenuItem("插入");//创建“插入”的菜单项

MenuItem m12=new MenuItem("查询");

Menu m2=new Menu("成绩");//创建菜单“成绩”

MenuItem m21=new MenuItem("查询");

public StudentJieMian()

{

this.setTitle("学生界面");//设置窗口标题

this.setLayout(new CardLayout());//设置窗口布局管理器

this.setMenuBar(m);//将菜单栏组件添加到容器

m.add(m1);//将信息菜单放入菜单栏

m.add(m2);

m1.add(m11);//将“插入”菜单项添加到“信息”菜单

m1.add(m12); //将“查询”菜单项添加到“信息”菜单

m2.add(m21); //将“查询”菜单项添加到“成绩”菜单

m11.addActionListener(this); //给“插入”菜单项添加监听器

m12.addActionListener(this); //给“查询”菜单项添加监听器

m21.addActionListener(this); //给“查询”菜单项添加监听器

this.setVisible(true); //设置窗口的可见性

this.setSize(300,200); //设置窗口的大小

addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

System.exit(0);//关闭窗口

}

});

}

public void actionPerformed(ActionEvent e)

{

if(e.getSource()==m11) //处理“添加信息”事件

{

new AddStudent();

}

if(e.getSource()==m12) //处理“查询信息”事件

{

new SelectStudent();

}

if(e.getSource()==m21) //处理“查询成绩”事件

{

new ChengJiStudent();

}

}

public static void main(String args[])

{ new StudentJieMian(); //创建一个对象 }

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

java swing 登陆界面code

/*

* 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编程实现一个学生信息管理系统的图形界面

package 学生管理界面;

import java.awt.BorderLayout;

import java.awt.Checkbox;

import java.awt.CheckboxGroup;

import java.awt.Container;

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.awt.event.ItemEvent;

import java.awt.event.ItemListener;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPanel;

import javax.swing.JTextField;

//录入的信息包括学号、姓名、性别、出生日期、是否联合培养等

public class 学生信息图形界面 extends JFrame implements ActionListener {

public 学生信息图形界面() { //构造方法

//界面显示问题

super("学生信息图形界面");

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

setSize(320, 300);

setVisible(true);

Container content = getContentPane();

JPanel jp1 = new JPanel(); //创建一个面板

JLabel label = new JLabel("欢迎使用学生信息管理系统"); //欢迎界面的欢迎语句

label.setFont(new Font("楷体_GB2312", Font.BOLD, 20)); //设置显示的字体

jp1.add(label); //将标签添加到面板jp1中

JPanel jp2 = new JPanel(); //创建一个面板,用于摆放提示各种功能的标签

JLabel label1 = new JLabel("请输入学生的详细资料:"); //输入提示输入的语言:

label1.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

JLabel label2 = new JLabel("学 生 学 号:"); //提示各种输入内容的标签

label2.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体t

JTextField field1=new JTextField(10); //10为学号长度,可自行设定

JLabel label3 = new JLabel("学 生 姓 名:"); //提示输入学生姓名的标签

label3.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

JTextField field2=new JTextField(10); //10为姓名长度,可自行设定

JLabel label4 = new JLabel("学 生 性 别: "); //提示输入学生性别的标签

label4.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

CheckboxGroup group1 = new CheckboxGroup(); //创建一个复选框用于选择某一功能

Checkbox check11 = new Checkbox("男",true,group1); //添加选项到复选框中

check11.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

check11.addItemListener(new CheckHandler1(1)); //给相应复选框添加事件监听器

Checkbox check12 = new Checkbox("女",false,group1); //添加选项到复选框中

check12.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

check12.addItemListener(new CheckHandler1(2)); //给相应复选框添加事件监听器

JLabel label5 = new JLabel("出 生 日 期:"); //提示输入出生日期的标签

label5.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

JTextField field3=new JTextField("2000",3); //3为姓名长度,可自行设定

JLabel label51 = new JLabel("年");

label51.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

JTextField field4=new JTextField("01",2); //2为姓名长度,可自行设定

JLabel label52 = new JLabel("月");

label52.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

JTextField field5=new JTextField("01",2); //2为姓名长度,可自行设定

JLabel label53 = new JLabel("日");

label53.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

JLabel label6 = new JLabel("联合培养:"); //提示选择联合培养与否的标签

label6.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

CheckboxGroup group2 = new CheckboxGroup(); //创建一个复选框用于选择某一功能

Checkbox check21 = new Checkbox("是",true,group2); //添加选项到复选框中

check21.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

check21.addItemListener(new CheckHandler2(1)); //给相应复选框添加事件监听器

Checkbox check22 = new Checkbox("否",false,group2); //添加选项到复选框中

check22.setFont(new Font("楷体_GB2312", Font.BOLD, 18)); //设置显示的字体

check22.addItemListener(new CheckHandler2(2)); //给相应复选框添加事件监听器

//添加组件到面板容器中

jp2.add(label1);

jp2.add(label2);

jp2.add(field1);

jp2.add(label3);

jp2.add(field2);

jp2.add(label4);

jp2.add(check11); jp2.add(check12);

jp2.add(label5);

jp2.add(field3);jp2.add(label51); jp2.add(field4);jp2.add(label52); jp2.add(field5);jp2.add(label53);

jp2.add(label6);

jp2.add(check21); jp2.add(check22);

content.add(jp1, BorderLayout.NORTH); //分别添加面板到容器中

content.add(jp2, BorderLayout.CENTER); //分别添加面板到容器中

}

public void actionPerformed(ActionEvent e) {

// 事件响应处理

}

class CheckHandler1 implements ItemListener //复选框键的事件响应类

{

private int sel;

CheckHandler1(int select)

{

sel = select;

}

public void itemStateChanged(ItemEvent e)

{

switch(sel)

{

case 1:method1();break; //调用选择的相应功能的方法

case 2:method2();break; //调用选择的相应功能的方法

}

}

private void method1() { //事件响应方法

}

private void method2() { // 事件响应方法

}

}

class CheckHandler2 implements ItemListener //复选框键的事件响应类

{

private int sel;

CheckHandler2(int select)

{

sel = select;

}

public void itemStateChanged(ItemEvent e)

{

switch(sel)

{

case 1:method1();break; //调用选择的相应功能的方法

case 2:method2();break; //调用选择的相应功能的方法

}

}

private void method1() { //事件响应方法

}

private void method2() { //事件响应方法

}

}

//测试

public static void main(String[] args) {

学生信息图形界面 界面 = new 学生信息图形界面();

界面.setVisible(true);

}

}


文章题目:java管理系统界面代码 java编程界面
转载注明:http://scyanting.com/article/hgcjpd.html