帮忙!!!急!!看下错在哪?
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import java.util.Date;
import java.text.*;
import java.text.SimpleDateFormat;
import java.io.*;
public class LookFrame extends JFrame
{
JTextArea Ta=new JTextArea();
JButton bt1=new JButton("确定");
JButton bt2=new JButton("退出");
JScrollPane sl=new JScrollPane(Ta);
public LookFrame()
{
super();
Container con=getContentPane();
con.setLayout(new BorderLayout());
JPanel pane=new JPanel();
pane.setLayout(new BorderLayout());
pane.add(sl,BorderLayout.CENTER);
Ta.append("日期\t 时间\t 标题\t 事件\t");
JPanel p1=new JPanel();
p1.add(bt1,"SOUTH");
p1.add(bt2,"SOUTH");
ButtonHandler handler = new ButtonHandler();
bt1.addActionListener(handler);
pane.add(p1,BorderLayout.SOUTH);
con.add(pane,BorderLayout.CENTER);
bt2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
dispose();
}
});
}
private class ButtonHandler implements ActionListener{
public void actionPerformed(ActionEvent e)
{
ResultSet rs;
String sql="";
int i=0;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String source="jdbc:odbc:xie";
Connection con=DriverManager.getConnection(source);
Statement stmt=con.createStatement();
sql="SELECT * FROM Table1";
rs=stmt.executeQuery(sql);
while(rs.next())
{
i++;
Ta.setText(rs.getString(1)+"");
Ta.setText(rs.getString(2)+"");
Ta.setText(rs.getString(3)+"");
Ta.setText(rs.getString(4)+"");
}
rs.close();
if(i==0)
{
JOptionPane.showMessageDialog(LookFrame.this,"没有备忘可查看!","message",JOptionPane.INFORMATION_MESSAGE);
return;
}
}catch(Exception ew)
{
;
}
}
}
public void rePaint()
{
Ta.setText(" ");
Ta.append("日期\t 时间\t 标题\t 事件\t");
}
public static void main(String[] args)
{
LookFrame lookframe=new LookFrame();
lookframe.setVisible(true);
}
}
这段代码没有错,但是得到的结果却是只有一个:thing字段的内容,其他字段的却没有,这是怎么回事???
------解决方案--------------------
没太明白,是这意思吗?
[code=Java][/code]
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import java.util.Date;
import java.text.*;
import java.text.SimpleDateFormat;
import java.io.*;
public class LookFrame extends JFrame {
JTextArea Ta = new JTextArea();
JButton bt1 = new JButton("确定");
JButton bt2 = new JButton("退出");
JScrollPane sl = new JScrollPane(Ta);
public LookFrame() {
super();
setSize(400, 400);
Container con = getContentPane();