资讯

精准传达 • 有效沟通

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

java在线留言代码,java实现留言功能

JAVA高手帮忙写3段代码,急……………………

第一个问题:

创新互联建站服务项目包括东营网站建设、东营网站制作、东营网页制作以及东营网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,东营网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到东营省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!

我建议你不要用工具,最好用手写代码,然后javac java 编译运行,你就能清楚了,

第二个,有难度哦,要是你可以,你可以直接重写Object类,(注:是在JDK里面重写Object类,),在Object的构造方法里面用一个静态变量去记录实例化Object的次数。

因为所有类都继承自Object,所以,你就需要监控Object的实例化次数,就OK了,

第三个问题,和第一个问题一样的。

急急急!java简单留言板

您好。我重新地帮你写了代码,完全地符合了你的图片中的界面要求、功能要求。代码如下:(解决了问题,记得给我分哦~^_^呵呵……)

import java.awt.BorderLayout;

import javax.swing.JPanel;

import javax.swing.JFrame;

import java.awt.Rectangle;

import javax.swing.JLabel;

import javax.swing.SwingConstants;

import java.awt.Font;

import javax.swing.JTextArea;

import javax.swing.JScrollBar;

import javax.swing.JScrollPane;

import javax.swing.JComboBox;

import javax.swing.JTextField;

import javax.swing.JButton;

public class Liuyb extends JFrame {

private static final long serialVersionUID = 1L;

private JPanel jContentPane = null;

private JLabel jLabel = null;

private JTextArea jTextArea = null;

private JScrollPane jScrollPane = null;

private JLabel jLabel1 = null;

private JComboBox jComboBox = null;

private JLabel jLabel2 = null;

private JTextField jTextField = null;

private JButton jButton = null;

private JButton jButton1 = null;

private JButton jButton2 = null;

private JButton jButton3 = null;

/**

* This is the default constructor

*/

public Liuyb() {

super();

initialize();

}

/**

* This method initializes this

*

* @return void

*/

private void initialize() {

this.setContentPane(getJContentPane());

this.setTitle("留言板程序");

this.setBounds(new Rectangle(0, 0, 640, 480));

this.setVisible(true);

}

/**

* This method initializes jContentPane

*

* @return javax.swing.JPanel

*/

private JPanel getJContentPane() {

if (jContentPane == null) {

jLabel2 = new JLabel();

jLabel2.setBounds(new Rectangle(214, 407, 45, 24));

jLabel2.setFont(new Font("Dialog", Font.BOLD, 14));

jLabel2.setText("地说:");

jLabel1 = new JLabel();

jLabel1.setBounds(new Rectangle(32, 407, 15, 24));

jLabel1.setFont(new Font("Dialog", Font.BOLD, 14));

jLabel1.setText("你");

jLabel = new JLabel();

jLabel.setBounds(new Rectangle(283, 15, 45, 20));

jLabel.setHorizontalAlignment(SwingConstants.CENTER);

jLabel.setFont(new Font("Dialog", Font.BOLD, 14));

jLabel.setText("留言板");

jContentPane = new JPanel();

jContentPane.setLayout(null);

jContentPane.add(jLabel, null);

jContentPane.add(getJScrollPane(), null);

jContentPane.add(jLabel1, null);

jContentPane.add(getJComboBox(), null);

jContentPane.add(jLabel2, null);

jContentPane.add(getJTextField(), null);

jContentPane.add(getJButton(), null);

jContentPane.add(getJButton1(), null);

jContentPane.add(getJButton2(), null);

jContentPane.add(getJButton3(), null);

}

return jContentPane;

}

/**

* This method initializes jTextArea

*

* @return javax.swing.JTextArea

*/

private JTextArea getJTextArea() {

if (jTextArea == null) {

jTextArea = new JTextArea();

jTextArea.setText("留言内容:");

jTextArea.setEditable(false);

}

return jTextArea;

}

/**

* This method initializes jScrollPane

*

* @return javax.swing.JScrollPane

*/

private JScrollPane getJScrollPane() {

if (jScrollPane == null) {

jScrollPane = new JScrollPane();

jScrollPane.setBounds(new Rectangle(22, 49, 534, 347));

jScrollPane.setViewportView(getJTextArea());

}

return jScrollPane;

}

/**

* This method initializes jComboBox

*

* @return javax.swing.JComboBox

*/

private JComboBox getJComboBox() {

if (jComboBox == null) {

jComboBox = new JComboBox();

jComboBox.setBounds(new Rectangle(54, 407, 149, 24));

String[] mycbox={"微笑","大笑","痛苦"};

jComboBox.addItem(mycbox[0]);

jComboBox.addItem(mycbox[1]);

jComboBox.addItem(mycbox[2]);

}

return jComboBox;

}

/**

* This method initializes jTextField

*

* @return javax.swing.JTextField

*/

private JTextField getJTextField() {

if (jTextField == null) {

jTextField = new JTextField();

jTextField.setBounds(new Rectangle(265, 407, 231, 24));

}

return jTextField;

}

/**

* This method initializes jButton

*

* @return javax.swing.JButton

*/

private JButton getJButton() {

if (jButton == null) {

jButton = new JButton();

jButton.setBounds(new Rectangle(505, 407, 70, 24));

jButton.setText("提交");

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

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

jTextArea.setText(jTextArea.getText()+"\r\n"+"你"+jComboBox.getSelectedItem().toString()+"地说:"+jTextField.getText());

}

});

}

