1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-29 18:52:13 +01:00

Forcing GUI update events to happen in the Event Dispatch Thread

This commit is contained in:
Federico Fissore 2013-10-15 18:09:52 +02:00
parent f7f616c3bb
commit 027f7c7403
2 changed files with 20 additions and 10 deletions

View File

@ -175,6 +175,9 @@ public class EditorConsole extends JScrollPane {
// should the interval come from the preferences file?
new javax.swing.Timer(250, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// only if new text has been added
if (consoleDoc.hasAppendage) {
// insert the text that's been added in the meantime
@ -183,6 +186,8 @@ public class EditorConsole extends JScrollPane {
consoleTextPane.setCaretPosition(consoleDoc.getLength());
}
}
});
}
}).start();
}

View File

@ -1998,10 +1998,15 @@ public class JEditTextArea extends JComponent
{
public void actionPerformed(ActionEvent evt)
{
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if(focusedComponent != null
&& focusedComponent.hasFocus())
focusedComponent.blinkCaret();
}
});
}
}
class MutableCaretEvent extends CaretEvent