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)

[1927 byte] By [wgdtoma] at [2007-10-2 18:31:35]
# 1
Well, you didn't post the method that is failing doUpdateLog(). So, it's hard to diagnose the issue. But my guess is you are passing in a negative value to TextComponent.setCaretPosition(), as the exception indicates.- Saish
Saisha at 2007-7-13 19:53:03 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2
I set a negetive value in TextComponent.setCaretPosition().The problem is solved. Thank you!
cnna at 2007-7-13 19:53:03 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3
You are welcome. Best of luck.- Saish
Saisha at 2007-7-13 19:53:03 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...