急!!哪位高手帮忙编一个Java AWT的程序?程序的样子如图,请帮忙看一下啊。23号之前要。
哪位高手可以帮我编一个如图所示的JavaAWT的程序?我是公共选修选的这个,不是计算机系的,好难哦。这个作业时期末成绩,快来帮我看看吧!!23号就要交实验报告了,大家快来...
哪位高手可以帮我编一个如图所示的Java AWT的程序?我是公共选修选的这个,不是计算机系的,好难哦。这个作业时期末成绩,快来帮我看看吧!!23号就要交实验报告了,大家快来给我看看。
展开
4个回答
展开全部
给你做完了,你运行后跟你给的画面是一样的,但只做了界面,因为不知道你要是实现什么功能,如果还有问题就联系我吧 QQ249077091
public class UserInfo extends JPanel{
JFrame jFrame;
/**
* @param args
*/
JLabel jl_login;
JLabel jl_add;
JLabel jl_find;
JLabel jl_del;
JLabel jl_update;
JLabel jl_exit;
JLabel jl_userId;
JTextField jtf_userId;
JLabel jl_username;
JTextField jtf_username;
JLabel jl_sex;
ButtonGroup bg;
JRadioButton jrb_man;
JRadioButton jrb_women;
JLabel jl_birdthday;
JTextField jtf_birdthday;
JLabel jl_married;
JCheckBox jcb_married;
JLabel jl_province;
JComboBox jcb_province=new JComboBox();
JLabel jl_address;
JTextField jtf_address;
JLabel jl_resume;
JTextArea jta_resume;
JButton jb_next;
JButton jb_previous;
JButton jb_first;
JButton jb_last;
public UserInfo(JFrame jFrame){
//self=this;
this.jFrame=jFrame;
init();
jFrame.setSize(600,665);
jFrame.setTitle("用户信息录入窗口");
this.setLayout(null);
//this.setBackground(new Color(212,208,200));
//jFrame.setBackground(new Color(212,208,200));
jFrame.add(this);
jFrame.setLocation((int)((Toolkit.getDefaultToolkit().getScreenSize().getWidth()-jFrame.getWidth())/2),
(int)((Toolkit.getDefaultToolkit().getScreenSize().getHeight()-jFrame.getHeight())/2));
jFrame.repaint();
jFrame.setVisible(true);
}
void init(){
JPanel jp=new JPanel();
jp.setLayout(null);
jp.setBounds(new Rectangle(20,5,500,600));
jl_login = new JLabel("登录");
jl_login.setBounds(new Rectangle(10,10,70,20));
jp.add(jl_login);
jl_add = new JLabel("添加");
jl_add.setBounds(new Rectangle(90,10,70,20));
jp.add(jl_add);
jl_find = new JLabel("查询");
jl_find.setBounds(new Rectangle(170,10,70,20));
jp.add(jl_find);
jl_del=new JLabel("删除");
jl_del.setBounds(new Rectangle(250,10,70,20));
jp.add(jl_del);
jl_update=new JLabel("更新");
jl_update.setBounds(new Rectangle(340,10,70,20));
jp.add(jl_update);
jl_exit=new JLabel("退出");
jl_exit.setBounds(new Rectangle(420,10,70,20));
jp.add(jl_exit);
jl_userId = new JLabel("编 号");
jl_userId.setBounds(new Rectangle(10,40,40,20));
jp.add(jl_userId);
jtf_userId=new JTextField();
jtf_userId.setBounds(new Rectangle(60,40,200,20));
jp.add(jtf_userId);
jl_username=new JLabel("姓 名");
jl_username.setBounds(new Rectangle(10,80,40,20));
jp.add(jl_username);
jtf_username=new JTextField();
jtf_username.setBounds(new Rectangle(60,80,200,20));
jp.add(jtf_username);
jl_sex=new JLabel("性 别");
jl_sex.setBounds(new Rectangle(10,120,40,20));
jp.add(jl_sex);
jrb_man=new JRadioButton("男");
jrb_man.setBounds(new Rectangle(60,120,50,20));
jrb_women=new JRadioButton("女");
jrb_women.setBounds(new Rectangle(120,120,50,20));
ButtonGroup bg =new ButtonGroup();
bg.add(jrb_man);
bg.add(jrb_women);
jp.add(jrb_man);
jp.add(jrb_women);
jl_married=new JLabel("婚 否");
jl_married.setBounds(new Rectangle(10,160,40,20));
jp.add(jl_married);
jcb_married=new JCheckBox();
jcb_married.setBounds(new Rectangle(60,160,40,20));
jp.add(jcb_married);
jl_province=new JLabel("籍 贯");
jl_province.setBounds(new Rectangle(10,200,40,20));
jp.add(jl_province);
jcb_province.setBounds(new Rectangle(60,200,60,20));
jcb_province.addItem("北京");
jcb_province.addItem("上海");
jcb_province.addItem("兰州");
jcb_province.addItem("宁夏");
jp.add(jcb_province);
jl_address=new JLabel("住 址");
jl_address.setBounds(new Rectangle(10,240,40,20));
jp.add(jl_address);
jtf_address=new JTextField();
jtf_address.setBounds(new Rectangle(60,240,400,20));
jp.add(jtf_address);
jl_resume=new JLabel("简 历");
jl_resume.setBounds(new Rectangle(10,280,40,20));
jp.add(jl_resume);
jta_resume=new JTextArea();
jta_resume.setBounds(new Rectangle(60,280,400,150));
jp.add(jta_resume);
jb_next=new JButton("下一条");
jb_next.setBounds(new Rectangle(60,450,80,20));
jp.add(jb_next);
jb_previous=new JButton("上一条");
jb_previous.setBounds(new Rectangle(150,450,80,20));
jp.add(jb_previous);
jb_first=new JButton("第一条");
jb_first.setBounds(new Rectangle(240,450,80,20));
jp.add(jb_first);
jb_last=new JButton("末一条");
jb_last.setBounds(new Rectangle(330,450,80,20));
jp.add(jb_last);
add(jp);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
UserInfo userInfo=new UserInfo(new JFrame());
}
}
public class UserInfo extends JPanel{
JFrame jFrame;
/**
* @param args
*/
JLabel jl_login;
JLabel jl_add;
JLabel jl_find;
JLabel jl_del;
JLabel jl_update;
JLabel jl_exit;
JLabel jl_userId;
JTextField jtf_userId;
JLabel jl_username;
JTextField jtf_username;
JLabel jl_sex;
ButtonGroup bg;
JRadioButton jrb_man;
JRadioButton jrb_women;
JLabel jl_birdthday;
JTextField jtf_birdthday;
JLabel jl_married;
JCheckBox jcb_married;
JLabel jl_province;
JComboBox jcb_province=new JComboBox();
JLabel jl_address;
JTextField jtf_address;
JLabel jl_resume;
JTextArea jta_resume;
JButton jb_next;
JButton jb_previous;
JButton jb_first;
JButton jb_last;
public UserInfo(JFrame jFrame){
//self=this;
this.jFrame=jFrame;
init();
jFrame.setSize(600,665);
jFrame.setTitle("用户信息录入窗口");
this.setLayout(null);
//this.setBackground(new Color(212,208,200));
//jFrame.setBackground(new Color(212,208,200));
jFrame.add(this);
jFrame.setLocation((int)((Toolkit.getDefaultToolkit().getScreenSize().getWidth()-jFrame.getWidth())/2),
(int)((Toolkit.getDefaultToolkit().getScreenSize().getHeight()-jFrame.getHeight())/2));
jFrame.repaint();
jFrame.setVisible(true);
}
void init(){
JPanel jp=new JPanel();
jp.setLayout(null);
jp.setBounds(new Rectangle(20,5,500,600));
jl_login = new JLabel("登录");
jl_login.setBounds(new Rectangle(10,10,70,20));
jp.add(jl_login);
jl_add = new JLabel("添加");
jl_add.setBounds(new Rectangle(90,10,70,20));
jp.add(jl_add);
jl_find = new JLabel("查询");
jl_find.setBounds(new Rectangle(170,10,70,20));
jp.add(jl_find);
jl_del=new JLabel("删除");
jl_del.setBounds(new Rectangle(250,10,70,20));
jp.add(jl_del);
jl_update=new JLabel("更新");
jl_update.setBounds(new Rectangle(340,10,70,20));
jp.add(jl_update);
jl_exit=new JLabel("退出");
jl_exit.setBounds(new Rectangle(420,10,70,20));
jp.add(jl_exit);
jl_userId = new JLabel("编 号");
jl_userId.setBounds(new Rectangle(10,40,40,20));
jp.add(jl_userId);
jtf_userId=new JTextField();
jtf_userId.setBounds(new Rectangle(60,40,200,20));
jp.add(jtf_userId);
jl_username=new JLabel("姓 名");
jl_username.setBounds(new Rectangle(10,80,40,20));
jp.add(jl_username);
jtf_username=new JTextField();
jtf_username.setBounds(new Rectangle(60,80,200,20));
jp.add(jtf_username);
jl_sex=new JLabel("性 别");
jl_sex.setBounds(new Rectangle(10,120,40,20));
jp.add(jl_sex);
jrb_man=new JRadioButton("男");
jrb_man.setBounds(new Rectangle(60,120,50,20));
jrb_women=new JRadioButton("女");
jrb_women.setBounds(new Rectangle(120,120,50,20));
ButtonGroup bg =new ButtonGroup();
bg.add(jrb_man);
bg.add(jrb_women);
jp.add(jrb_man);
jp.add(jrb_women);
jl_married=new JLabel("婚 否");
jl_married.setBounds(new Rectangle(10,160,40,20));
jp.add(jl_married);
jcb_married=new JCheckBox();
jcb_married.setBounds(new Rectangle(60,160,40,20));
jp.add(jcb_married);
jl_province=new JLabel("籍 贯");
jl_province.setBounds(new Rectangle(10,200,40,20));
jp.add(jl_province);
jcb_province.setBounds(new Rectangle(60,200,60,20));
jcb_province.addItem("北京");
jcb_province.addItem("上海");
jcb_province.addItem("兰州");
jcb_province.addItem("宁夏");
jp.add(jcb_province);
jl_address=new JLabel("住 址");
jl_address.setBounds(new Rectangle(10,240,40,20));
jp.add(jl_address);
jtf_address=new JTextField();
jtf_address.setBounds(new Rectangle(60,240,400,20));
jp.add(jtf_address);
jl_resume=new JLabel("简 历");
jl_resume.setBounds(new Rectangle(10,280,40,20));
jp.add(jl_resume);
jta_resume=new JTextArea();
jta_resume.setBounds(new Rectangle(60,280,400,150));
jp.add(jta_resume);
jb_next=new JButton("下一条");
jb_next.setBounds(new Rectangle(60,450,80,20));
jp.add(jb_next);
jb_previous=new JButton("上一条");
jb_previous.setBounds(new Rectangle(150,450,80,20));
jp.add(jb_previous);
jb_first=new JButton("第一条");
jb_first.setBounds(new Rectangle(240,450,80,20));
jp.add(jb_first);
jb_last=new JButton("末一条");
jb_last.setBounds(new Rectangle(330,450,80,20));
jp.add(jb_last);
add(jp);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
UserInfo userInfo=new UserInfo(new JFrame());
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class User extends JFrame{
private JButton log=new JButton("登录");
private JButton insert=new JButton("添加");
private JButton select=new JButton("查询");
private JButton delete=new JButton("删除");
private JButton update=new JButton("更新");
private JButton out=new JButton("退出");
private JLabel idl=new JLabel("编号");
private JLabel namel=new JLabel("姓名");
private JLabel sexl=new JLabel("姓别");
private JLabel datel=new JLabel("生日");
private JLabel marryl=new JLabel("婚否");
private JLabel provincel=new JLabel("籍贯");
private JLabel addressl=new JLabel("住址");
private JLabel resumel=new JLabel("简历");
private JTextField id=new JTextField(20);
private JTextField name=new JTextField(20);
private ButtonGroup bg =new ButtonGroup();
private JRadioButton m=new JRadioButton("男");
private JRadioButton f=new JRadioButton("女");
private JTextField date=new JTextField(20);
private JCheckBox marry=new JCheckBox();
private JComboBox province=new JComboBox();
private JTextField address=new JTextField(40);
private JTextArea resume=new JTextArea();
private JButton next=new JButton("下一条");
private JButton pre=new JButton("上一条");
private JButton first=new JButton("第一条");
private JButton last=new JButton("末一条");
public User(){
super("客户信息录入窗口");
setBackground(Color.lightGray);
bg.add(m); bg.add(f);
province.addItem("北京");
province.addItem("上海");
province.addItem("西安");
province.addItem("陕西");
setup();
setDefaultCloseOperation(EXIT_ON_CLOSE ) ;
//pack();
setBounds(150,150,500,700); //改这里可以修改窗口大小
setVisible(true);
}
private void setup(){
JPanel menup=new JPanel();
menup.setLayout(new FlowLayout(FlowLayout.LEFT));
menup.add(log); menup.add(insert);menup.add(select);
menup.add(delete);menup.add(update);menup.add(out);
JPanel idp=new JPanel();
idp.setLayout(new FlowLayout(FlowLayout.LEFT));
idp.add(idl);idp.add(id);
JPanel namep=new JPanel();
namep.setLayout(new FlowLayout(FlowLayout.LEFT));
namep.add(namel);namep.add(name);
JPanel sexp=new JPanel();
sexp.setLayout(new FlowLayout(FlowLayout.LEFT));
sexp.add(sexl);
sexp.add(f); sexp.add(m);
JPanel datep=new JPanel();
datep.setLayout(new FlowLayout(FlowLayout.LEFT));
datep.add(datel);datep.add(date);
JPanel marryp=new JPanel();
marryp.setLayout(new FlowLayout(FlowLayout.LEFT));
marryp.add(marryl);marryp.add(marry);
JPanel addressp=new JPanel();
addressp.setLayout(new FlowLayout(FlowLayout.LEFT));
addressp.add(addressl);addressp.add(address);
JPanel resumep=new JPanel();
resumep.setLayout(new BorderLayout());
resumep.add("West",resumel);resumep.add("Center",resume);
JPanel provincep=new JPanel();
provincep.setLayout(new FlowLayout(FlowLayout.LEFT));
provincep.add(provincel);provincep.add(province);
JPanel buttonp=new JPanel();
buttonp.setLayout(new FlowLayout(FlowLayout.CENTER));
buttonp.add(next);
buttonp.add(pre);
buttonp.add(first);
buttonp.add(last);
JPanel top=new JPanel();
top.setLayout(new GridLayout(8,1));
top.add(menup);
top.add(idp);
top.add(namep);
top.add(sexp);
top.add(datep);
top.add(marryp);
top.add(provincep);
top.add(addressp);
Container c=getContentPane();
c.setLayout(new BorderLayout());
c.add(top,BorderLayout.NORTH);
c.add(resumep,BorderLayout.CENTER);
c.add(buttonp,BorderLayout.SOUTH);
}
public static void main(String args[]){
new User();
}
}
你们应该用不着加功能的,因为加功能肯定要涉及到数据库或文件操作
那就更复杂了,今天是最后一天,刚好吧。
import java.awt.event.*;
import javax.swing.*;
public class User extends JFrame{
private JButton log=new JButton("登录");
private JButton insert=new JButton("添加");
private JButton select=new JButton("查询");
private JButton delete=new JButton("删除");
private JButton update=new JButton("更新");
private JButton out=new JButton("退出");
private JLabel idl=new JLabel("编号");
private JLabel namel=new JLabel("姓名");
private JLabel sexl=new JLabel("姓别");
private JLabel datel=new JLabel("生日");
private JLabel marryl=new JLabel("婚否");
private JLabel provincel=new JLabel("籍贯");
private JLabel addressl=new JLabel("住址");
private JLabel resumel=new JLabel("简历");
private JTextField id=new JTextField(20);
private JTextField name=new JTextField(20);
private ButtonGroup bg =new ButtonGroup();
private JRadioButton m=new JRadioButton("男");
private JRadioButton f=new JRadioButton("女");
private JTextField date=new JTextField(20);
private JCheckBox marry=new JCheckBox();
private JComboBox province=new JComboBox();
private JTextField address=new JTextField(40);
private JTextArea resume=new JTextArea();
private JButton next=new JButton("下一条");
private JButton pre=new JButton("上一条");
private JButton first=new JButton("第一条");
private JButton last=new JButton("末一条");
public User(){
super("客户信息录入窗口");
setBackground(Color.lightGray);
bg.add(m); bg.add(f);
province.addItem("北京");
province.addItem("上海");
province.addItem("西安");
province.addItem("陕西");
setup();
setDefaultCloseOperation(EXIT_ON_CLOSE ) ;
//pack();
setBounds(150,150,500,700); //改这里可以修改窗口大小
setVisible(true);
}
private void setup(){
JPanel menup=new JPanel();
menup.setLayout(new FlowLayout(FlowLayout.LEFT));
menup.add(log); menup.add(insert);menup.add(select);
menup.add(delete);menup.add(update);menup.add(out);
JPanel idp=new JPanel();
idp.setLayout(new FlowLayout(FlowLayout.LEFT));
idp.add(idl);idp.add(id);
JPanel namep=new JPanel();
namep.setLayout(new FlowLayout(FlowLayout.LEFT));
namep.add(namel);namep.add(name);
JPanel sexp=new JPanel();
sexp.setLayout(new FlowLayout(FlowLayout.LEFT));
sexp.add(sexl);
sexp.add(f); sexp.add(m);
JPanel datep=new JPanel();
datep.setLayout(new FlowLayout(FlowLayout.LEFT));
datep.add(datel);datep.add(date);
JPanel marryp=new JPanel();
marryp.setLayout(new FlowLayout(FlowLayout.LEFT));
marryp.add(marryl);marryp.add(marry);
JPanel addressp=new JPanel();
addressp.setLayout(new FlowLayout(FlowLayout.LEFT));
addressp.add(addressl);addressp.add(address);
JPanel resumep=new JPanel();
resumep.setLayout(new BorderLayout());
resumep.add("West",resumel);resumep.add("Center",resume);
JPanel provincep=new JPanel();
provincep.setLayout(new FlowLayout(FlowLayout.LEFT));
provincep.add(provincel);provincep.add(province);
JPanel buttonp=new JPanel();
buttonp.setLayout(new FlowLayout(FlowLayout.CENTER));
buttonp.add(next);
buttonp.add(pre);
buttonp.add(first);
buttonp.add(last);
JPanel top=new JPanel();
top.setLayout(new GridLayout(8,1));
top.add(menup);
top.add(idp);
top.add(namep);
top.add(sexp);
top.add(datep);
top.add(marryp);
top.add(provincep);
top.add(addressp);
Container c=getContentPane();
c.setLayout(new BorderLayout());
c.add(top,BorderLayout.NORTH);
c.add(resumep,BorderLayout.CENTER);
c.add(buttonp,BorderLayout.SOUTH);
}
public static void main(String args[]){
new User();
}
}
你们应该用不着加功能的,因为加功能肯定要涉及到数据库或文件操作
那就更复杂了,今天是最后一天,刚好吧。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
2
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询