资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

java个人网站示例代码,java个人网站示例代码是什么

用java写一个手机商城注册界面代码

这篇文章主要介绍了java通过JFrame做一个登录系统的界面完整代码示例,具有一定借鉴价值,需要的朋友可以参考下。

成都创新互联公司主营呼兰网站建设的网络公司,主营网站建设方案,成都app开发,呼兰h5重庆小程序开发搭建,呼兰网站营销推广欢迎呼兰等地区企业咨询

在java的JFrame内通过创建匿名对象的方式做登录界面

package com.sxt;

import java.awt.Container;

import java.awt.GridLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JPasswordField;

import javax.swing.JTextField;

public class LoginFrame extends JFrame{

JTextField txtname=new JTextField();

JPasswordField txtpass=new JPasswordField();

JButton bl=new JButton("登录");

JButton bg=new JButton("关闭");

//构造无参构造器把主要的方法放在构造器里,然后在main方法里面调

public LoginFrame(){

setBounds(25,25,250,250);

Container c = getContentPane();

c.setLayout(new GridLayout(4,2,10,10));

c.add(new JLabel("用户名"));

c.add(txtname);

c.add(new JLabel("密码"));

c.add(txtpass);

c.add(bl);

c.add(bg);

setDefaultCloseOperation(EXIT_ON_CLOSE);

setVisible(true);

//注意:此处是匿名内部类

bg.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e) {

// TODO Auto-generated method stub

System.exit(0);

}

}

);

//注意:此处是匿名内部类

