47
47
48
48
public class EspExceptionDecoder implements Tool , DocumentListener {
49
49
Editor editor ;
50
- JLabel outputArea ;
50
+ JTextPane outputArea ;
51
+ String outputText ;
51
52
JTextArea inputArea ;
52
53
JFrame frame ;
53
54
File tool ;
@@ -105,11 +106,14 @@ public void run() {
105
106
try {
106
107
if (listenOnProcess (arguments ) != 0 ){
107
108
editor .statusError ("Decode Failed" );
109
+ outputArea .setText ("<html><font color=red>Decode Failed</font></html>" );
108
110
} else {
109
111
editor .statusNotice ("Decode Success" );
112
+ outputArea .setText (outputText );
110
113
}
111
114
} catch (Exception e ){
112
115
editor .statusError ("Decode Exception" );
116
+ outputArea .setText ("<html><font color=red><b>Decode Exception:</b> " +e .getMessage ()+"</font></html>" );
113
117
}
114
118
}
115
119
};
@@ -207,8 +211,16 @@ private void createAndUpload(){
207
211
inputArea .getActionMap ().put ("commit" , new CommitAction ());
208
212
inputArea .getDocument ().addDocumentListener (this );
209
213
frame .getContentPane ().add (new JScrollPane (inputArea ), BorderLayout .PAGE_START );
210
-
211
- outputArea = new JLabel ();
214
+
215
+ outputText = "" ;
216
+ outputArea = new JTextPane ();
217
+ outputArea .setContentType ("text/html" );
218
+ outputArea .setEditable (false );
219
+ outputArea .setBackground (null );
220
+ outputArea .setBorder (null );
221
+ outputArea .putClientProperty (JEditorPane .HONOR_DISPLAY_PROPERTIES , true );
222
+ outputArea .setText (outputText );
223
+
212
224
JScrollPane outputScrollPane = new JScrollPane (outputArea );
213
225
outputScrollPane .setVerticalScrollBarPolicy (JScrollPane .VERTICAL_SCROLLBAR_ALWAYS );
214
226
outputScrollPane .setPreferredSize (new Dimension (640 , 200 ));
@@ -247,7 +259,7 @@ private void printLine(String line){
247
259
String html = "" +
248
260
"<font color=green>" + address + ": </font>" +
249
261
"<b><font color=blue>" + method + "</font></b> at " + file + " line <b>" + line + "</b>" ;
250
- outputArea . setText ( outputArea . getText () + html +"<br>" ) ;
262
+ outputText += html +"\n " ;
251
263
}
252
264
253
265
public void run () {
@@ -275,7 +287,7 @@ private void parseText(){
275
287
while (m .find ()) {
276
288
command [i ++] = content .substring (m .start (), m .end ());
277
289
}
278
- outputArea . setText ( "<html><i>Decoding " +count +" results</i><br>" ) ;
290
+ outputText = "<html><pre>< i>Decoding " +count +" results</i>\n " ;
279
291
sysExec (command );
280
292
}
281
293
@@ -296,5 +308,4 @@ public void removeUpdate(DocumentEvent ev) {
296
308
public void insertUpdate (DocumentEvent ev ) {
297
309
parseText ();
298
310
}
299
-
300
311
}
0 commit comments