Extreme validate/repaint/draw/display times
I have MiGLayout 4.2
I have a program (Java 1.7) that displays a strucutred Document made out of several layers of JPanels (about 5-8 layers) and JTextAreas.
The creation of such Document is fast, but when it comes to adding it to another component and drawing it on screen, process takes way more time to than it should (several seconds for 60ish JTextAreas).
Using VisualVM 1.3.5, I have found out that net.miginfocom.swing.SwingComponentWrapper.getLayoutHashCode() takes very long to execute and that it makes excesive number of calls to net.miginfocom.swing.MigLayout.checkParent(java.awt.Container).
It is also possible that this has something to do with getWidth()/getHeight() methods in net.miginfocom.swing.SwingComponentWrapper package being called recursively.
If you want to test it out by yourself, I have uploaded my program here:
File comment: My program (Java 1.7). It requres iText 5.3.1 to be able to test it. I needs to be run as an Eclipse project.
src.rar [31.22 KiB]
Downloaded 967 times
Parts of program relevant to the problem are pscript.gui.elements package, pscript.gui.windows.Open dialog class, pscript.gui.processing.Opener class and pscript.gui.Gui class.
In order to test it, you can File->Open a pdf I have here with my program:
File comment: The test file.
testFile.pdf [7.51 KiB]
Downloaded 1018 times
It should populate about two and a half pages of my document. The JTabbedPane.addTab(String name, JScrollPane scrollPane); or documentSelector.addTab(counter+"", document); in my program, Class Gui, line 37) is the one that takes a bunch of time to execute.
I have both samplerSnapshot and profilerOutput of the VisualVM for opening the given file. Notice that net.miginfocom.swing.MigLayout.checkParent(java.awt.Container)) was called over 160 000 times:
File comment: Sampler and profiler results of VisualVM
VisualVM output.rar [10.2 KiB]
Downloaded 1008 times
I believe it's a bug related to painting a bunch of components when their size is not defined. It seems like the layout is expanding the components pixel by pixel until it reaches the appropriate size. But that's just my guess. Thank you for your help in advance.