简体   繁体   English

如何使用Prefuse和JTable的典型功能来可视化表格

[英]How to visualize a table using Prefuse with typical functions of JTable

My question is: 我的问题是:

  1. how to display a table information in prefuse? 如何预先显示表格信息? I found GridLayout might be relevant. 我发现GridLayout可能是相关的。 But I don't know how to exactly draw a table using prefuse, like a JTable looking and the typical functions like getRow, selectColumn, mouseClick for each cell et al. 但是我不知道如何使用预填充来准确地绘制表格,例如查找JTable以及每个单元格的典型功能,如getRow,selectColumn,mouseClick等。
  2. my table table is a little complicated, each column has different data type. 我的表表有点复杂,每列都有不同的数据类型。 I suppose I need to add two data separately into m_vis. 我想我需要将两个数据分别添加到m_vis中。 But can they work fine together in a single table view? 但是它们可以在单个表视图中一起正常工作吗? And I just add different listeners for different data groups? 我只是为不同的数据组添加了不同的侦听器?

To add details about my data: 要添加有关我的数据的详细信息,请执行以下操作:

I have an implementation using JTable in java swing to show a list of documents which each row contains 10 columns showing different variable values associate with this document. 我有一个在Java swing中使用JTable的实现,以显示文档列表,每行包含10列,这些列显示了与此文档关联的不同变量值。 The table structure is not uniform, in a sense that the first two rows show other information, each cell in the first row is a comboBox to do selection and each cell in the second row is a bar chart showing distribution for the variable shown in this column( each bar is a JPanel display with mouse click event enabled). 表的结构是不统一的,从某种意义上说,前两行显示了其他信息,第一行中的每个单元格都是一个comboBox进行选择,第二行中的每个单元格是一个条形图,显示了此变量的分布列(每个栏都是一个启用了鼠标单击事件的JPanel显示)。

Given such table model, I am also not sure how to put the first two rows into Data in prefuse since they are drawn using Graphics2D in java swing. 给定这样的表模型,我也不确定如何将前两行预先放入Data中,因为它们是使用java swing中的Graphics2D绘制的。 The data type(.class) cannot even be specified, right? 甚至不能指定数据类型(.class),对吗?

The data type ( .class ) cannot even be specified, right? 甚至无法指定数据类型( .class ),对吗?

No. As discussed in How to Use Tables , the table model's getColumnClass() implementation can specify the type of data for each cell as a class literal . 不能。如如何使用表中所述,表模型的getColumnClass()实现可以将每个单元格的数据类型指定为类文字 The type is one way JTable uses to select a suitable renderer . 该类型是JTable选择合适的渲染器的一种方式。 Icons and small images are a reasonable choice for display in situ , but a ListSelectionListener can be used to display larger elements in an adjacent component. 图标和小图像是就地显示的合理选择,但是ListSelectionListener可以用于在相邻组件中显示较大的元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM