Example usage for javax.swing JFrame setFocusableWindowState

List of usage examples for javax.swing JFrame setFocusableWindowState

Introduction

In this page you can find the example usage for javax.swing JFrame setFocusableWindowState.

Prototype

public void setFocusableWindowState(boolean focusableWindowState) 

Source Link

Document

Sets whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow .

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JFrame frame = new JFrame();
    frame.setFocusableWindowState(false);
}

From source file:ConsoleWindowTest.java

public static void init() {
    JFrame frame = new JFrame();
    frame.setTitle("ConsoleWindow");
    final JTextArea output = new JTextArea();
    output.setEditable(false);/*from  w ww . ja v a  2 s  . co  m*/
    frame.add(new JScrollPane(output));
    frame.setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
    frame.setLocation(DEFAULT_LEFT, DEFAULT_TOP);
    frame.setFocusableWindowState(false);
    frame.setVisible(true);

    // define a PrintStream that sends its bytes to the output text area
    PrintStream consoleStream = new PrintStream(new OutputStream() {
        public void write(int b) {
        } // never called

        public void write(byte[] b, int off, int len) {
            output.append(new String(b, off, len));
        }
    });

    // set both System.out and System.err to that stream
    System.setOut(consoleStream);
    System.setErr(consoleStream);
}