File: MyConsole.java

package info (click to toggle)
mauve-aligner 2.4.0%2B4736-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,480 kB
  • sloc: java: 28,417; xml: 300; sh: 97; makefile: 21
file content (49 lines) | stat: -rw-r--r-- 1,064 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package org.gel.mauve;

import gr.zeus.ui.JConsole;


import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.PrintStream;

public class MyConsole {
	private static boolean useSwing = false;

	private static JConsole console = new JConsole();

	public static void setUseSwing (boolean b) {
		if (b && !useSwing) {
			console.setTitle ("Mauve Console");
			console.setSize (400, 400);
			Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
			console.setLocation(dim.width-400, 0);
			JConsole.getConsole().startConsole ();
			if (!console.isVisible()) {
				console.setVisible(true);
			}
		} else if (!b && useSwing) {
			JConsole.getConsole().stopConsole ();
			console = null;
		}

		useSwing = b;
	}

	public static void showConsole () {
		if (useSwing) {
			JConsole.getConsole().showConsole ();
		}
	}

	public static PrintStream err () {
		if (useSwing) {
			JConsole.getConsole().showConsole ();
		}
		return System.err;
	}

	public static PrintStream out () {
		return System.out;
	}
}