• <bdo id='mt4or7zn'></bdo><ul id='tixxkta1'></ul>

    1. <small id='x8qe4rcb'></small><noframes id='c2kbytnk'>

      <legend id='5fcf9ijs'><style id='99wcdfo8'><dir id='bsgsva6l'><q id='e6zftjz1'></q></dir></style></legend>

      <tfoot id='84puvz5u'></tfoot>
    2. <i id='lnl7yupz'><tr id='926gudyl'><dt id='zcmd112m'><q id='ujgk4r2d'><span id='pmk8yyi3'><b id='2t3ys0ck'><form id='9yt1a7fl'><ins id='y3ehgmr6'></ins><ul id='z37lb3hk'></ul><sub id='iq0b3lm2'></sub></form><legend id='f2w1eeid'></legend><bdo id='g6cbmxok'><pre id='z53d0nis'><center id='o1tu81d5'></center></pre></bdo></b><th id='pzdh8dhg'></th></span></q></dt></tr></i><div id='ql1h0ksm'><tfoot id='nh6xgkdb'></tfoot><dl id='r7vi8dkn'><fieldset id='c70vzaxy'></fieldset></dl></div>
      欢迎来到入门教程网!

      Java编程

      当前位置:主页 > 软件编程 > Java编程 >

      java留言功能代码 java留言功能实现

      来源:本站原创|时间:2023-04-03|栏目:Java编程|点击:

      急急急!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 web 做一个留言板 留言功能实现了,不知道怎么实现回复和删除留言的功能,知道的高手,请帮帮忙。

      先说说回复吧:

      假如:

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

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

      目前有一条留言

      1001,'这是一条留言';

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

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

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

      删除一样的

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

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

      用Java做一个类似于QQ空间留言板的功能。。。

      不用数据库也能实现. 及时性的罢了;

      要是数据库的话:方法一(用于有条件性的,比如只显示对方发的信息)

      1 user表 id , use 两列

      2 messages表 id , message , message_person , use_id (外键) 四列

      方法二(双方都用select * form messages查询所有信息)

      1 messages表 id , message 两列

        <legend id='xii9k5sl'><style id='xdd1iow9'><dir id='j4hmnjvn'><q id='kronwhwl'></q></dir></style></legend>

        <small id='k01rporg'></small><noframes id='zu76o7jv'>

              <tbody id='h12dh5e1'></tbody>

            <i id='i9yncfm7'><tr id='jhcrk4p7'><dt id='2cmb7dn0'><q id='nsfrqpxn'><span id='ybx05lv5'><b id='uf14to91'><form id='nvtbjx1u'><ins id='a8ci838z'></ins><ul id='z8vuvwoi'></ul><sub id='iikbwlp4'></sub></form><legend id='5jycc7r6'></legend><bdo id='6ybpsk1c'><pre id='4xlfag7x'><center id='jsvklx2f'></center></pre></bdo></b><th id='uuxrjyn5'></th></span></q></dt></tr></i><div id='uqqigndh'><tfoot id='ka6o1mdt'></tfoot><dl id='w76vtk34'><fieldset id='0w95x08z'></fieldset></dl></div>
                <bdo id='mujbifs2'></bdo><ul id='rzzq793z'></ul>

                <tfoot id='96dtm9f5'></tfoot>

                上一篇:字符串对称的java代码 java字符串对齐方式

                栏    目:Java编程

                下一篇:没有了

                本文标题:java留言功能代码 java留言功能实现

                本文地址:https://www.xiuzhanwang.com/a1/Javabiancheng/17212.html

                网页制作CMS教程网络编程软件编程脚本语言数据库服务器

                如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

                联系QQ:835971066 | 邮箱:835971066#qq.com(#换成@)

                Copyright © 2002-2020 脚本教程网 版权所有

                  <legend id='daqkub51'><style id='ac5bpjz1'><dir id='woo63n5g'><q id='uu72j4zv'></q></dir></style></legend>

                    <bdo id='3xaro9xa'></bdo><ul id='9h58lcbj'></ul>

                  <small id='xrhvf5zp'></small><noframes id='wsb1a0d3'>

                  <tfoot id='pn21mnw1'></tfoot>
                    <i id='dhskdnvp'><tr id='flk715bg'><dt id='tmoyucyq'><q id='7lrxxzim'><span id='l9tpkhrm'><b id='6nviiyq9'><form id='hj50uxlj'><ins id='xx6qk3rq'></ins><ul id='i797ze3z'></ul><sub id='sr4k9nk2'></sub></form><legend id='ocse8247'></legend><bdo id='3fwvjk68'><pre id='mcr60ewq'><center id='ox5w7d6d'></center></pre></bdo></b><th id='hbx2njth'></th></span></q></dt></tr></i><div id='v57flwqq'><tfoot id='t5tquwv6'></tfoot><dl id='qs2c3dih'><fieldset id='8m0uw55c'></fieldset></dl></div>