如何在JTable中获取文本? [英] How can I get the text in a JTable?

查看:64
本文介绍了如何在JTable中获取文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我有一个表,我想要获取第一列中的文本并将其存储在ArrayList中.

For example I have a Table that I want to get text that's in the first column and store it in an ArrayList.

推荐答案

Java表通常使用TableModel接口进行存储.

Java Tables often use the TableModel interface for storage.

您可以通过以下方式获取特定值:

You can get the a particular value via:

myJTable.getModel().getValueAt(rowIndex, columnIndex);

有关此内容的更多信息: Sun的摇摆表教程

More on that: Sun's Swing Table Tutorial

这篇关于如何在JTable中获取文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