Example usage for java.awt Window setName

List of usage examples for java.awt Window setName

Introduction

In this page you can find the example usage for java.awt Window setName.

Prototype

public void setName(String name) 

Source Link

Document

Sets the name of the component to the specified string.

Usage

From source file:MainClass.java

public static void main(String[] args) {
    JDialog d1 = new JDialog((JFrame) null, "Dialog 1");
    d1.setName("Dialog 1");

    JDialog d2 = new JDialog((Window) null, "Dialog 2");
    d2.setName("Dialog 2");

    Frame f = new Frame();
    f.setName("Frame 1");

    Window w1 = new Window(f);
    w1.setName("Window 1");

    Window w2 = new Window(null);
    w2.setName("Window 2");

    Window[] windows = Window.getWindows();
    for (Window window : windows)
        System.out.println(window.getName() + ": " + window.getClass());

}

From source file:MainClass.java

public static void main(String[] args) {
    JDialog d1 = new JDialog((JFrame) null, "Dialog 1");
    d1.setName("Dialog 1");

    JDialog d2 = new JDialog((Window) null, "Dialog 2");
    d2.setName("Dialog 2");

    Frame f = new Frame();
    f.setName("Frame 1");

    Window w1 = new Window(f);
    w1.setName("Window 1");

    Window w2 = new Window(null);
    w2.setName("Window 2");

    Window[] ownerlessWindows = Window.getOwnerlessWindows();
    for (Window window : ownerlessWindows)
        System.out.println(window.getName() + ": " + window.getClass());

}

From source file:MainClass.java

public static void main(String[] args) {
    JDialog d1 = new JDialog((JFrame) null, "Dialog 1");
    d1.setName("Dialog 1");

    JDialog d2 = new JDialog((Window) null, "Dialog 2");
    d2.setName("Dialog 2");

    Frame f = new Frame();
    f.setName("Frame 1");

    Window w1 = new Window(f);
    w1.setName("Window 1");

    Window w2 = new Window(null);
    w2.setName("Window 2");

    System.out.println("FRAME WINDOWS");
    Frame[] frames = Frame.getFrames();
    for (Frame frame : frames)
        System.out.println(frame.getName() + ": " + frame.getClass());

}

From source file:Main.java

/** Sets the title of the given window. */
public static void setWindowTitle(final Window w, final String title) {
    if (w instanceof Frame)
        ((Frame) w).setTitle(title);
    else if (w instanceof Dialog)
        ((Dialog) w).setTitle(title);
    else//from ww w  .  j  a v  a 2  s  . c  o  m
        w.setName(title);
}