Java Code Examples for javax.swing.JFrame.setAlwaysOnTop()

The following are Jave code examples for showing how to use setAlwaysOnTop() of the javax.swing.JFrame class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: openjdk-jdk10   File: JComboBoxPopupLocation.java   View Source Code Vote up 7 votes
private static void setup(final Point tmp) {
    comboBox = new JComboBox<>();
    for (int i = 1; i < 7; i++) {
        comboBox.addItem("Long-long-long-long-long text in the item-" + i);
    }
    String property = System.getProperty(PROPERTY_NAME);
    comboBox.putClientProperty(PROPERTY_NAME, Boolean.valueOf(property));
    frame = new JFrame();
    frame.setAlwaysOnTop(true);
    frame.setLayout(new FlowLayout());
    frame.add(comboBox);
    frame.pack();
    frame.setSize(frame.getWidth(), SIZE);
    frame.setVisible(true);
    frame.setLocation(tmp.x, tmp.y);
}
 
Example 2
Project: dracoon-dropzone   File: Dropzone.java   View Source Code Vote up 6 votes
/**
 * Show master password dialog if enabled
 */
private void showMasterPasswordEntry() {
	ConfigIO cfg = ConfigIO.getInstance();
	if (cfg.isMasterPwdEnabled()) {
		JPanel panel = new JPanel(new BorderLayout());
		JPasswordField pf = new JPasswordField();
		panel.setBorder(new EmptyBorder(0, 10, 0, 10));
		panel.add(pf, BorderLayout.NORTH);
		JFrame frame = new JFrame();
		frame.setAlwaysOnTop(true);

		int option = JOptionPane.showConfirmDialog(frame, panel, I18n.get("main.start.requestmasterpwd"),
				JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
		frame.dispose();
		if (option == JOptionPane.OK_OPTION) {
			cfg.setMasterPassword(new String(pf.getPassword()));
		} else {
			// TODO show config dialog
		}
	}
}
 
Example 3
Project: dracoon-dropzone   File: Dropzone.java   View Source Code Vote up 6 votes
/**
 * Show password dialog if enabled
 */
private String showPasswordDialog() {
	JPanel panel = new JPanel(new BorderLayout());
	JPasswordField pf = new JPasswordField();
	panel.setBorder(new EmptyBorder(0, 10, 0, 10));
	panel.add(pf, BorderLayout.NORTH);
	JFrame frame = new JFrame();
	frame.setAlwaysOnTop(true);
	pf.requestFocus();

	int option = JOptionPane.showConfirmDialog(frame, panel, I18n.get("main.start.sharelinkpwd"),
			JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
	frame.dispose();
	if (option == JOptionPane.OK_OPTION) {
		return new String(pf.getPassword());
	} else {
		return null;
	}
}
 
Example 4
Project: ObsidianSuite   File: BaseFrame.java   View Source Code Vote up 5 votes
public BaseFrame(String title)
{
	frame = new JFrame(title);
	
	mainPanel = new JPanel();
	mainPanel.setLayout(new GridBagLayout());
	mainPanel.setPreferredSize(new Dimension(300, 200));
			
	frame.setContentPane(mainPanel);
	frame.pack();
	frame.setLocationRelativeTo(null);
	frame.setResizable(false);
	frame.setAlwaysOnTop(true);
	frame.setLocation(Display.getX() + Display.getWidth()/2 - frame.getWidth()/2, Display.getY() + Display.getHeight()/2 - frame.getHeight()/2);
}
 
Example 5
Project: openjdk-jdk10   File: MouseModifiersInKeyEvent.java   View Source Code Vote up 5 votes
private static void createAndShowGUI() {
    f = new JFrame();

    final Component component = new JTextField();
    component.addKeyListener(new MyKeyListener());

    f.add(component);
    f.setSize(300, 300);
    f.setLocationRelativeTo(null);
    f.setAlwaysOnTop(true);
    f.setVisible(true);
}
 
Example 6
Project: geomapapp   File: MapApp.java   View Source Code Vote up 5 votes
protected void initLayerManager() {

		JFrame d = new JFrame();
		d.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				((JCheckBoxMenuItem)(XML_Menu.commandToMenuItemHash.get("layer_manager_cmd"))).setSelected(false);
			}
		});
		LayerManager lm;
		
		//use existing layer manager if it already exists
		if (layerManager != null) {
			lm = layerManager;
		} else {
			lm = new LayerManager();
		}
		
		lm.setLayerList( toLayerList(map.overlays) );
		lm.setMap(map);

		lm.setDialog(d);
		JScrollPane sp = new JScrollPane(lm);
		sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		d.setTitle("Layer Manager");
		d.setContentPane(sp);
