Пример #1
0
 /**
  * @param mgr
  * @param name
  * @param screen
  */
 public TextScreenConsole(ConsoleManager mgr, String name, TextScreen screen, int options) {
   super(mgr, name);
   this.options = options;
   this.screen = screen;
   this.scrWidth = screen.getWidth();
   this.scrHeight = screen.getHeight();
   this.out = new ConsoleWriter(this, 0x07);
   this.err = new ConsoleWriter(this, 0x04);
   this.savedOut = new PrintStream(new WriterOutputStream(this.out, false), true);
   this.savedErr = new PrintStream(new WriterOutputStream(this.err, false), true);
   this.claimSystemOutErr = false;
   this.myIsolate = VmIsolate.currentIsolate();
 }
Пример #2
0
 @Override
 public void focusLost(FocusEvent event) {
   if (in instanceof FocusListener) {
     ((FocusListener) in).focusLost(event);
   }
   if (claimSystemOutErr && VmSystem.hasVmIOContext()) {
     myIsolate.invokeAndWait(
         new Runnable() {
           public void run() {
             savedOut = System.out;
             savedErr = System.err;
           }
         });
   }
   super.focusLost(event);
 }
Пример #3
0
 @Override
 public void focusGained(FocusEvent event) {
   super.focusGained(event);
   syncScreen(0, screen.getWidth() * screen.getHeight());
   if (in instanceof FocusListener) {
     ((FocusListener) in).focusGained(event);
   }
   if (claimSystemOutErr && VmSystem.hasVmIOContext()) {
     myIsolate.invokeAndWait(
         new Runnable() {
           public void run() {
             AccessController.doPrivileged(
                 new PrivilegedAction<Object>() {
                   public Object run() {
                     System.setOut(savedOut);
                     System.setErr(savedErr);
                     return null;
                   }
                 });
           }
         });
   }
 }