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


Java JFrame.isVisible方法代碼示例

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


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

示例1: waitForLoading

import javax.swing.JFrame; //導入方法依賴的package包/類
private void waitForLoading(final URL url, final JFrame f, final HtmlBrowser.Impl impl) 
        throws InvocationTargetException, InterruptedException {

    for (int i = 0; i < 10 && f.isVisible(); i++) {
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                URL current = impl.getURL();
                if (url.equals(current)) {
                    f.setVisible(false);
                    f.dispose();
                }
            }
        });
        Thread.sleep(i*100);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:SwingBrowserTest.java

示例2: create

import javax.swing.JFrame; //導入方法依賴的package包/類
/**
 * creates a JFrame and a background Thread managing the rendering and the Frame itself.
 */
public static void create(){
if(!running){
	running = true;
	GFrame = new JFrame();
	GFrame.setVisible(true);
	RefreshWindow();
	RegisterInputDevices();
	BStrategy = GFrame.getBufferStrategy();
	setCurrentscreen(new EmptyScreen());
	PhySIX = new Thread(new Runnable(){
		@Override
		public void run() {
			try {
				while(GFrame.isVisible()){
					Graphics g = BStrategy.getDrawGraphics();
					clearScreen(g);
					updateDHs(g);
					renderDHs(g);
					drawDHs(g);
					drawmodels(g);
					UpdateStrat(g);
					Sync();
				}
			} catch (LessThanZeroException e) {
				e.printStackTrace();
			}
		}
	}, "Display-Loop-Thread.");
	PhySIX.start();
}
}
 
開發者ID:PhentixDevs,項目名稱:PhySIX,代碼行數:35,代碼來源:Display.java

示例3: saveScreenAndDimensions

import javax.swing.JFrame; //導入方法依賴的package包/類
private void saveScreenAndDimensions(JFrame frame) {
    if (!frame.isVisible()) {
        return;
    }

    // check multiple displays
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] screens = ge.getScreenDevices();
    Point pos = frame.getLocationOnScreen();
    Dimension size = frame.getSize();
    if (screens.length == 1) {
        Config.instance().to().setProperty(Config.Entry.POS_X.key(), pos.x);
        Config.instance().to().setProperty(Config.Entry.POS_Y.key(), pos.y);
        Config.instance().to().setProperty(Config.Entry.POS_WIDTH.key(), size.width);
        Config.instance().to().setProperty(Config.Entry.POS_HEIGHT.key(), size.height);
        logger.info("Saved window dimensions to config file (single screen found)");
    } else {
        Rectangle screenBounds = frame.getGraphicsConfiguration().getBounds();
        pos.x -= screenBounds.x;
        pos.y -= screenBounds.y;
        GraphicsDevice device = frame.getGraphicsConfiguration().getDevice();
        Config.instance().to().setProperty(Config.Entry.SCREEN_POS_X.key(), pos.x);
        Config.instance().to().setProperty(Config.Entry.SCREEN_POS_Y.key(), pos.y);
        Config.instance().to().setProperty(Config.Entry.SCREEN_POS_WIDTH.key(), size.width);
        Config.instance().to().setProperty(Config.Entry.SCREEN_POS_HEIGHT.key(), size.height);
        
        Config.instance().to().setProperty(Config.Entry.SCREEN.key(), device.getIDstring());
        logger.info("Saved window dimensions to config file (multi screen found)");
    }
    
}
 
開發者ID:rjaros87,項目名稱:pm-home-station,代碼行數:32,代碼來源:Station.java

示例4: isMatching

import javax.swing.JFrame; //導入方法依賴的package包/類
@Override
public boolean isMatching(JFrame frame) {
	return frame.isVisible() && frame.getTitle().startsWith(textToMatch);
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:5,代碼來源:PartialTitleFrameMatcher.java

示例5: test

import javax.swing.JFrame; //導入方法依賴的package包/類
public static void test() {
    // Right click Frame-1
    robot.mouseMove(frame1.getLocation().x + 100, frame1.getLocation().y + 200);
    robot.mousePress(InputEvent.BUTTON3_MASK);
    robot.mouseRelease(InputEvent.BUTTON3_MASK);

    robot.delay(1000);

    // Left click Frame-2
    robot.mouseMove(frame2.getLocation().x + 100, frame1.getLocation().y + 200);
    robot.mousePress(InputEvent.BUTTON1_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_MASK);

    robot.delay(1000);

    JComponent focusOwner = (JComponent)KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    JFrame focusedWindow = (JFrame)KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow();

    System.out.println("focus owner: " + focusOwner);
    System.out.println("focused window: " + focusedWindow);

    // Verify that the focused window is the ancestor of the focus owner
    if (!focusedWindow.isAncestorOf(focusOwner)) {
        throw new RuntimeException("The focus owner is not in the focused window!");
    }

    if (!OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
        // Try to close native focused window
        robot.keyPress(KeyEvent.VK_ALT);
        robot.keyPress(KeyEvent.VK_F4);
        robot.keyRelease(KeyEvent.VK_F4);
        robot.keyRelease(KeyEvent.VK_ALT);
        robot.delay(1000);
        // Verify that the Java focused window really mapped the native focused window.
        if (focusedWindow.isVisible()) {
            throw new RuntimeException("The focused window is different on Java and on the native level.");
        }
    } else {
        // Try to move native focus to previous window
        robot.keyPress(KeyEvent.VK_CONTROL);
        robot.keyPress(KeyEvent.VK_F4);
        robot.keyRelease(KeyEvent.VK_F4);
        robot.keyRelease(KeyEvent.VK_CONTROL);
        robot.delay(1000);
        // Verify that the Java focused window really mapped the native focused window.
        if (focusedWindow.isFocused()) {
            throw new RuntimeException("The focused window is different on Java and on the native level.");
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:51,代碼來源:MouseClickRequestFocusRaceTest.java


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