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


Java GraphicsEnvironment.getMaximumWindowBounds方法代碼示例

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


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

示例1: getScreenBoundsForPoint

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
/**
 * Returns the screen coordinates for the monitor that contains the
 * specified point.  This is useful for setups with multiple monitors,
 * to ensure that popup windows are positioned properly.
 *
 * @param x The x-coordinate, in screen coordinates.
 * @param y The y-coordinate, in screen coordinates.
 * @return The bounds of the monitor that contains the specified point.
 */
public static Rectangle getScreenBoundsForPoint(int x, int y) {
	GraphicsEnvironment env = GraphicsEnvironment.
									getLocalGraphicsEnvironment();
	GraphicsDevice[] devices = env.getScreenDevices();
	for (int i=0; i<devices.length; i++) {
		GraphicsConfiguration[] configs = devices[i].getConfigurations();
		for (int j=0; j<configs.length; j++) {
			Rectangle gcBounds = configs[j].getBounds();
			if (gcBounds.contains(x, y)) {
				return gcBounds;
			}
		}
	}
	// If point is outside all monitors, default to default monitor (?)
	return env.getMaximumWindowBounds();
}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:26,代碼來源:TipUtil.java

示例2: getScreenBoundsForPoint

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
/**
 * Returns the screen coordinates for the monitor that contains the
 * specified point.  This is useful for setups with multiple monitors,
 * to ensure that popup windows are positioned properly.
 *
 * @param x The x-coordinate, in screen coordinates.
 * @param y The y-coordinate, in screen coordinates.
 * @return The bounds of the monitor that contains the specified point.
 */
public static Rectangle getScreenBoundsForPoint(int x, int y) {
	GraphicsEnvironment env = GraphicsEnvironment.
									getLocalGraphicsEnvironment();
	GraphicsDevice[] devices = env.getScreenDevices();
	for (int i=0; i<devices.length; i++) {
		GraphicsConfiguration config = devices[i].getDefaultConfiguration();
		Rectangle gcBounds = config.getBounds();
		if (gcBounds.contains(x, y)) {
			return gcBounds;
		}
	}
	// If point is outside all monitors, default to default monitor (?)
	return env.getMaximumWindowBounds();
}
 
開發者ID:Thecarisma,項目名稱:powertext,代碼行數:24,代碼來源:Util.java

示例3: run

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
@Override
public void run() {
    try {
        boolean animateFromBottom = true;
        GraphicsEnvironment ge = GraphicsEnvironment
                .getLocalGraphicsEnvironment();
        Rectangle screenRect = ge.getMaximumWindowBounds();

        int screenHeight = (int) screenRect.height;

        int startYPosition;
        int stopYPosition;

        if (screenRect.y > 0) {
            animateFromBottom = false; // Animate from top!
        }

        maxToasterInSceen = screenHeight / toasterHeight;

        int posx = (int) screenRect.width - toasterWidth - 1;

        toaster.setLocation(posx, screenHeight);
        toaster.setVisible(true);
        if (useAlwaysOnTop) {
            toaster.setAlwaysOnTop(true);
        }

        if (animateFromBottom) {
            startYPosition = screenHeight;
            stopYPosition = startYPosition - toasterHeight - 1;
            if (currentNumberOfToaster > 0) {
                stopYPosition = stopYPosition - (maxToaster % maxToasterInSceen * toasterHeight);
            } else {
                maxToaster = 0;
            }
        } else {
            startYPosition = screenRect.y - toasterHeight;
            stopYPosition = screenRect.y;

            if (currentNumberOfToaster > 0) {
                stopYPosition = stopYPosition + (maxToaster % maxToasterInSceen * toasterHeight);
            } else {
                maxToaster = 0;
            }
        }
        currentNumberOfToaster++;
        maxToaster++;

        animateVertically(posx, startYPosition, stopYPosition);
        Thread.sleep(displayTime);
        animateVertically(posx, stopYPosition, startYPosition);

        currentNumberOfToaster--;
        toaster.setVisible(false);
        toaster.dispose();
    } catch (Exception e) {
        Logger.getLogger(Toaster.class.getName()).log(Level.SEVERE, null, e);
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:60,代碼來源:Toaster.java

示例4: run

import java.awt.GraphicsEnvironment; //導入方法依賴的package包/類
@Override
public void run() {
    try {
        boolean animateFromBottom = true;
        GraphicsEnvironment ge = GraphicsEnvironment
                .getLocalGraphicsEnvironment();
        Rectangle screenRect = ge.getMaximumWindowBounds();

        int screenHeight = (int) screenRect.height;

        int startYPosition;
        int stopYPosition;

        if (screenRect.y > 0) {
            animateFromBottom = false; // Animate from top!
        }

        maxToasterInSceen = screenHeight / toasterHeight;

        int posx = (int) screenRect.width - toasterWidth - 1;

        toaster.setLocation(posx, screenHeight);
        toaster.setVisible(true);
        if (useAlwaysOnTop) {
            toaster.setAlwaysOnTop(true);
        }

        if (animateFromBottom) {
            startYPosition = screenHeight;
            stopYPosition = startYPosition - toasterHeight - 1;
            if (currentNumberOfToaster > 0) {
                stopYPosition = stopYPosition - (maxToaster % maxToasterInSceen * toasterHeight);
            } else {
                maxToaster = 0;
            }
        } else {
            startYPosition = screenRect.y - toasterHeight;
            stopYPosition = screenRect.y;

            if (currentNumberOfToaster > 0) {
                stopYPosition = stopYPosition + (maxToaster % maxToasterInSceen * toasterHeight);
            } else {
                maxToaster = 0;
            }
        }
        currentNumberOfToaster++;
        maxToaster++;

        animateVertically(posx, startYPosition, stopYPosition);
        Thread.sleep(displayTime);
        animateVertically(posx, stopYPosition, startYPosition);

        currentNumberOfToaster--;
        toaster.setVisible(false);
        toaster.dispose();
    } catch (Exception e) {
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:59,代碼來源:Toaster.java


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