Java Code Examples for java.awt.Window#setAlwaysOnTop()

The following examples show how to use java.awt.Window#setAlwaysOnTop() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SyncAlwaysOnTopFieldTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 2
Source File: SyncAlwaysOnTopFieldTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 3
Source File: SyncAlwaysOnTopFieldTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 4
Source File: SyncAlwaysOnTopFieldTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 5
Source File: SyncAlwaysOnTopFieldTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 6
Source File: SyncAlwaysOnTopFieldTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 7
Source File: SyncAlwaysOnTopFieldTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 8
Source File: SyncAlwaysOnTopFieldTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 9
Source File: SyncAlwaysOnTopFieldTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 10
Source File: SyncAlwaysOnTopFieldTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 11
Source File: SyncAlwaysOnTopFieldTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    final Window rootWindow = createWindow(null);

    new Thread(() -> {
        for (int i = 0; i < WINDOWS_COUNT; i++) {
            createWindow(rootWindow);
        }
    }).start();

    boolean alwaysOnTop = true;
    for (int i = 0; i < STEPS_COUNT; i++) {
        Thread.sleep(10);
        rootWindow.setAlwaysOnTop(alwaysOnTop);
        alwaysOnTop = !alwaysOnTop;
    }
}
 
Example 12
Source File: UiUtils.java    From pgptool with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Hack to make sure window is visible. On windows it's sometimes created but on
 * a background. User can see "flashing" icon in a task bar but window stays on
 * a background.
 * 
 * PRESUMING: setVisible(true) was already called
 * 
 * More ion tihs jere:
 * http://stackoverflow.com/questions/309023/how-to-bring-a-window-to-the-front
 */
public static void makeSureWindowBroughtToFront(Window window) {
	// int state = dialog.getExtendedState();
	// state &= ~JFrame.ICONIFIED;
	// dialog.setExtendedState(state);
	window.setAlwaysOnTop(true);
	window.toFront();
	window.requestFocus();
	window.setAlwaysOnTop(false);
	window.repaint();
}
 
Example 13
Source File: WizardLifecycle.java    From raccoon4 with Apache License 2.0 5 votes vote down vote up
@Override
public final Window onCreatePrimaryWindow(Globals globals) {

	panel = new JPanel();
	cardLayout = new CardLayout();
	panel.setLayout(cardLayout);
	WizardBuilder[] tmp = { new AccountLogic(), new LoginLogic(),
			new DeviceLogic(), new UploadLogic(), new ProxyLogic(),
			new MimicLogic(), new AliasLogic() };
	builders = tmp;

	ActionLocalizer al = globals.get(ActionLocalizer.class);
	next = new JButton(al.localize("next"));
	previous = new JButton(al.localize("previous"));
	next.addActionListener(this);
	previous.addActionListener(this);

	for (WizardBuilder logic : builders) {
		panel.add(logic.build(globals), logic.getClass().getName());
	}
	active = builders[0];
	active.onActivate(next, previous);

	DialogBuilder db = new DialogBuilder(new AdapterBuilder(panel))
			.withTitle(Messages.getString("WizardLifecycle.titlestrip.title"))
			.withSubTitle(Messages.getString("WizardLifecycle.titlestrip.subtitle"))
			.withHelp(al.localize(new BrowseAction(helpurl), "helpbutton"))
			.withButtons(new ButtonBarBuilder().add(previous).add(next));

	Window ret = new WindowBuilder(db).withIcons("/icons/appicon.png")
			.withFixedSize().withTitle(Messages.getString("WizardLifecycle.title"))
			.build(globals);
	ret.setAlwaysOnTop(true);
	return ret;
}
 
Example 14
Source File: PTextInputDialog.java    From PolyGlot with MIT License 5 votes vote down vote up
private void setParentModalOntop(Window _parent) {
    if (_parent instanceof JDialog && ((JDialog)_parent).isModal()) {
        parentModal = true;
        ((JDialog)_parent).setModal(false);
    }
    
    if (_parent.isAlwaysOnTop()) {
        parentAlwaysOnTop = true;
        _parent.setAlwaysOnTop(false);
    }
}
 
Example 15
Source File: ShowRowAction.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void actionPerformed(ActionEvent e) {
	Window dlg = getTable().getEditor(getRow());
	if (dlg != null) {
		if (dlg instanceof Frame) {
			((Frame) dlg).setState(Frame.NORMAL);
			((Frame) dlg).requestFocus();
		}
		dlg.setLocationRelativeTo(null);
		dlg.setAlwaysOnTop(true);
		dlg.setVisible(true);
	}
}