public final void run() { while (true) { try { String line = queue.next(); log_text_panel.insertString(line); sleep(2L); } catch (Exception ex) { ControlRoom.log(Level.SEVERE, "Error occured while writing to Log Panel", ex); } } }
private final void initialize() { this.setLevel(Level.ALL); try { LoggerFormat lForm = new LoggerFormat(); fhand = new FileHandler(ControlRoom.getAppData("vimcsl.%g.log"), 1966080, 5, true); fhand.setLevel(Level.ALL); fhand.setFormatter(lForm); this.addHandler(fhand); ConsoleHandler chand = new ConsoleHandler(); chand.setLevel(Level.ALL); chand.setFormatter(lForm); this.addHandler(chand); } catch (IOException e) { } }
About() { window = new JWindow(); this.setPreferredSize(new Dimension(650, 550)); this.setVisible(true); this.setLayout(null); JTextPane text = new JTextPane(); text.setBounds(5, 150, 625, 525); text.setVisible(true); text.setEditable(false); text.setOpaque(false); HTMLEditorKit htmlKit = new HTMLEditorKit() { public Parser getParser() { return super.getParser(); } }; HTMLDocument htmlDoc = new HTMLDocument(); text.addHyperlinkListener( new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (Desktop.isDesktopSupported()) { try { Desktop.getDesktop().browse(e.getURL().toURI()); return; } catch (IOException e1) { } catch (URISyntaxException e1) { } } try { Runtime.getRuntime().exec("xdg-open ".concat(e.getURL().toString())); } catch (IOException ioex) { ControlRoom.log( Level.WARNING, "Failed to show file: '" + e.getURL().toString() + "'. Possible unsupported File Manager...", null); } } } }); text.setEditorKit(htmlKit); text.setDocument(htmlDoc); try { BufferedReader reader = new BufferedReader( new InputStreamReader( this.getClass().getResourceAsStream("/resources/about.html"), "UTF-8")); htmlKit.read(reader, htmlDoc, htmlDoc.getLength()); } catch (IOException ioex) { ControlRoom.log(Level.SEVERE, "Failed to read about.html", ioex); } catch (BadLocationException e) { e .printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } text.addMouseListener(this); window.getContentPane().add(text); window.getContentPane().add(this); window.addMouseListener(this); window.pack(); ControlRoom.setWindowRelativeToCentral(window); window.setVisible(true); window.setAlwaysOnTop(true); }