本文整理了Java中javax.swing.JFrame.requestFocus()
方法的一些代码示例,展示了JFrame.requestFocus()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JFrame.requestFocus()
方法的具体详情如下:
包路径:javax.swing.JFrame
类名称:JFrame
方法名:requestFocus
暂无
代码示例来源:origin: chungkwong/MathOCR
/**
* Set the console visible
*/
public void show(){
dia.setVisible(true);
dia.requestFocus();
}
}
代码示例来源:origin: MegaMek/megamek
/**
* Sets the visibility of the entity display window
*/
public void setDisplayVisible(boolean visible) {
skinSpecEditorD.setVisible(visible);
if (visible) {
frame.requestFocus();
}
}
代码示例来源:origin: MegaMek/megamek
/**
* Sets the visibility of the minimap window
*/
void setMapVisible(boolean visible) {
minimapW.setVisible(visible);
if (visible) {
frame.requestFocus();
}
}
代码示例来源:origin: chungkwong/MathOCR
/**
* Show message in the dialog
* @param buf the message
* @param off the offset of the message
* @param len the length of the message
*/
public void write(byte[] buf,int off,int len){
area.append(new String(buf,off,len));
area.setCaretPosition(area.getText().length());
dia.setVisible(true);
dia.requestFocus();
}
/**
代码示例来源:origin: org.netbeans.api/org-openide-io
public void requestActive() {
if (frame == null) {
open();
}
frame.requestFocus();
}
代码示例来源:origin: com.b3dgs.lionengine/lionengine-core-awt
@Override
public void requestFocus()
{
frame.requestFocus();
super.requestFocus();
}
代码示例来源:origin: stackoverflow.com
JFrame frame = new JFrame();
GraphicsDevice window = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()[0];
//The number in the brackets decides what monitor the window gets "full-screened" to. 0 is the first, 1 is the second, ect.
frame.setUndecorated(true);
window.setFullScreenWindow(frame);
frame.setVisible(true);
frame.requestFocus();
代码示例来源:origin: stackoverflow.com
AutoClicker clicker = new AutoClicker();
JFrame frame = new JFrame();
frame.addKeyListener(clicker);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(new Dimension(200,300));
frame.setVisible(true);
frame.setFocusable(true);
frame.requestFocus();
代码示例来源:origin: stackoverflow.com
public class WinTest extends Canvas {
private static final long serialVersionUID = -369751247370351003L;
public WinTest(int h, int w, String title, Wincall game, ME me) {
JFrame f = new JFrame(title);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(h, w);
f.add(game);
f.setVisible(true);
f.requestFocus();
f.setResizable(false);
f.setFocusable(true);
// f.addMouseMotionListener(me);
game.addMouseMotionListener(me);
game.run();
}
}
代码示例来源:origin: MegaMek/megamek
/**
* Toggles the entity display window
*/
private void toggleDisplay() {
mechW.setVisible(!mechW.isVisible());
if (mechW.isVisible()) {
frame.requestFocus();
}
}
代码示例来源:origin: com.harium.propan/propan-jogl
protected void init() {
frame.requestFocus();
frame.setVisible(true);
//startThread();
//TODO Update Methods
executor = Executors.newSingleThreadScheduledExecutor();
future = executor.scheduleAtFixedRate(glCore, UPDATE_DELAY, UPDATE_DELAY, TimeUnit.MILLISECONDS);
frame.add(glCore.getPanel());
AWTCore.hideDefaultCursor(frame);
updateIcon();
glCore.start();
}
代码示例来源:origin: triplea-game/triplea
/**
* Sets the 'main frame' to visible. In this context the main frame is the initial
* welcome (launch lobby/single player game etc..) screen presented to GUI enabled clients.
*/
public static void showMainFrame() {
SwingUtilities.invokeLater(() -> {
mainFrame.requestFocus();
mainFrame.toFront();
mainFrame.setVisible(true);
});
ProAi.gameOverClearCache();
loadGame();
if (System.getProperty(TRIPLEA_SERVER, "false").equals("true")) {
setupPanelModel.showServer();
System.clearProperty(TRIPLEA_SERVER);
} else if (System.getProperty(TRIPLEA_CLIENT, "false").equals("true")) {
setupPanelModel.showClient();
System.clearProperty(TRIPLEA_CLIENT);
}
}
代码示例来源:origin: de.dfki.mary/marytts-client
public void actionPerformed(ActionEvent e) {
if (!isHelpWindowOpen) {
isHelpWindowOpen = true;
helpWindow = new JFrame("Help: " + chkEnabled.getText() + " Effect");
JTextArea helpTextArea = new JTextArea(data.getHelpText());
helpTextArea.setEditable(false);
helpWindow.getContentPane().add(helpTextArea, BorderLayout.WEST);
helpWindow.pack();
helpWindow.setLocation(btnHelp.getLocation().x, btnHelp.getLocation().y);
helpWindow.setVisible(true);
helpWindow.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(WindowEvent winEvt) {
// Perhaps ask user if they want to save any unsaved files first.
isHelpWindowOpen = false;
}
});
} else {
if (helpWindow != null)
helpWindow.requestFocus();
}
}
});
代码示例来源:origin: stackoverflow.com
JFrame frame = ...;
frame.setExtendedState(JFrame.NORMAL);
frame.setAlwaysOnTop(true);
frame.requestFocus();
frame.setAlwaysOnTop(false);
代码示例来源:origin: org.jppf/jppf-common-node
@Override
public void toFront() {
if (alreadyCalled) return;
try {
alreadyCalled = true;
super.setVisible(true);
int state = super.getExtendedState();
state &= ~Frame.ICONIFIED;
super.setExtendedState(state);
super.setAlwaysOnTop(true);
super.toFront();
super.requestFocus();
super.setAlwaysOnTop(false);
} finally {
alreadyCalled = false;
}
}
}
代码示例来源:origin: MegaMek/megamek
/**
* Toggles the minimap window Also, toggles the minimap enabled setting
*/
private void toggleMap() {
if (minimapW.isVisible()) {
GUIPreferences.getInstance().setMinimapEnabled(false);
} else {
GUIPreferences.getInstance().setMinimapEnabled(true);
}
minimapW.setVisible(!minimapW.isVisible());
if (minimapW.isVisible()) {
frame.requestFocus();
}
}
代码示例来源:origin: de.sciss/scisslib
protected void deactivateHelpMode()
{
if( f.getGlassPane() != this ) return;
this.setVisible( false );
f.setGlassPane( normalGlassPane );
f.setFocusTraversalPolicy( normalFocus );
normalGlassPane = null;
normalFocus = null;
focussedHelpComponent = null;
focussedArea.reset();
f.requestFocus();
}
代码示例来源:origin: otros-systems/otroslogviewer
public static void frameToFront(JFrame frame) {
int state = frame.getExtendedState();
state &= ~JFrame.ICONIFIED;
frame.setExtendedState(state);
frame.setAlwaysOnTop(true);
frame.toFront();
frame.requestFocus();
frame.setAlwaysOnTop(false);
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
@Override
public void actionPerformed(ActionEvent e) {
Application a = getApplication();
if (a.getActiveView() == null && a.views().size() > 0) {
View v = a.views().iterator().next();
Component c = SwingUtilities.getRootPane(v.getComponent()).getParent();
if (c instanceof JFrame) {
JFrame f = (JFrame) c;
if ((f.getExtendedState() & JFrame.ICONIFIED) != 0) {
f.setExtendedState(f.getExtendedState() ^ JFrame.ICONIFIED);
}
f.requestFocus();
}
}
}
}
代码示例来源:origin: org.jppf/jppf-common-node
@Override
public void setVisible(final boolean visible) {
// make sure that frame is marked as not disposed if it is asked to be visible
if (visible) {
//setDisposed(false);
}
// let's handle visibility...
if (!visible || !isVisible()) { // have to check this condition simply because super.setVisible(true) invokes toFront if frame was already visible
super.setVisible(visible);
}
// ...and bring frame to the front.. in a strange and weird way
if (visible) {
int state = super.getExtendedState();
state &= ~Frame.ICONIFIED;
super.setExtendedState(state);
super.setAlwaysOnTop(true);
super.toFront();
super.requestFocus();
super.setAlwaysOnTop(false);
}
}
内容来源于网络,如有侵权,请联系作者删除!