当前位置: 首页>>代码示例>>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;未经允许,请勿转载。