bl.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent e) {

基于JAVA的个人网站设计!

建议你用jsp技术

表示层用html或jsp(DreamWare开发)

控制层用servlet

模型层用javabean

数据库你可以随便选,建议用mysql

不是很难,我用的数据库时oracle

如果你需要例子

留下邮箱给我。

急需java编译的个人静态网页代码,用java基础、jsp等,谢谢大家了!

静态网页一般用Html ,css 等就完成了, 不需编译直接运行。jsp可以做动态网页

帮忙写下代码java swing,个人信息实例

本人急忙做的:有什么不合要求的请再告诉我:

package show;

import javax.swing.*;

import java.awt.*;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

public class Test extends JFrame implements ActionListener

{

GridBagLayout g=new GridBagLayout();

GridBagConstraints c=new GridBagConstraints();

Test(String str)

{

super(str);

setSize(300,500);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setLayout(g);

//调用方法

addComponent();

submit.addActionListener(this);

setVisible(true);

setLocationRelativeTo(null);//设居中显示;

}

//在这个方法中将会添加所有的组件;

//使用的网格包布局;希望楼主能看懂;

public void addComponent()

{

//个人信息登记

noteInformation=new JLabel("个人信息登记:");

add(g,c,noteInformation,0,0,1,1);

//用户名

userName=new JLabel("用户名:");

add(g,c,userName,0,1,1,1);

//用户名输入框

textUserName=new JTextField(10);

add(g,c,textUserName,1,1,2,1);

//密码:

password=new JLabel("密码:");

add(g,c,password,0,2,1,1);

//密码输入框

textUserPassword=new JTextField(10);

add(g,c,textUserPassword,1,2,2,1);

//性别

sex=new JLabel("性别:");

add(g,c,sex,0,3,1,1);

//男 女单选框

sexMan=new JRadioButton("男");

add(g,c,sexMan,1,3,1,1);

sexGirl=new JRadioButton("女");

add(g,c,sexGirl,2,3,1,1);

ButtonGroup group=new ButtonGroup();

group.add(sexMan);

group.add(sexGirl);

//出生日期

birthday=new JLabel("出生日期:");

add(g,c,birthday,0,4,1,1);

//复选框及其内容

String[] YEARS=new String[65];

for(int i=1950,k=0;i=2014;i++,k++)

{

YEARS[k]=i+"年";

}

year=new JComboBox(YEARS);

add(g,c,year,1,4,1,1);

//复选框及内容

month=new JComboBox(MONTH);

add(g,c,month,2,4,1,1);

//submit按钮

submit=new JButton("submit");

c.insets=new Insets(7,0,4,0);

add(g,c,submit,1,5,1,1);

result=new JTextArea(15,20);

add(g,c,result,0,6,3,4);

}

/* public void ActionPerformed(ActionEvent e)

{

String s=textUserName.getText();

String t=textUserPassword.getText();

String k=sexMan.getText();

String v=sexGirl.getText();

String a=(String) year.getSelectedItem();

String b=(String)month.getSelectedItem();

String num="用户名:"+s+"\n"+"密码: "+t+"性别: "+(k==null?v:k)+"\n"+"出生日期:"+a+" "+b;

result.append(num);

}*/

public void add(GridBagLayout g,GridBagConstraints c,JComponent jc,int x ,int y,int gw,int gh)

{

c.gridx=x;

c.gridy=y;

c.anchor=GridBagConstraints.WEST;

c.gridwidth=gw;

c.gridheight=gh;

g.setConstraints(jc,c);

add(jc);

}

public static void main(String args[])

{

new Test("个人信息登记表");

}

JLabel noteInformation,userName,password;

JLabel sex,birthday;

JTextField textUserName,textUserPassword;

JRadioButton sexMan,sexGirl;

JComboBox year,month;

JButton submit;

JTextArea result;

final String[] MONTH={"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};

@Override

public void actionPerformed(ActionEvent arg0)

{

String s=textUserName.getText();

String t=textUserPassword.getText();

String k=sexMan.getText();

String v=sexGirl.getText();

String a=(String) year.getSelectedItem();

String b=(String)month.getSelectedItem();

String num="用户名:"+s+"\n"+"密码: "+t+"\n 性别: "+(k==null?v:k)+"\n"+"出生日期:"+a+" "+b;

result.setText(num);

}

}

java代码示例

importjava.awt.*;importjava.awt.event.*;classShopFrameextendsFrameimplementsActionListener{Labellabel1,label2,label3,label4;Buttonbutton1,button2,button3,button4,button5;TextAreatext;Panelpanel1,panel2;staticfloatsum=0.0f;ShopFrame(Strings){super(s);setLayout(newBorderLayout());label1=newLabel("面纸:3元",Label.LEFT);label2=newLabel("钢笔:5元",Label.LEFT);label3=newLabel("书:10元",Label.LEFT);label4=newLabel("袜子:8元",Label.LEFT);button1=newButton("加入购物车");button2=newButton("加入购物车");button3=newButton("加入购物车");button4=newButton("加入购物车");button5=newButton("查看购物车");text=newTextArea("商品有:"+"\n",5,10);text.setEditable(false);addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){System.exit(0);}});button1.addActionListener(this);button2.addActionListener(this);button3.addActionListener(this);button4.addActionListener(this);button5.addActionListener(this);panel1=newPanel();panel2=newPanel();panel1.add(label1);panel1.add(button1);panel1.add(label2);panel1.add(button2);panel1.add(label3);panel1.add(button3);panel1.add(label4);panel1.add(button4);panel2.setLayout(newBorderLayout());panel2.add(button5,BorderLayout.NORTH);panel2.add(text,BorderLayout.SOUTH);this.add(panel1,BorderLayout.CENTER);this.add(panel2,BorderLayout.SOUTH);setBounds(100,100,350,250);setVisible(true);validate();}publicvoidactionPerformed(ActionEvente){if(e.getSource()==button1){text.append("一个面纸、");sum=sum+3;}elseif(e.getSource()==button2){text.append("一只钢笔、");sum=sum+5;}elseif(e.getSource()==button3){text.append("一本书、");sum=sum+10;}elseif(e.getSource()==button4){text.append("一双袜子、");sum=sum+8;}elseif(e.getSource()==button5){text.append("\n"+"总价为:"+"\n"+sum);}}}publicclassShopping{publicstaticvoidmain(String[]args){newShopFrame("购物车");}}我没用Swing可能显示不出来你的效果。不满意得话我在给你编一个。

简单个人简历java录入程序 代码

我帮你写了那些JAVA代码了,效果包你满意!呵呵……

至于网页的代码嘛,这里就不贴了。你要的话HI我吧^_^。

JAVA代码如下:

import java.awt.BorderLayout;

import javax.swing.*;

import java.awt.Dimension;

import java.awt.Rectangle;

