當前位置: 首頁>>代碼示例>>Java>>正文


Java JFrame.setAlwaysOnTop方法代碼示例

本文整理匯總了Java中javax.swing.JFrame.setAlwaysOnTop方法的典型用法代碼示例。如果您正苦於以下問題:Java JFrame.setAlwaysOnTop方法的具體用法?Java JFrame.setAlwaysOnTop怎麽用?Java JFrame.setAlwaysOnTop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JFrame的用法示例。


在下文中一共展示了JFrame.setAlwaysOnTop方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showMasterPasswordEntry

import javax.swing.JFrame; //導入方法依賴的package包/類
/**
 * 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
		}
	}
}
 
開發者ID:michaelnetter,項目名稱:dracoon-dropzone,代碼行數:24,代碼來源:Dropzone.java

示例2: setup

import javax.swing.JFrame; //導入方法依賴的package包/類
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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:17,代碼來源:JComboBoxPopupLocation.java

示例3: showPasswordDialog

import javax.swing.JFrame; //導入方法依賴的package包/類
/**
 * 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;
	}
}
 
開發者ID:michaelnetter,項目名稱:dracoon-dropzone,代碼行數:22,代碼來源:Dropzone.java

示例4: initLayerManager

import javax.swing.JFrame; //導入方法依賴的package包/類
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;	
	}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:38,代碼來源:MapApp.java

示例5: BaseFrame

import javax.swing.JFrame; //導入方法依賴的package包/類
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);
}
 
開發者ID:ObsidianSuite,項目名稱:ObsidianSuite,代碼行數:16,代碼來源:BaseFrame.java

示例6: createAndShowGUI

import javax.swing.JFrame; //導入方法依賴的package包/類
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);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:13,代碼來源:MouseModifiersInKeyEvent.java

示例7: initAndShowGUI

import javax.swing.JFrame; //導入方法依賴的package包/類
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);
    }
}
 
開發者ID:bcgov,項目名稱:sbc-qsystem,代碼行數:28,代碼來源:ABoardFX.java

示例8: actionPerformed

import javax.swing.JFrame; //導入方法依賴的package包/類
@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();
		}
	}

}
 
開發者ID:michaelnetter,項目名稱:dracoon-dropzone,代碼行數:47,代碼來源:TrayPopupMenu.java

示例9: main

import javax.swing.JFrame; //導入方法依賴的package包/類
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();
	}
}
 
開發者ID:Chroniaro,項目名稱:What-Happened-to-Station-7,代碼行數:72,代碼來源:Station7.java


注:本文中的javax.swing.JFrame.setAlwaysOnTop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。