Don't call setText in MageTextArea if the text hasn't changed

Minor UI speedup, shows up in profiles for simple games.
This commit is contained in:
draxdyn 2016-06-01 17:02:20 +02:00
parent 8c2c1f4887
commit 9513b5bf74

View file

@ -13,6 +13,8 @@ import org.mage.card.arcane.UI;
* @author nantuko
*/
public class MageTextArea extends JEditorPane {
private String currentText;
private int currentPanelWidth;
public MageTextArea() {
UI.setHTMLEditorKit(this);
@ -31,6 +33,12 @@ public class MageTextArea extends JEditorPane {
return;
}
if(text.equals(currentText) && panelWidth == currentPanelWidth)
return;
currentText = text;
currentPanelWidth = panelWidth;
final StringBuilder buffer = new StringBuilder(512);
// Dialog is a java logical font family, so it should work on all systems
buffer.append("<html><body style='font-family:Dialog;font-size:");