问题标签 [jxtable]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
197 浏览

java - 为 JXTable 中的某些行着色

在对列进行排序后,我在为某些行着色时遇到问题。我想为第 4 列等于零的每一行着色。所以我已经覆盖了这样的 prepareRenderer() 方法:

它工作正常。(第 1、第 2 和第 15 行颜色为红色) 在此处输入图像描述

但是在对某些列进行排序后,此行索引不会改变。(第 1、第 2 和第 15 行再次变红) 在此处输入图像描述 如何解决?

0 投票
1 回答
78 浏览

java - DefaultTableModel 不接受对象类型


我一直在尝试将一些数据从一个发送Editable JComboBox到一个JXTable。它的代码是这样的:

但是该方法的最后一行model.addRow(row);Cast row to Object or Vector,它已经是。
作为初学者,我可能会遗漏一些概念或逻辑部分。所以想在这里发布一个问题。谁能指出我的错误?我将不胜感激地接受任何建议。

谢谢!!!

0 投票
1 回答
254 浏览

java - 如何禁用 JXTable 默认搜索操作?

我的摇摆应用程序中有一个JXTable。当我在桌子上按 ctrl+F 时,默认搜索面板正在打开。

在此处输入图像描述

此面板仅查找子字符串。我需要用我的 InputText 找到相似的词。例如,我写“test”结果可能是“tost”、“tests”、“est”、“tst”等。我如何将这种搜索方法更改为我自己的算法?可能吗 ?或者我应该禁用默认搜索并创建自己的搜索吗?

0 投票
1 回答
74 浏览

java - 防止 JXTable 自动调整列宽

关于在执行“打包所有列”调用后发生的情况,我遇到了一个使用 JXTable 的特定场景(甚至可能是 JTable 问题)。

“打包所有列”工作正常,但是当我手动缩小列宽时,在收到下一个 TableModelEvent 时,我修改的列宽总是变大。我注意到 JTable 的私有 setWidthsFromPreferredWidths() 最终被调用,这看起来像是罪魁祸首。

同样,仅在我选择“打包所有列”后才会出现此问题。这是一个已知的错误还是“打包所有列”的预期行为?

0 投票
1 回答
300 浏览

java - 制作一个可滚动的 ColumnControl 弹出 JXTable

下午好。我对 a 的属性有一个有趣的问题JXtable

问题是我创建的JXTable列太多了,所以我决定让用户选择使用SwingX 库中ColumnControlButton默认提供的列来显示哪一列。JXTable

由于我的列太多,当我按下ColumnControl按钮时,它不会显示所有可以隐藏/显示的列。默认情况下ColumnControl不带有可滚动的属性来管理这种情况。我需要某种代码,例如与JXTable.. 一起使用的代码。我不知道,也许类似于.setHorizontalScrollEnabled(true),所以我可以看到ColumnControl.

我提前感谢您的回答,伙计们...

顺便说一下,这是加载表格的代码:

0 投票
0 回答
134 浏览

java - setRowHeight(int) 工作但 setRowHeight(int, int) 与 JXTable

我在更新 JXTable 的行高时遇到问题。我已经测试了这篇文章中的一个示例(在 Java 中设置 JTable 中的行的高度):

此演示完美运行,但如果我将 JTable 更改为 JXTable(我的项目需要它),第二行不会更新,所有大小均为 15。如果我在 JXTable 中使用 setRowHeight(30) 而不是 setRowHeight(1, 30),它可以工作,但所有行都会更新。

这是一个错误吗?我怎么解决这个问题 ?我正在使用库swingx-0.9.2.jar

谢谢

0 投票
1 回答
483 浏览

swing - Jtable 显示和隐藏列并保存配置。

我正在使用具有 setColumnControlVisible(true) 的 JXTable,它在滚动上方的右上角显示一个按钮,我们可以通过按下它来显示和隐藏列。我想记住应用程序关闭时的更改,但还无法弄清楚,这是我到目前为止所尝试的。我检查了 JxTable 的 src,但没有找到隐藏的列索引或列号。

0 投票
1 回答
297 浏览

java - DatePickerCellEditor resets the time when cell editing starts and stops

I have a JXTable with two columns that hold string values and one column that holds a date time value that follows this format: yyyy-MM-dd HH:mm:ss.

Since I only care about the users changing the date, I thought I'd make use of DatePickerCellEditor from the Swingx package with a custom SimpleDateFormat("yyyy-MM-dd HH:mm:ss").

So far so good, except the problems start to occur when editing starts. The date part of the datetime is maintained, however, the time portion of it gets reset to "00:00:00" and to make matters worse, when I move to edit another cell, the value that remains in the cell that was being edited is the proper date, but the time at 00:00:00.

In other words, this Before edit becomes this enter image description here

I have tried many things to fix this, including overriding the getTableCellEditorComponent from DatePickerCellEditor and printing the date directly from the JXDatePicker. I found out that somewhere along the way, the time part of the day was being reset to "00:00:00". I couldn't find out where. I then tried, within the getTableCellEditorComponent, manually setting the date by using JXDatePicker#setDate and that also didn't work.

One workaround I found was, inside getTableCellEditorComponent, calling JXDatePicker#getEditor and manually setting the date there, however, the time part of the cell value still gets reset when editing stops.

Here's the sample code to work with:

Is this behaviour intended? I am aware that JXDatePicker is for dates only, but I naturally assumed that it would preserve the time as long as the user didn't change the date.

0 投票
1 回答
61 浏览

java - 在选择时突出显示细线交叉图案中的相关单元格

我想将细线交叉突出显示添加到JXTable. 但我可以突出显示当前行或当前列;从不两者兼而有之。

我目前拥有的是红色部分,黄色部分是我要添加的。

在此处输入图像描述

低于 SSCCE 1

更新

使用@camickr 提供的代码和建议会产生以下结果:

但不幸的是,我现在遇到了人工制品问题。类似于下图(取自仅以红色着色的版本)。

在此处输入图像描述


我在 Windows 10.0.16299 Build 16299 上使用 Java 1.8.0_74。JXTable来自

0 投票
1 回答
30 浏览

java - 可见时 JXTable 高 cpu

我正在调试使用 JXTable 显示少量数据(< 100 个条目)的遗留代码。所有功能都有效,但当表格中至少有一个条目时,如果显示窗格,CPU 使用率将攀升至 95% 以上。仪器表明,highlight 方法每毫秒调用几次。仅当表格可见(选择了不同的选项卡)时才调用 highlight 方法,这是有道理的。我正在尝试在一个小样本中复制它,但这还不行。我只是想知道是否有人看到过类似的行为并提出了解决方案。库:swingx-1.0.jar Java:jdk1.8.0_144