问题标签 [jtreetable]
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.
java - JXTreeTable 模型不允许使用 insertNodeInto()
我在我的应用程序中使用了一个树表模型,它扩展AbstractTreeTableModel
以创建一个JXTreeTable
. 下面是我的模型。
这就是我JXTreeTable
在我的应用程序中使用的方式
当我需要向 中添加新节点时JXTreeTable
,我尝试获取其模型并使用insertNodeInto()
函数调用,但模型不支持该insertNodeInto()
函数。
有人请让我知道我在代码中哪里出错了。这是我第一次使用树表,所以可能会丢失一些东西。
java - 大表,性能慢
给定一个Java Swing
有 20 个实例的应用程序,这些JTreeTable
实例包含频繁更新的数据。(每行更新 5 次/秒)。这些表每个包含 50k 行。减少表的数量或更新率不是一种选择。
这个应用程序既受到缓慢(Swing 线程混乱)的影响,也受到由大量短期临时对象引起的密集 GC 活动的影响。
为了提高性能,有什么设计建议?
java - JTable 正在调整我的列宽
我创建了一个JTreeTable
where the TreeCellRenderer
is a JTable
。这使我可以TableColumnModel
为每一行设置不同的 s。兄弟姐妹的JTree
共享一个TableColumnModel
。它工作得很好。我可以选择一行并显示一组不同的列,而无需实际更改其他行中的数据,即使在不同级别也是如此。
I have a problem though where when select a different row the JTable is changing my TableColumn
s width and setting it to the preferred size. 所以效果是拖动一列的宽度,然后选择不同的行将其设置回首选大小。
我已经尝试了很多方法来解决这个问题,包括添加 aTableColumnModelListener
并且当我更改宽度时,我设置了列的首选大小。这不起作用,因为 JTable 在我更改它后将首选大小设置为 15。
我已经将代码追溯到导致此问题的原因。这是JTable.doLayout()
造成我悲伤的方法。该方法正在调用私有方法setWidthsFromPreferredWidths(...)
。此方法是设置我的 TableColumn 宽度的方法。
我尝试覆盖该方法,因为它是公共的,但是当我已经覆盖该方法时我doLayout()
无法调用。super.doLayout()
如您所想,不调用它会导致一些非常奇怪的 UI 问题。我还尝试转换为isthis
的超类,但最终出现堆栈溢出错误。无论如何,这感觉不是正确的解决方案。JTable
JComponent
我认为正在发生的事情是,因为我JTable
是在面板内作为树单元格的渲染器而不是在滚动窗格内,所以布局出了点问题。不过我不确定。下面是我上面引用的私有方法内部的代码:
查看代码,我认为发生的事情是该getWidth()
方法导致 JTable 想要将列调整为首选大小,因为它认为它没有足够的空间。我尝试在本地复制粘贴此方法,但由于涉及私有方法并且它越来越深,我停止了它。目的是尝试调试为什么选择调整宽度。如果我能解决根本原因,那可能是最好的解决方案。
JTree
本身在JScrollPane
. JTableHeader
设置ViewPortColumnHeaderView
为。下面是我选择不同行的 2 张图片。忽略标题对齐,我已经有一个解决方案,只是还没有完全实现它。
对这个问题的任何想法将不胜感激。如果您认为它会有所帮助,也很乐意发布您认为可能有用的任何代码。
jquery - 如何在javascript中的动态json中应用foreach循环?
几天前,我从 jsfiddle 在我的代码中实现了一个静态 json,并做了一些更改以从中创建动态 json。我从中获得代码的jsfiddle
现在我的代码正在运行。但我想要对它进行一些更改。下面是我当前的代码和图像,这些数据是我从 mysql 获得的带有 json 的数据。
那么,我们如何在单个树中创建PAY_MONTH
相同的内容。PAY_YEAR
我只想要一个父母PAY_YEAR
和他所有的孩子PAY_MONTH
。
我正在使用代码点火器。
我的模型:
我的控制器:
我对 jquery 不太了解,在这里我想用它创建动态数据。我很绝望。请帮助我。
java - Jtable with expandable jtable for each row
I'm trying to obtain a table where you can collapse rows using a + or whatever symbol, like in this image from Access:
Actually, I would like to have the same behaviour, with the title of the columns like that. I will use only 2 levels: the one that have the + and the ones that do not have (different parents with different childs but childs won't be parents). At the moment I am trying Jtable inside Jtree but I'm quite far from the objective and the results are not near... I cannot edit table cells neither I can have the column names like this case (If I put the title of columns each parent will have the title). Do you know some java swing component with a behaviour like the one that I want to obtain or some code that could do this? Any help with the code I wrote?