mirror of https://github.com/rusefi/rusefi-1.git
live data progress: UI flickering
This commit is contained in:
parent
d0fb342928
commit
00e4304a70
|
@ -73,12 +73,10 @@ public class LiveDataParserPanel {
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
|
if (r == null)
|
||||||
|
return; // when would this happen?
|
||||||
g.drawString(value.toString(), r.x, r.y);
|
g.drawString(value.toString(), r.x, r.y);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private final VariableValueSource valueSource;
|
private final VariableValueSource valueSource;
|
||||||
|
@ -139,7 +137,14 @@ public class LiveDataParserPanel {
|
||||||
|
|
||||||
StyleContext sc = StyleContext.getDefaultStyleContext();
|
StyleContext sc = StyleContext.getDefaultStyleContext();
|
||||||
|
|
||||||
StyledDocument styledDocument = text.getStyledDocument();
|
SimpleAttributeSet attributes = new SimpleAttributeSet();
|
||||||
|
DefaultStyledDocument styledDocument = new DefaultStyledDocument();
|
||||||
|
try {
|
||||||
|
styledDocument.insertString(0, sourceCode, attributes);
|
||||||
|
} catch (BadLocationException e) {
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
|
||||||
AttributeSet oldSet = styledDocument.getCharacterElement(0).getAttributes();
|
AttributeSet oldSet = styledDocument.getCharacterElement(0).getAttributes();
|
||||||
styledDocument.setCharacterAttributes(0, sourceCode.length(), sc.getEmptySet(), true);
|
styledDocument.setCharacterAttributes(0, sourceCode.length(), sc.getEmptySet(), true);
|
||||||
|
|
||||||
|
@ -158,6 +163,7 @@ public class LiveDataParserPanel {
|
||||||
styledDocument.setCharacterAttributes(range.getStart(), range.getLength(), s, false);
|
styledDocument.setCharacterAttributes(range.getStart(), range.getLength(), s, false);
|
||||||
}
|
}
|
||||||
}, tree);
|
}, tree);
|
||||||
|
text.setDocument(styledDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
Loading…
Reference in New Issue