예제 #1
0
 private void addHTML(String html) {
   synchronized (kit) {
     try {
       kit.insertHTML(doc, doc.getLength(), html, 0, 0, null);
     } catch (BadLocationException | IOException ignored) {
       Logger.logError(ignored.getMessage(), ignored);
     }
     displayArea.setCaretPosition(displayArea.getDocument().getLength());
   }
 }
예제 #2
0
 private synchronized void refreshLogs() {
   doc = new HTMLDocument();
   displayArea.setDocument(doc);
   List<LogEntry> entries = Logger.getLogEntries();
   StringBuilder logHTML = new StringBuilder();
   for (LogEntry entry : entries) {
     logHTML.append(getMessage(entry));
   }
   addHTML(logHTML.toString());
 }
예제 #3
0
  private void createUIComponents() {
    displayArea = new JEditorPane("text/html", "");
    displayArea.setEditable(false);
    kit = new HTMLEditorKit();
    displayArea.setEditorKit(kit);

    JScrollPane scrollPane = new JScrollPane(displayArea);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    logType = ELogType.valueOf(SettingsUtils.getValue(ESetting.LOGTYPE));
    refreshLogs();
    Logger.addListener(this);

    System.setOut(new OutputOverride(System.out, LogLevel.INFO));
    System.setErr(new OutputOverride(System.err, LogLevel.ERROR));
    try {
      Logger.addListener(new LogWriter(new File(launcherLogFile)));
    } catch (IOException e1) {
      Logger.logError(e1.getMessage(), e1);
    }
  }