transientObjects.clear();
}
}
private void redraw(){
SGFrame frame = program.getFrame();
frame.clearGraphics();
try{
synchronized(backgroundObjects){
for(SGObject object : backgroundObjects){
frame.addObject(object);//no origin specified, so add it
}
}
}catch(ConcurrentModificationException e){
System.err.println("Encountered a ConcurrentModificationException while drawing background objects.");
//JOptionPane.showMessageDialog(null, "ConcurrentModificationException!");
redraw();
return;
}catch(IndexOutOfBoundsException e){
System.err.println("Encountered an IndexOutOfBoundsException while drawing background objects.");
redraw();
return;
}
try{
synchronized(persistentObjects){
for(SGObject object : persistentObjects){
frame.addObject(object);//no origin specified, so add it
}
}
}catch(ConcurrentModificationException e){
System.err.println("Encountered a ConcurrentModificationException while drawing persistent objects.");
//JOptionPane.showMessageDialog(null, "ConcurrentModificationException!");
redraw();
return;
}catch(IndexOutOfBoundsException e){
System.err.println("Encountered an IndexOutOfBoundsException while drawing persistent objects.");
redraw();
return;
}
try{
synchronized(transientObjects){
for(SGObject object : transientObjects){
frame.addObject(object);//no origin specified, so add it
}
}
}catch(ConcurrentModificationException e){
System.err.println("Encountered a ConcurrentModificationException while drawing transient objects.");
//JOptionPane.showMessageDialog(null, "ConcurrentModificationException!");
redraw();
return;
}catch(IndexOutOfBoundsException e){
System.err.println("Encountered an IndexOutOfBoundsException while drawing transient objects.");
redraw();
return;
}
try{
synchronized(draggingObjects){
for(SGObject object : draggingObjects){
frame.addObject(object);//no origin specified, so add it
}
}
}catch(ConcurrentModificationException e){
System.err.println("Encountered a ConcurrentModificationException while drawing dragging objects.");
//JOptionPane.showMessageDialog(null, "ConcurrentModificationException!");