//		d.getContentPane().add(sp);
		d.pack();
		d.setSize(new Dimension(lm.getPreferredSize().width+20,lm.getPreferredSize().height+55));
		d.setMaximumSize(new Dimension(400,300));

		d.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
		d.setLocationRelativeTo(frame);
		d.setState(Frame.NORMAL);
		d.setAlwaysOnTop(true);
		this.layerManager = lm;
		this.layerManagerDialog = d;	
	}
 
Example 7
Project: sbc-qsystem   File: ABoardFX.java   View Source Code Vote up 5 votes
private void initAndShowGUI() {
    JFrame w = new JFrame();
    w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    if (!QConfig.cfg().isDebug()) {
        w.setUndecorated(true);
    }
    // Create JavaFX panel.
    /* todo
    javafxPanel = new JFXPanel();
    javafxPanel.setPreferredSize(new Dimension(win_w, win_h));
    w.getContentPane().add(javafxPanel, BorderLayout.CENTER);
     * 
     */

    initFXscene();

    // Show frame.
    w.pack();
    w.setLocationRelativeTo(null);
    w.setVisible(true);
    if (QConfig.cfg().isDebug()) {
        w.setBounds(100, 100, 1024, 768);
    } else {
        w.setBounds(win_x, win_y, win_w, win_h);
        w.setAlwaysOnTop(true);
    }
}
 
