frame.setVisible(true); screen.requestFocus();
SwingUtilities.invokeLater(new Runnable() { public void run() { frame.setVisible(true); screen.requestFocus(); } });
    public SwingPcTextScreen() {        super(SCREEN_WIDTH, SCREEN_HEIGHT);        buffer = new char[SCREEN_WIDTH * SCREEN_HEIGHT];        AccessController.doPrivileged(new PrivilegedAction() {            public Object run() {                screen = new SwingPcScreen();                for (int i = 0; i < buffer.length; i ++) {                    buffer[i] = ' ';                }                /*                for (String s : GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames()) {                    System.out.println(s);                }                */                frame = new JFrame("Console");                frame.setLayout(new BorderLayout());                frame.add(screen, BorderLayout.CENTER);                frame.pack();                frame.setVisible(true);                screen.requestFocus();                return null;            }        });    }