用Java做一个类似于QQ空间留言板的功能 。。。不用数据库也能实现. 及时性的罢了;
要是数据库的话:方法一(用于有条件性的,比如只显示对方发的信息)
1user表id , use两列
2messages表id , message , message_person , use_id (外键)四列
方法二(双方都用select * form messages查询所有信息)
1messages表id , message两列
急急急!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();
推荐阅读
- 无人直播隔天结账,无人直播对账号有影响吗
- gis如何把两个数据拼接,gis如何把两个数据拼接在一起
- 咋样开微信公众号运营助理,公众号开通运营
- 直播中录屏只有声音,直播时录屏没有声音
- mysql卸载了怎么安装 mysql8022卸载
- net4.5安装时发生严重错误,安装net40发生严重错误
- 公众号发表文章励志,适合发公众号的励志文章
- 九游单机游戏免费下载,九游单机游戏破解
- php获取数据提交 php获取post数据