Example 8
Project: dracoon-dropzone   File: TrayPopupMenu.java   View Source Code Vote up 4 votes
@Override
public void actionPerformed(ActionEvent e) {
	if (e.getSource() == itemExit) {
		System.exit(0);
	} else if (e.getSource() == itemSettings) {
		SettingsDialog dialog = new SettingsDialog();
		JFrame frame = new JFrame();
		frame.setAlwaysOnTop(true);
		int result = JOptionPane.showConfirmDialog(frame, dialog, I18n.get("tray.settings"),
				JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
		frame.dispose();
		
		if (result == JOptionPane.OK_OPTION) {

			String username = dialog.getUserName().getText();
			String serverUrl = dialog.getServerUrl().getText();
			String storagePath = dialog.getStoragePath().getText();
			String password = new String(dialog.getPassword().getPassword());
			String masterPassword = new String(dialog.getMasterPwd().getPassword());
			boolean isMasterPwdEnabled = dialog.isMasterPwdEnabled();
			boolean isUseDarkIcon = dialog.isUseDarkIcon();

			ScreenModel screenModel = dialog.getSelectedScreen();
			ScreenPosition screenPos = dialog.getSelectedScreenPosition();
			AuthModel authMethod = dialog.getSelectedAuthMethod();

			ConfigIO cfg = ConfigIO.getInstance();
			cfg.setUsername(username);
			
			// important: first set masterpwd
			// and masterpwd enabled before
			// setting the pwd
			cfg.setMasterPwdEnabled(isMasterPwdEnabled);
			cfg.setMasterPassword(masterPassword);
			cfg.setPassword(password);
			cfg.setServerUrl(serverUrl);
			cfg.setStoragePath(storagePath);
			cfg.setScreenId(screenModel.getIdString());
			cfg.setAuthMethod(authMethod.getType().getId());
			cfg.setScreenPositionId(String.valueOf(screenPos.getPos().getId()));
			cfg.setUseDarkIcon(isUseDarkIcon);
			cfg.save();
		}
	}

}
 
Example 9
Project: What-Happened-to-Station-7   File: Station7.java   View Source Code Vote up 4 votes
public static void main(String... args) throws Throwable
{
	JFrame window = new JFrame();
	window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	window.setTitle("What Happened to Station 7");
	window.setMinimumSize(new Dimension(400, 225));
	window.setLayout(new GridBagLayout());
	window.setExtendedState(JFrame.MAXIMIZED_BOTH);

	JFrame opening_text = new JFrame();
	opening_text.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	opening_text.setTitle("This Is What Happened to Station 7");
	JTextArea textField = new JTextArea(
			"The date is 123.5432.1241511    Station 7 is in full operation when suddenly one of the arachnids spot a rather large blue and yellow battle-cruiser barreling towards the aft section of the outer wheel. It suddenly plunges it self deep within the station. The flag suddenly comes within view… Its the swedes on their eternal quest to increase their GDP. They start to scatter but they are not quick enough to survive the army of Carl XVI Gustaf. The Dramatic entrance of the battle-cruiser had created a hull breach and the amount of air in the station was starting to drop; those blast doors can only hold so long….																																																		You Play as the aliens represented by the Purple hexes your objective is to get to the next floor of Staition 7 via the cyan ecape doors the sweds represented by the blue tiles are out to get you it would be in your best intrests to avoid them as they will kill you very quickly, if you notics your color shifting it indicats a change in helth and you will be best adviced to seek out the red health boxes but be carful as they will only heal you so much");
	textField.setLineWrap(true);
	textField.setWrapStyleWord(true);
	opening_text.setMinimumSize(new Dimension(400, 225));
	opening_text.add(textField, BorderLayout.PAGE_START);
	opening_text.setExtendedState(JFrame.MAXIMIZED_BOTH);
	opening_text.setAlwaysOnTop(true);

	JFrame closing_text = new JFrame();
	closing_text.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	closing_text.setTitle("You Have Fell to the Swedes");
	JTextArea text = new JTextArea("You have failed to save your self…. The swedes trudge on obliterating the remaining inhabitants of the station. ");
	text.setLineWrap(true);
	text.setWrapStyleWord(true);
	closing_text.setMinimumSize(new Dimension(400, 225));
	closing_text.add(text, BorderLayout.PAGE_START);
	closing_text.setExtendedState(JFrame.MAXIMIZED_BOTH);

	SoundStuff soundStuff = new SoundStuff();
	soundStuff.dbol();

	Game game = new Game();

	GameRenderer render = new GameRenderer(game);
	render.addListeners(window);
	GridBagConstraints layoutGame = new GridBagConstraints();
	layoutGame.weightx = .9;
	layoutGame.weighty = .9;
	layoutGame.fill = GridBagConstraints.BOTH;
	layoutGame.anchor = GridBagConstraints.NORTH;
	window.add(render, layoutGame);

	GameInfo info = new GameInfo(game);
	info.addListeners();
	GridBagConstraints layoutInfo = new GridBagConstraints();
	layoutInfo.weightx = .1;
	layoutInfo.weighty = .1;
	layoutInfo.fill = GridBagConstraints.BOTH;
	layoutInfo.anchor = GridBagConstraints.NORTH;
	layoutInfo.gridy = 1;
	window.add(info, layoutInfo);

	game.init(render.new UIInterface(), info.new UIInterface());

	closing_text.setVisible(true);
	window.setVisible(true);
	opening_text.setVisible(true);
	Scanner reader = new Scanner(System.in);
	int n = reader.nextInt();
	if (n == 42)
	{
		System.out.print("adadfafd");
		SoundStuff cam = null;
		cam = new SoundStuff();
		cam.CCCP();
		reader.close();
	}
}