swingutilities

DefaultStyledDocument.styleChanged(Style style) may not run in a timely manner?

I'm experiencing an intermittent problem with a class that extends javax.swing.text.DefaultStyledDocument. This document is being sent to a printer. Most of the time the formatting of the document looks correct, but once in a while it doesn't. It looks like some of the changes in the formatting have not been applied. I took a look at...

Java - Difference between SwingWorker and SwingUtilities.invokeLater()

SwingWorker is used for the following purposes: For running long-running tasks in a different thread so as to prevent the GUI from being unresponsive For updating GUI with the results produced by the long-running task at the end of the task through done() method. For updating GUI from time to time with the intermediate results produced...

Java Swing main JFrame: why does SwingUtilities.getAncestorOfClass return null?

Hi folks, I intend to implement a Swing application which keeps all its JComponents within the main application window JFrame. It seems like clunky procedural code to give all my JPanel constructors a parameter referring to the JFrame. So some research uncovered SwingUtilities.getAncestorOfClass, which looked like the solution. But I c...