java用户查询界面代码 java用户查询界面代码是什么

求Java编的登录界面代码:登录后分别进入管理员界面及用户界面,依据是数据库中的用户名和密码分三个包java用户查询界面代码,自己建个包java用户查询界面代码,导进去就ok了,数据库是accessjava用户查询界面代码的 。
package 登录;
import java.awt.EventQueue;
public class Cilent {
private JFrame frame;
private JTextField textField;
private JPasswordField passwordField;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Cilent window = new Cilent();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Cilent() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("登陆界面");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
frame.setResizable(false);
JLabel lblNewLabel = new JLabel("用户名");
lblNewLabel.setBounds(38, 43, 80, 34);
frame.getContentPane().add(lblNewLabel);
textField = new JTextField();
textField.setBounds(155, 42, 227, 37);
frame.getContentPane().add(textField);
textField.setColumns(10);
JLabel label = new JLabel("密 码");
label.setBounds(38, 115, 80, 34);
frame.getContentPane().add(label);
passwordField = new JPasswordField();
passwordField.setBounds(155, 115, 227, 37);
frame.getContentPane().add(passwordField);
JButton btnNewButton = new JButton("登 录");
btnNewButton.setBounds(60, 187, 115, 34);
frame.getContentPane().add(btnNewButton);
btnNewButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
UserCheck UC=new UserCheck(textField.getText(),String.valueOf(passwordField.getPassword()));
if(UC.getI()!=0)//有此用户
{
frame.setVisible(false);
}
else
{
textField.setText("");
passwordField.setText("");
}
}
});
JButton button = new JButton("取 消");
button.setBounds(242, 187, 115, 34);
frame.getContentPane().add(button);
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
textField.setText("");
passwordField.setText("");
}
});
}
}
/*****************************************************************/
package 登录;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import 操作处理.UsersCL;
/**@author 20111024
* 检测登录的用户在数据库中有无,若没有,则提示没有此用户,
* 若有,则判断级别java用户查询界面代码:普通用户还是管理员 。
*/
public class UserCheck {
private int i=0;//用户级别:0不是用户、1是管理员、2是普通用户
UserCheck(String name ,String password)
{
String jdriver="sun.jdbc.odbc.JdbcOdbcDriver";
String connectDB="jdbc:odbc:Students";
Statement stmt=null;
ResultSet rs=null;
Connection con=null;
try {
Class.forName(jdriver);
con=DriverManager.getConnection(connectDB);
stmt=con.createStatement();
String query="select * from users where name='" name "' and passwd='" password "'";
rs=stmt.executeQuery(query);
if(rs.next())
{
//数据库中有此用户 , 访问成功
i=Integer.parseInt(rs.getString(3));
UsersCL UL=new UsersCL(i);
}
else
{
i=0;//没有用户是默认是0级
}
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public int getI() {
return i;
}
}
/********************************************************************************************/
package 操作处理;
import java.awt.EventQueue;
public class UsersCL implements ActionListener{
private JFrame frame;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
private JTextField textField_3;
private int i=0;
private JLabel label_3;
private JTextField textField_4;
public UsersCL(int i) {
this.i=i;
frame = new JFrame();
frame.setTitle("用户处理界面");
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
frame.setResizable(false);
frame.setVisible(true);
JLabel lblNewLabel = new JLabel("学 号");
lblNewLabel.setBounds(24, 32, 74, 29);
frame.getContentPane().add(lblNewLabel);
JLabel label = new JLabel("姓 名");
label.setBounds(24, 71, 74, 29);
frame.getContentPane().add(label);
JLabel label_1 = new JLabel("年 龄");
label_1.setBounds(24, 110, 74, 29);
frame.getContentPane().add(label_1);
label_3 = new JLabel("性 别");
label_3.setBounds(24, 149, 74, 29);
frame.getContentPane().add(label_3);
JLabel label_2 = new JLabel("状 态");
label_2.setBounds(24, 195, 74, 29);
frame.getContentPane().add(label_2);
textField = new JTextField();
textField.setBounds(101, 34, 113, 25);
frame.getContentPane().add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setColumns(10);
textField_1.setBounds(101, 73, 113, 25);
frame.getContentPane().add(textField_1);
textField_2 = new JTextField();
textField_2.setColumns(10);
textField_2.setBounds(101, 112, 113, 25);
frame.getContentPane().add(textField_2);
textField_3 = new JTextField();
textField_3.setEditable(false);
textField_3.setColumns(10);
textField_3.setBounds(101, 199, 288, 25);
frame.getContentPane().add(textField_3);
textField_4 = new JTextField();
textField_4.setColumns(10);
textField_4.setBounds(101, 149, 113, 25);
frame.getContentPane().add(textField_4);
if(1==i)
{
JButton btnNewButton = new JButton("追 加");
btnNewButton.setBounds(276, 41, 113, 29);
frame.getContentPane().add(btnNewButton);
btnNewButton.addActionListener(this);
btnNewButton.setActionCommand("追加");
JButton button_1 = new JButton("删 除");
button_1.setBounds(276, 145, 113, 29);
frame.getContentPane().add(button_1);
button_1.addActionListener(this);
button_1.setActionCommand("删除");
}
JButton button = new JButton("查 询");
button.setBounds(276, 91, 113, 29);
frame.getContentPane().add(button);
button.addActionListener(this);
button.setActionCommand("查询");
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String name,age,sex,query=null;
int num,age1,count=0;
num=Integer.parseInt(textField.getText());
name=textField_1.getText();
age1=Integer.parseInt(textField_2.getText());
sex=textField_4.getText();
if(e.getActionCommand().equals("追加"))
{
query="insert into students values(" num "," "'" name "'," age1 ",'" sex "');";
count=1;
}
else if(e.getActionCommand().equals("查询"))
{
query="select * from students where XSB=" num ";";
count=2;
}
else if(e.getActionCommand().equals("删除"))
{
query="delete from students where XSB=" num " and name=" "'" name "'";
count=3;
}
Statement stmt=null;
ResultSet rs=null;
Connection con=null;
String jdriver="sun.jdbc.odbc.JdbcOdbcDriver";
String connectDB="jdbc:odbc:Students";
String query1=null;
try {
Class.forName(jdriver);
con=DriverManager.getConnection(connectDB);
stmt=con.createStatement();
if(count==1)
{
query1="select * from students where XSB=" num ";";
rs=stmt.executeQuery(query1);
if(rs.next())
textField_3.setText("已经由此记录,不能追加java用户查询界面代码!");
else
{
stmt.executeUpdate(query);
textField_3.setText("已经追加完成!");
}
}
else if(2==count)
{
stmt.executeQuery(query);
rs=stmt.executeQuery(query);
if(rs.next())
{
textField_3.setText("已查找到此记录!");
}
else
{
textField_3.setText("没有此记录,可以追加!");
}
}
else if(3==count)
{
query1="select * from students where XSB=" num " and name=" "'" name "'";
rs=stmt.executeQuery(query1);
if(rs.next())
{
stmt.executeUpdate(query);
textField_3.setText("已删除此记录!");
}
else
textField_3.setText("无此记录!");
}
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
finally{
//关闭资源
if(stmt!=null){
try {
stmt.close();
} catch (Exception e2) {
// TODO: handle exception
}
stmt=null;
}
if(con!=null){
try {
con.close();
} catch (Exception e2) {
// TODO: handle exception
}
con=null;
}
}
}
}
在java程序中怎么做信息查询界面查询信息 。。。。额 。。。。
页面实现查询界面:
页面包括各种控件(这些控件在form表单中),比如 , 查询条件文本框 、提交按钮等 。并对按钮增加单击(双击)事件,用来提交参数到后台 。。。
后台java:
1 创建数据库连接
2 拼写你的查询sql语句 , 并绑定前台传进来的参数 。
3 执行结束后将结果集返回到前台 。
自己循环结果集,放到页面表格中就行了 。
如果是桌面程序
自己设计程序界面,跟页面中的控件差不多 。并增加监听事件 。
增加监听事件是为了获取参数 , 并调用查询函数传参进去 。执行后返回结果集 。
最后填充表格就行了 。。。
这个只是思路 。。具体实现,还需要你找具体实例 。。。。
查询在java开发中太平常不过了 。。。。呵呵,多多努力 。。
JAVA的图形用户界面代码package hao;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.io.File;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.text.BadLocationException;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
public class ChatPanel extends JPanel {
private static final long serialVersionUID = 1L;
JButton send,record,saveRecord,image;
JTextArea inputArea;
JTextPane text;//注意用法****************************************************************************
JComboBox fontName = null, fontSize = null, fontStyle = null, fontColor = null,fontBackColor = null;
publicStyledDocument doc = null; JScrollPane scrollPane;JPanel textChat;
JButton music;
public ChatPanel() {
setLayout(new BorderLayout());
text = new JTextPane();
text.setEditable(false);
doc = text.getStyledDocument();//跟踪文本和图片写到该区域java用户查询界面代码的位置*************************************
scrollPane = new JScrollPane(text);
//注意下面对JComboBoxjava用户查询界面代码的巧用***********************************************************************
String[] str_name = { "宋体", "黑体", "Dialog", "Gulim" };
String[] str_Size = { "12", "14", "18", "22", "30", "40" };
String[] str_Style = { "常规", "斜体", "粗体", "粗斜体" };
String[] str_Color = { "黑色", "红色", "蓝色", "黄色", "绿色" };
String[] str_BackColor = { "无色", "灰色", "淡红", "淡蓝", "淡黄", "淡绿" };
fontName = new JComboBox(str_name);
fontSize = new JComboBox(str_Size);
fontStyle = new JComboBox(str_Style);
fontColor = new JComboBox(str_Color);
fontBackColor = new JComboBox(str_BackColor);
fontName.setBackground(new Color(255,153,255));
fontSize.setBackground(new Color(255,153,255));
fontStyle.setBackground(new Color(255,153,255));
fontColor.setBackground(new Color(255,153,255));
fontBackColor.setBackground(new Color(255,153,255));
Box box = Box.createVerticalBox();//创建一个可以容纳多个Box组件java用户查询界面代码的Box*******************************
Box box_1 = Box.createHorizontalBox();
Box box_2 = Box.createHorizontalBox();
Box box_4 = Box.createHorizontalBox();
box.add(box_1);
box.add(box_2);
box.add(box_4);
JLabel b1= new JLabel("字体~~"), b2 = new JLabel("样式~~"),b3 = new JLabel("字号~~"),b4 = new JLabel("颜色~~"),b5 = new JLabel("背景~~");
b1.setBackground(new Color(255,153,255));
b2.setBackground(new Color(255,153,255));
b3.setBackground(new Color(255,153,255));
b4.setBackground(new Color(255,153,255));
b5.setBackground(new Color(255,153,255));
box_1.add(b1);
box_1.add(fontName);
box_1.add(Box.createHorizontalStrut(8));
box_1.add(b2);
box_1.add(fontStyle);
box_1.add(Box.createHorizontalStrut(8));
box_1.add(b3);
box_1.add(fontSize);
box_2.add(Box.createHorizontalStrut(8));
box_2.add(b4);
box_2.add(fontColor);
box_2.add(Box.createHorizontalStrut(8));
box_4.add(b5);
box_4.add(fontBackColor);
textChat = new JPanel();
textChat.setLayout(new BorderLayout());
textChat.setBackground(new Color(255,153,255));
inputArea = new JTextArea(3, 20);
inputArea.setLineWrap(true);//设置文本区java用户查询界面代码的换行策略 。88888*********************************
send = new JButton("发送");
record=new JButton("显示记录");
saveRecord=new JButton("储存记录");
image=new JButton("表情");
send.setBackground(new Color(255,153,255));
record.setBackground(new Color(255,153,255));
saveRecord.setBackground(new Color(255,153,255));
image.setBackground(new Color(255,153,255));
Box box_3 = Box.createHorizontalBox();
box_3.add(send);box_3.add(Box.createHorizontalStrut(8));//设置按钮间距*************************888
box_3.add(record);box_3.add(Box.createHorizontalStrut(8)); //设置按钮间距*************************888
box_3.add(saveRecord);box_3.add(Box.createHorizontalStrut(8));//设置按钮间距*************************888
box_3.add(image);
box.setBorder(BorderFactory.createLineBorder(new Color(102,102,0),5));//设置Boxjava用户查询界面代码的边框线********************
box_3.setBorder(BorderFactory.createLineBorder(new Color(102,102,0),5));
textChat.add(box,BorderLayout.NORTH);
textChat.add(inputArea,BorderLayout.CENTER);
textChat.add(box_3, BorderLayout.SOUTH);
inputArea.requestFocus(true);
inputArea.setBorder(BorderFactory.createLineBorder(new Color(102,102,0),5));//设置输入窗口边框线*******************
text.setBorder(BorderFactory.createLineBorder(new Color(102,102,0),8));//设置输入窗口边框线*******************
JPanel audioPanel = new JPanel();//最上面的边框************************************************************************
audioPanel.setBackground(new Color(255,153,255));
audioPanel.setLayout(new GridLayout(1,1));
music = new JButton("想听就听");
music.setPreferredSize(new Dimension(320,50));
music.setBorder(BorderFactory.createLineBorder(Color.BLACK,10));//设置输入窗口边框线*******************
audioPanel.add(music);
add(audioPanel, BorderLayout.NORTH);
add(scrollPane,BorderLayout.CENTER);
add(textChat, BorderLayout.SOUTH);
}
void insertIcon(ImageIcon image) {
text.setCaretPosition(doc.getLength());
text.insertIcon(image);
insert(new MessageStyle());//?????????????????????????????????????????????????????????????????????????????/
}
public void insert(MessageStyle attrib) {
try {
doc.insertString(doc.getLength(), attrib.getText()"\n", attrib.getAttrSet());//写完后接着换行************
} catch (BadLocationException e) {
e.printStackTrace();
}
}
public MessageStyle getMessageStyle(String line) {
MessageStyle att = new MessageStyle();
att.setText(line);
att.setName((String) fontName.getSelectedItem());
att.setSize(Integer.parseInt((String) fontSize.getSelectedItem()));
String temp_style = (String) fontStyle.getSelectedItem();
if (temp_style.equals("常规")) {
att.setStyle(MessageStyle.GENERAL);
}
else if (temp_style.equals("粗体")) {
att.setStyle(MessageStyle.BOLD);
}
else if (temp_style.equals("斜体")) {
att.setStyle(MessageStyle.ITALIC);
}
else if (temp_style.equals("粗斜体")) {
att.setStyle(MessageStyle.BOLD_ITALIC);
}
String temp_color = (String) fontColor.getSelectedItem();
if (temp_color.equals("黑色")) {
att.setColor(new Color(0, 0, 0));
}
else if (temp_color.equals("红色")) {
att.setColor(new Color(255, 0, 0));
}
else if (temp_color.equals("蓝色")) {
att.setColor(new Color(0, 0, 255));
}
else if (temp_color.equals("黄色")) {
att.setColor(new Color(255, 255, 0));
}
else if (temp_color.equals("绿色")) {
att.setColor(new Color(0, 255, 0));
}
String temp_backColor = (String) fontBackColor.getSelectedItem();
if (!temp_backColor.equals("无色")) {
if (temp_backColor.equals("灰色")) {
att.setBackColor(new Color(200, 200, 200));
}
else if (temp_backColor.equals("淡红")) {
att.setBackColor(new Color(255, 200, 200));
}
else if (temp_backColor.equals("淡蓝")) {
att.setBackColor(new Color(200, 200, 255));
}
else if (temp_backColor.equals("淡黄")) {
att.setBackColor(new Color(255, 255, 200));
}
else if (temp_backColor.equals("淡绿")) {
att.setBackColor(new Color(200, 255, 200));
}
}
return att;
}
}
java 语言编写一个简单的查询界面,会涉及到JAVA里面的哪些知识 。越细越好1.
publicclassrectangle{
publicintwidth;//宽
publicintheight;//高}2.
publicclassrectangle{
publicintwidth;//宽
publicintheight;//高
/**
*计算面积
*@paramwidth
*@paramheight
*@return
*/
publicintarea(intwidth,intheight){
returnwidth*height;
//返回面积
}
/**
*周长
*@paramwidth
*@paramheight
*@return
*/
publicintzhouchang(intwidth,intheight){
return2*(width
height);//返回周长
}}
3.整个程序
importjava.util.list;
publicclassrectangle{
publicintwidth;//宽
publicintheight;//高
/**
*计算面积
*@paramwidth
*@paramheight
*@return
*/
publicintarea(intwidth,intheight){
returnwidth*height;
//返回面积
}
/**
*周长
*@paramwidth
*@paramheight
*@return
*/
publicintzhouchang(intwidth,intheight){
return2*(width
height);//返回周长
}
publicstaticvoidmain(string[]args){
intwidth=5,height=3;//可以通过控制台输入,也可以用户预先设定
rectanglerectangle=newrectangle();
system.out.println("面积:"
rectangle.area(width,height));
system.out.println("周长:"
rectangle.zhouchang(width,height));
}}
求JAVA实现用户登录界面代码?你要先学会截图哦,你发的看不清楚,重新写了一个你参考参考!
import java.awt.GridLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
public class Day30A extends JFrame {
private static final long serialVersionUID = 1L;
private JLabel labelName,labelId,labelPass,labelMoney,labelSelect,labelCar;
private JComboBoxString jcb;
private JPanel jp1,jp2,jp3,jp4,jp5,jp6,jp7;
private ButtonGroup btg;
private JRadioButton jr1,jr2;
Day30A(){
this.setTitle("注册账户");
this.setLayout(new GridLayout(7,1));
this.setSize(300,280);
【java用户查询界面代码 java用户查询界面代码是什么】this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
init();
this.setVisible(true);
}
private void init() {
String str="卡片类型1,卡片类型2,卡片类型3,卡片类型4,卡片类型5";
jcb=new JComboBox(str.split(","));
labelId=new JLabel("账号: ");
labelName=new JLabel("姓名: ");
labelPass=new JLabel("密码: ");
labelMoney=new JLabel("开户金额:");
labelSelect=new JLabel("存款类型:");
labelCar=new JLabel("卡片类型:");
addFun1();
addFun2();
}
private void addFun2() {
this.add(jp1);
this.add(jp2);
this.add(jp3);
this.add(jp4);
this.add(jp5);
this.add(jp6);
this.add(jp7);
}
private void addFun1() {
jp1=new JPanel();
jp1.add(labelId);
jp1.add(new JTextField(15));
jp2=new JPanel();
jp2.add(labelName);
jp2.add(new JTextField(15));
jp3=new JPanel();
jp3.add(labelPass);
jp3.add(new JTextField(15));
jp4=new JPanel();
jp4.add(labelMoney);
jp4.add(new JTextField(13));
jp5=new JPanel();
jp5.add(labelSelect);
btg=new ButtonGroup();
jr1=new JRadioButton("定期");
jr2=new JRadioButton("活期",true);
btg.add(jr1);
btg.add(jr2);
jp5.add(jr1);
jp5.add(jr2);
jp6=new JPanel();
jp6.add(labelCar);
jp6.add(jcb);
jp7=new JPanel();
jp7.add(new JButton("确定"));
jp7.add(new JButton("取消"));
}
public static void main(String[] args) {
new Day30A();
}
}
Java 用户界面设计 求界面代码一: 首先弄清题目的意思
A.需要的主要组件列表:
1.创建一个窗口,窗口标题叫Information
2.3个标签, 用于显示文字 Name Number Class
3.3个文本框, 用于填写信息
4.1个按钮,文字是确认
5.1个文本域
B.业务逻辑
1. 当点击按钮确认的时候, 把 文本框的信息显示到文本域
C.设计的主要技术
JLabel , JButton, JTextField ...等, 都是swing的组件 ,所以应该使用swing进行创建
二:确定使用的布局
swing虽然重写了大部分的组件, 但是布局, 依旧沿袭awt技术
分析图片上的布局:
至少有2种方法可以实现,
方法一: 绝对布局 , 优点:配合可视化GUI拖曳, 可以完美的实现图上的组件的位置
但是缺点也是致命的, 不同的操作系统平台下, 可能会出现位置的移动,
只适合开发平台, 移植效果差 .所以不推荐使用
方法二: 灵活的表格布局, 配合流式布局 , 所有操作系统下,显示效果都比较统一.
三: 效果图
四: 参考代码
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FrameDemo extends JFrame {
//申明需要的组件
private final JTextField jtf1,jtf2,jtf3;
private final JTextArea jta;
public FrameDemo() {
setTitle("Information");//设置窗口标题
setSize(320, 360);//设置窗口大小
setLocationRelativeTo(null);//设置窗口居中
setDefaultCloseOperation(EXIT_ON_CLOSE);//设置关闭时退出虚拟机
getContentPane().setLayout(new FlowLayout());//设置窗口布局为流式布局
JPanel jp = new JPanel(new GridLayout(4, 2));//设置jp面板为表格布局4行2列
//第一行
JPanel jp01 = new JPanel();
JLabel jl1 = new JLabel("Name:");
jp01.add(jl1);
JPanel jp1 = new JPanel();
jtf1 = new JTextField(8);
jp1.add(jtf1);
//第二行
JPanel jp02 = new JPanel();
JLabel jl2 = new JLabel("Number:");
jp02.add(jl2);
JPanel jp2 = new JPanel();
jtf2 = new JTextField(8);
jp2.add(jtf2);
//第三行
JPanel jp03 = new JPanel();
JLabel jl3 = new JLabel("Class:");
jp03.add(jl3);
JPanel jp3 = new JPanel();
jtf3 = new JTextField(8);
jp3.add(jtf3);
//第四行
JPanel jp04 = new JPanel();
JLabel jl4 = new JLabel("");
jp04.add(jl4);
JPanel jp4 = new JPanel();
JButton jb = new JButton("确认");
jp4.add(jb);
jp.add(jp01);
jp.add(jp1);
jp.add(jp02);
jp.add(jp2);
jp.add(jp03);
jp.add(jp3);
jp.add(jp04);
jp.add(jp4);
getContentPane().add(jp);
jta = new JTextArea();
jta.setColumns(20);//设置文本域的大小
jta.setEditable(false);//设置文本域不可编辑
jta.setBackground(jp.getBackground());//设置文本域的背景色和面板一样
getContentPane().add(jta);
jb.addActionListener(new ActionListener() {//给按钮添加事件
public void actionPerformed(ActionEvent e) {//点击按钮,显示信息到文本域
String name = jtf1.getText();
String number = jtf2.getText();
String clazz = jtf3.getText();
jta.setText("You name is " name " number is " number " class is " clazz);
}
});
}
public static void main(String[] args) {
new FrameDemo().setVisible(true);//创建窗口,被设置为可见
}
}
五: 拓展
虽然图形界面的实现方法是多样的,我们一定要根据具体情况, 选择一个比较优化的 合理的, 符合业务逻辑的实现方法
java用户查询界面代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java用户查询界面代码是什么、java用户查询界面代码的信息别忘了在本站进行查找喔 。

    推荐阅读