本文整理汇总了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
}
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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();
}
}
}
示例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();
}
}