return jButton;

}

/**

* This method initializes jButton1

*

* @return javax.swing.JButton

*/

private JButton getJButton1() {

if (jButton1 == null) {

jButton1 = new JButton();

jButton1.setBounds(new Rectangle(565, 51, 60, 32));

jButton1.setText("清屏");

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

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

jTextArea.setText("留言内容:");

}

});

}

return jButton1;

}

/**

* This method initializes jButton2

*

* @return javax.swing.JButton

*/

private JButton getJButton2() {

if (jButton2 == null) {

jButton2 = new JButton();

jButton2.setBounds(new Rectangle(565, 112, 60, 32));

jButton2.setText("置顶");

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

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

jTextArea.setCaretPosition(0);

}

});

}

return jButton2;

}

/**

* This method initializes jButton3

*

* @return javax.swing.JButton

*/

private JButton getJButton3() {

if (jButton3 == null) {

jButton3 = new JButton();

jButton3.setBounds(new Rectangle(565, 173, 60, 32));

jButton3.setText("至尾");

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

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

jTextArea.setCaretPosition((int)jTextArea.getText().length());

}

});

}

return jButton3;

}

public static void main(String args[]){

new Liuyb();

}

}

java南华汽车网的留言代码,但是显示不出来

在你确定class类存在的情况下,首先确定代码中是否写入了main方法,其次确定是否有System.out.print()来输出结果

如果是class类存在确定存在,但是还是找不到class类,先使用命令CD (例如 cd d: 进入d盘)来进入和class文件相同的文件目录,然后再使用命令行来解析class文件

急求这个十分简单的JAVA小代码详细注释!!

几年没有碰swing了,给你详细注释了。仔细看。希望对你有所帮助。

import java.awt.*;//java抽象窗口工具包

import java.awt.event.*;//java抽象窗口工具包组件所激发的各类事件的接口和类

