how to solve this exception? help!!
i want to change part of my code from swing to AWT(just the timer part), but some exceptions are displayed. could you tell me why?
This is swing part
GUILogger guiLogger =new GUILogger(logLength);
// update log information
Timer timer =new Timer(logTime,new ActionListener(){
publicvoid actionPerformed(ActionEvent evt){
guiLogger.updateLog();
}
});
timer.start();
This is awt part
/*final Runnable doUpdateLog = new Runnable() {
public void run() {
guiLogger.updateLog();
}
};
TimerTask updateLogTask = new TimerTask() {
public void run() {
//if (!EventQueue.isDispatchThread())
EventQueue.invokeLater(doUpdateLog);
}
};
timer = new Timer();
timer.schedule(updateLogTask,0,logTime);
*/
exception:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: position less than zero.
at java.awt.TextComponent.setCaretPosition(Unknown Source)
at teema.GUILogger.updateLog(GUILogger.java:97)
at WtCDC$1.run(WtCDC.java:87)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

