into
回复表
values(回复id,留言id,回复内容、、、)查的时候
select
*
from
回复表
where
留言id=想查回复的留言的id,希望理解我说的
可以链接的;
使用java链接时,需要下载相应数据库版的驱动程序
多写写调试一下,会对编程有好处。
祝您学习。
答案来自南京江宁蓝贵婚庆软件开发策划部。
蓝贵婚庆
地址:胜太路88-11号
您好。我重新地帮你写了代码,完全地符合了你的图片中的界面要求、功能要求。代码如下:(解决了问题,记得给我分哦~^_^呵呵……)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()
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)