public class Test5{//类名

Frame f;//定义一个Frame窗体

TextArea center;//文本域

Label la1,la2,la3;//三个标签

Panel east,south,north;//三块面板

Button b1,b2,b3,b4;//四个按钮

Choice l1;//下拉单选框

TextField t1;//文本域

// textfield只有一行可写

// textarea是一个区域,可以有很多行

public static void main(String[] args){//主函数,程序入口

Test mb = new Test();

mb.go();//调用go方法,初始化界面

}

private void go(){

f = new Frame("留言版程序");//标题

f.addWindowListener(new WindowAdapter(){

public void windowClosing(WindowEvent evt){

f.setVisible(false);

System.exit(0);

//System.exit(0) 0--正常结束程序 1--异常关闭程序

}

});

f.setBounds(0,0,600,400);//布局大小

f.setLayout(new BorderLayout());//显示方式

f.setResizable(false);

//下面都将控件按钮初始化,你懂得

north = new Panel();

south = new Panel();

east = new Panel();

center = new TextArea("留言内容:");

center.setEditable(false);

b1 = new Button("清屏");

b2 = new Button("至顶");

b3 = new Button("至尾");

la1 = new Label("留言版");

la2 = new Label("你");

la3 = new Label(" 地说:");

t1 = new TextField(20);

b4 = new Button("提交");

l1 =new Choice();

l1.add("微笑 ");

l1.add("生气 ");

l1.add("伤心 ");

f.add(BorderLayout.NORTH,north);//布局

f.add(BorderLayout.SOUTH,south);//布局

f.add(BorderLayout.EAST,east);//布局

f.add(BorderLayout.CENTER,center);//布局

north.add(BorderLayout.CENTER,la1);

south.add(la2);//把东西加到面板上

south.add(l1);

south.add(la3);

south.add(t1);//把东西加到面板上

south.add(b4);

east.setLayout(new GridLayout(9,0,1,10));

east.add(b1);

east.add(b2);

east.add(b3);

f.setVisible(true);//可视化

b4.addActionListener(new ActionListener(){//点击提交按钮产生事件

public void actionPerformed(ActionEvent e){

String text1,text2;

text1 = l1.getSelectedItem();

text2 = t1.getText();

t1.setText(null);

if(t1.getText() != ""){//将下拉单选框的内容和你输入在文本框的内容显示在中间面板上

center.append("\n");

center.append(text1);

center.append(text2);

}

}

});

b1.addActionListener(new ActionListener(){//清屏按钮事件,只留下中间面板显示:“留言内容:”,其余清楚

public void actionPerformed(ActionEvent e){

center.setText("留言内容:");

}

});

b2.addActionListener(new ActionListener(){//至顶按钮事件,光标焦点至顶

public void actionPerformed(ActionEvent e){

center.requestFocusInWindow();

center.setCaretPosition(8);

}

});

b3.addActionListener(new ActionListener(){//至尾按钮事件,光标焦点至尾

public void actionPerformed(ActionEvent e){

center.requestFocusInWindow();

center.setCaretPosition(center.getText().length());

}

});

}

}

程序员的表白代码

程序员的表白代码

第一条语言:Java代码翻译:直到死之前,每天爱你多一点代码:while(lifeend){love++;}

第二条语言:C语言代码翻译:IcannotsayHellototheWorldwithoutu.代码:#incldestdio.hintmain(){printf(HelloWorldn);retrn0;}//IcannotsayHellototheWorldwithoutu.

第三条语言:python代码翻译:山无陵,江水为竭,冬雷震震,夏雨雪,天地合,乃敢与君绝!代码:if(mountain.arris==None):if(river.water==None):if(winter.thunder==True):if(summer.snow==True):if(sky.height==ground.height):i.withyou=Falseelse:i.withyou=True.

第四条语言:Erlang代码代码翻译:深圳相遇,至死不渝代码:-module(you_and_me).-export([start/1]).-record(person,{name,address,status}).start(Name)-one_world(Name).one_world(Name)keep_to_love_you(Person).say_goodbye(Person)-io:format(~p:seeyounextworld!~n,[Person#person.name]).see_you_next_world(Name)-one_world(Name).

第五条语言:Java语言代码翻译:爱你到天荒地老代码:while(!world.destroy){System.out.println(iloveyou);}

用Java web 做一个留言板 留言功能实现了,不知道怎么实现回复和删除留言的功能,知道的高手,请帮帮忙。

先说说回复吧:

假如:

留言表(id , text )两个字段

回复表( id , text parentId )用来存放留言表id 三个字段

目前有一条留言

1001,'这是一条留言';

那么给这条留言的回复就是

1003 , '这是一条回复', 1001(这就是该留言的ID) 这样就把留言和回复关联上了

回复后点保存时,将数据传入后台,数据库做insert操作就行了

删除一样的

如果删除回复,直接传入回复的ID 即可

如果删除留言,得先判断该留言有没有回复,如果有回复,则先删除回复,在删除留言(外键约束)


本文题目:java在线留言代码,java实现留言功能
文章源于:http://cdkjz.cn/article/hcsicp.html
多年建站经验

多一份参考,总有益处

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

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

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220