public class MyLuRu extends JFrame {

private static final long serialVersionUID = 1L;

private JPanel jContentPane = null;

private JLabel jLabel = null;

private JLabel jLabel1 = null;

private JLabel jLabel2 = null;

private JLabel jLabel3 = null;

private JTextField jTextField = null;

private JRadioButton jRadioButton = null;

private JRadioButton jRadioButton1 = null;

private JComboBox jComboBox = null;

private JComboBox jComboBox1 = null;

private JButton jButton = null;

private JButton jButton1 = null;

private JTextArea jTextArea = null;

private ButtonGroup mybg=new ButtonGroup();

/**

* This is the default constructor

*/

public MyLuRu() {

super();

initialize();

}

/**

* This method initializes this

*

* @return void

*/

private void initialize() {

this.setSize(268, 407);

this.setContentPane(getJContentPane());

this.setTitle("录入");

this.addWindowListener(new java.awt.event.WindowAdapter() {

public void windowClosing(java.awt.event.WindowEvent e) {

System.exit(0);

}

});

this.setVisible(true);

}

/**

* This method initializes jContentPane

*

* @return javax.swing.JPanel

*/

private JPanel getJContentPane() {

if (jContentPane == null) {

jLabel3 = new JLabel();

jLabel3.setBounds(new Rectangle(16, 150, 65, 18));

jLabel3.setText("文化程度:");

jLabel2 = new JLabel();

jLabel2.setBounds(new Rectangle(16, 108, 39, 18));

jLabel2.setText("专业:");

jLabel1 = new JLabel();

jLabel1.setBounds(new Rectangle(16, 66, 39, 18));

jLabel1.setText("性别:");

jLabel = new JLabel();

jLabel.setBounds(new Rectangle(16, 24, 39, 18));

jLabel.setText("姓名:");

jContentPane = new JPanel();

jContentPane.setLayout(null);

jContentPane.add(jLabel, null);

jContentPane.add(jLabel1, null);

jContentPane.add(jLabel2, null);

jContentPane.add(jLabel3, null);

jContentPane.add(getJTextField(), null);

jContentPane.add(getJRadioButton(), null);

jContentPane.add(getJRadioButton1(), null);

mybg.add(jRadioButton);

mybg.add(jRadioButton1);

jContentPane.add(getJComboBox(), null);

jContentPane.add(getJComboBox1(), null);

jContentPane.add(getJButton(), null);

jContentPane.add(getJButton1(), null);

jContentPane.add(getJTextArea(), null);

}

return jContentPane;

}

/**

* This method initializes jTextField

*

* @return javax.swing.JTextField

*/

private JTextField getJTextField() {

if (jTextField == null) {

jTextField = new JTextField();

jTextField.setBounds(new Rectangle(61, 24, 180, 18));

}

return jTextField;

}

/**

* This method initializes jRadioButton

*

* @return javax.swing.JRadioButton

*/

private JRadioButton getJRadioButton() {

if (jRadioButton == null) {

jRadioButton = new JRadioButton();

jRadioButton.setBounds(new Rectangle(61, 62, 38, 26));

jRadioButton.setText("男");

}

return jRadioButton;

}

/**

* This method initializes jRadioButton1

*

* @return javax.swing.JRadioButton

*/

private JRadioButton getJRadioButton1() {

if (jRadioButton1 == null) {

jRadioButton1 = new JRadioButton();

jRadioButton1.setBounds(new Rectangle(117, 62, 38, 26));

jRadioButton1.setText("女");

}

return jRadioButton1;

}

/**

* This method initializes jComboBox

*

* @return javax.swing.JComboBox

*/

private JComboBox getJComboBox() {

if (jComboBox == null) {

String[] strcb={"计算机","电子","工商"};

jComboBox = new JComboBox(strcb);

jComboBox.setBounds(new Rectangle(62, 108, 93, 18));

}

return jComboBox;

}

/**

* This method initializes jComboBox1

*

* @return javax.swing.JComboBox

*/

private JComboBox getJComboBox1() {

if (jComboBox1 == null) {

String[] strcb2={"大专","本科","硕士","博士"};

jComboBox1 = new JComboBox(strcb2);

jComboBox1.setBounds(new Rectangle(92, 150, 125, 18));

}

return jComboBox1;

}

/**

* This method initializes jButton

*

* @return javax.swing.JButton

*/

private JButton getJButton() {

if (jButton == null) {

jButton = new JButton();

jButton.setBounds(new Rectangle(66, 181, 60, 28));

jButton.setText("提交");

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

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

String strname=jTextField.getText();

String strsex="男";

if(jRadioButton1.isSelected()){

strsex="女";

}

String strzy=jComboBox.getSelectedItem().toString();

String strwh=jComboBox1.getSelectedItem().toString();

jTextArea.setText("姓名:"+strname+"\r\n"+"性别:"+strsex+"\r\n"+"专业:"+strzy+"\r\n"+"文化:"+strwh);

}

});

}

return jButton;

}

/**

* This method initializes jButton1

*

* @return javax.swing.JButton

*/

private JButton getJButton1() {

if (jButton1 == null) {

jButton1 = new JButton();

jButton1.setBounds(new Rectangle(158, 181, 60, 28));

jButton1.setText("取消");

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

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

System.exit(0);

}

});

}

return jButton1;

}

/**

* This method initializes jTextArea

*

* @return javax.swing.JTextArea

*/

private JTextArea getJTextArea() {

if (jTextArea == null) {

jTextArea = new JTextArea();

jTextArea.setBounds(new Rectangle(16, 225, 229, 130));

}

return jTextArea;

}

public static void main(String args[]){

new MyLuRu();

}

}

效果如下图:


新闻名称:java个人网站示例代码,java个人网站示例代码是什么
网页网址:http://cdkjz.cn/article/hsoipi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220