This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //This works. | |
| new ServerHandler(WorldServer.this, WorldServer.this.listener.accept()); | |
| //This does not. | |
| new ServerHandler(WorldServer.this, WorldServer.this.listener.accept()).start(); | |
| //Yes, ServerHandler implements Runnable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void runPrinter() { | |
| new Thread(new Runnable() { | |
| @Override | |
| public void run() { | |
| while (true) { | |
| if (!JConsolePane.this.messages.isEmpty()) { | |
| JConsolePane.this.print(JConsolePane.this.messages.get(0)); | |
| JConsolePane.this.messages.remove(0); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Thread t = null; | |
| try { | |
| final PipedOutputStream errOut = new PipedOutputStream(); | |
| System.setErr(new PrintStream(errOut)); | |
| final BufferedReader errIn = new BufferedReader(new InputStreamReader(new PipedInputStream(errOut))); | |
| t = new Thread( | |
| new Runnable() { | |
| public void run() { | |
| try { | |
| this.wait(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| eJzNWMt247gR/aFZ5WSLhSVZtjuWrDE17TPZQWSJxBEIMCBoNf8+twDwJcuZWWYjE7cKr3rcKlhqf5D | |
| 55SW3RmyoJed/k3ehd9uS4B8e7GXrBf8ECRW7rq2ctbXA96rz3hoWrEiVNIqerA56LFnL3HetOGipgm | |
| bcJqtcdxJvWn1SVGDR0RFpkp/UipWyNS2xAImVsxcy2qbTHZShPVGhhzkM3AjuTtxbV0u9ku4iPqwtN | |
| vgYpgWQPwZwpVxeBTR8bawPx81ko5UpRbjLDOCpYjhHwsLEOD2gOBkOrGUYfVQk/XJUOtm2b4bWVtvO | |
| iVdVVn60yUIj870m8eSSeSfZ8WrTbL7HnclQiJOfZR+vWR66urkoI9awekMuujwcVdYna/8fxhvlvOC | |
| fEB1KayrG4RNfa4qdMLzr/SB5JVP6SrxaUwafGHvdOHWePMHIHaUbCJFtLitt84tYayyr8uCtEPsVtb | |
| 4VHwgAKibUybM/yhMs/yeFSFpZe2kr0hz5CXqXhbLD4Lg/xhDILp3WwYscs9amyIiJIpsJeUbKBKe+y | |
| qKgmdq7VLq9GWL71kMJATBiG/KUeyyXIU3ClpkqTQPF8dDslxQo43rP0hTTvY4W8U6z7VZWTvNli+C1 | |
| yJV3klq1XuUMb60riV3Q+iH/AnS0jXgxxU8yPoZB25BpZSXenJGelCm61jsldUzjFitnqqAknsCts8a | |
| LR4RT21Ix4SvwoHgi6U7214QedAffJfsdpKH58lqBb5JC1mjp/0r25mCMnxKnjJd4wVkCxhYIcQniXA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void print(String tag, String message) { | |
| AttributeSet as = StyleContext.getDefaultStyleContext().addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, foregroundColor); | |
| try { | |
| if (isTimestampEnabled) { | |
| sdConsole.insertString(sdConsole.getLength(), "[" + timestampFormat.format(new Date()) + "] ", as); | |
| } | |
| sdConsole.insertString(sdConsole.getLength(), "[" , as); | |
| for (int i=0;i<tag.length();i++) { | |
| if (new Character(tag.charAt(i)).equals('\\')) { | |
| i++; |
NewerOlder