Closed IvanRF closed 6 years ago
There's not much to operate on here without a simple standalone sample that reproduces this issue under the latest Substance dev builds.
It might be in Substance. It might be in core Swing classes. Or it might be in application code that is incorrectly changes UI state off the UI thread.
I will try to make a sample for the lastest Substance. In the app, all changes to UI components are made in the UI thread.
I was able to reproduce the issue on the latest version.
Here is sample app: test.zip
And a console screenshot:
It cost me a little to reproduce it. You need to start dragging/moving columns while the SwingWorker
is processing, in the example simulated with a Thread.sleep()
.
Same exact thing happens under Metal.
And Aqua (default macOS swing LAF)
Oh, yes, BasicTableHeaderUI
functions code is the same as SubstanceTableHeaderUI
It seems it has been there for a while: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6480543
I see. Looks like this indeed can be worked around in a couple of places in the table UI delegate that draw the dragged column / cells. I'll upload the bits tonight or tomorrow.
excellent, thanks!
Version of Substance
Not the latest but the code is still the same on
SubstanceTableHeaderUI
Version of Java
8 update 144
Version of OS
Win 10
The issue you're experiencing (expected vs actual, screenshot, stack trace etc)
First time in years I see this issue. If/When I have some time I will write a test code. Steps to reproduce (how I saw it):
JTable
with an emptyDefaultTableModel
SwingWorker
SwingUtilities.invokeAndWait()
is used in the background process in order to show aJOptionPane.showOptionDialog()
.JTable
but setting a newDefaultTableModel
withJTable.setModel(tableModel)
In this particular scenario many confirm dialogs were shown and I click multiple times in the buttons area until the process finished. My guess is that some of clicks maybe were catched by the table header and by the time the EDT is ready to process them, the
JTable
had a different model.Thus, function
viewIndexForColumn()
returns-1
fordraggedColumnIndex
on SubstanceTableHeaderUI.java#L431.I debugged the error and
aColumn
in the call toviewIndexForColumn()
was present inheader.getColumnModel()
but with a different object id. That's why I guess is trying to find an old column from the previousDefaultTableColumnModel
.The UI section where the table is located becomes unresponsive and an exception is thrown for every mouse movement on that area.
The question is how to solve this. Maybe the painting should be avoided when
draggedColumnIndex
is-1
.This is the exception: