开发者

Swing JTable how to update it? and fill it?

Well I have 2 queries a) select * from players b)select * from players where idplayer=10;

Now I would to know what is the form easiest for to fill it first I created my table JTable mytable = new JTable(10,7); // ok.. // as in java there is not gridview or datagridview do we have to use JTable? well how do i fill it? have to JButtons one for fill it with a开发者_如何转开发ll players and another for fill it with query B. how do i update it?

I repeat I would to know the form easiest.. thanks this is my code

public ResultSet buscarfutbolistas() {
    ResultSet datos = null;
    String cadena="select * from futbolistas";
    try {
        Statement stm = conexion.getConnection().createStatement();
        datos = stm.executeQuery(cadena);
    } catch(Exception ex) {
        System.out.println(ex);
    }
    return datos; 
 }


Table From Database might help you.


You have to create a TableModel. See here for more information and a complete tutorial:

http://download.oracle.com/javase/tutorial/uiswing/components/table.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