I CANNOT provide an SSCCE as I can't make error repeatable outside of my large App.
But here is a snippet and the output:
if (vp != null) {
try {
starterModule.writePaneln("Sigma.show() 4.1 vp: "+vp);
starterModule.writePaneln("Sigma.show() 4.1 P: "+P);
starterModule.writePaneln("Sigma.show() 4.1 scrollPane: "+scrollPane);
vp.setView(P);
starterModule.writePaneln("Sigma.show() 4.2");
} catch (Exception e) {
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("C:\\javaout2.txt", true)));
out.println("ERROR SIGMA e:");
out.flush();
out.close();
}
}
Output is:
Sigma.show() 4.1 vp: javax.swing.JViewport[,0,0,902x800,layout=javax.swing.ViewportLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=25165832,maximumSize=,minimumSize=,preferredSize=,isViewSizeSet=true,lastPaintPosition=,scrollUnderway=false]
Sigma.show() 4.1 P: javax.swing.JPanel[,0,0,0x0,invalid,layout=javax.swing.BoxLayout,alignmentX=0.0,alignmentY=0.0,border=com.devexperts.dxpro.shared.swing.styles.support.border.DefaultBorderSetter$PaddingBorder@4719dad8,flags=9,maximumSize=,minimumSize=,preferredSize=]
Sigma.show() 4.1 scrollPane: javax.swing.JScrollPane[,0,30,917x800,layout=javax.swing.ScrollPaneLayout$UIResource,alignmentX=0.0,alignmentY=0.0,border=com.devexperts.dxpro.shared.swing.styles.support.border.DefaultBorderSetter$PaddingBorder@14716d46,flags=328,maximumSize=,minimumSize=,preferredSize=,columnHeader=,horizontalScrollBar=javax.swing.JScrollPane$ScrollBar[,0,0,0x0,hidden,layout=com.devexperts.dxpro.shared.swing.styles.laf.impl.basic.StyledScrollBarUI,alignmentX=0.0,alignmentY=0.0,border=,flags=4194632,maximumSize=,minimumSize=,preferredSize=,blockIncrement=10,orientation=HORIZONTAL,unitIncrement=1],horizontalScrollBarPolicy=HORIZONTAL_SCROLLBAR_AS_NEEDED,lowerLeft=,lowerRight=,rowHeader=,upperLeft=,upperRight=,verticalScrollBar=javax.swing.JScrollPane$ScrollBar[,902,0,15x800,layout=com.devexperts.dxpro.shared.swing.styles.laf.impl.basic.StyledScrollBarUI,alignmentX=0.0,alignmentY=0.0,border=,flags=4194632,maximumSize=,minimumSize=,preferredSize=,blockIncrement=10,orientation=VERTICAL,unitIncrement=1],verticalScrollBarPolicy=VERTICAL_SCROLLBAR_ALWAYS,viewport=javax.swing.JViewport[,0,0,902x800,layout=javax.swing.ViewportLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=25165832,maximumSize=,minimumSize=,preferredSize=,isViewSizeSet=true,lastPaintPosition=,scrollUnderway=false],viewportBorder=]
Then the program appears to freeze on vp.setView(P); as the next writePaneln is not called.
HOWEVER, the error is not trapped either....
Here writePaneln ( for completeness)
public static void writePaneln(String txt){
if(DEBUG){
try {
synchronized (textPane) {
//textPane.getDocument().insertString(textPane.getDocument().getLength(), txt + "\n", null);
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("C:\\javaout.txt", true)));
out.println(txt);
out.flush();
out.close();
}
} catch (IOException e) {
// TODO Auto-generated catch block
JOptionPane.showMessageDialog(null,"writePaneln ERROR: "+e);
}
}
}
EDIT 1
I have changed to using invokeLater in my java.util.timer:
class RemindTask extends TimerTask {
@Override
public void run() {
SwingUtilities.invokeLater(
new Runnable(){
@Override
public void run() {
handleGO();
};
}
);
}
}
Use one of the approaches cited here to find EDT violations.
As shown here, you can replace the
RepaintManager
with an instance ofCheckThreadViolationRepaintManager
to catch violations.