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


Java SplashScreen.getBounds方法代碼示例

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


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

示例1: testSplash

import java.awt.SplashScreen; //導入方法依賴的package包/類
static void testSplash(ImageInfo test) throws Exception {
    SplashScreen splashScreen = SplashScreen.getSplashScreen();
    if (splashScreen == null) {
        throw new RuntimeException("Splash screen is not shown!");
    }
    Graphics2D g = splashScreen.createGraphics();
    Rectangle splashBounds = splashScreen.getBounds();
    int screenX = (int) splashBounds.getCenterX();
    int screenY = (int) splashBounds.getCenterY();
    Robot robot = new Robot();
    Color splashScreenColor = robot.getPixelColor(screenX, screenY);

    float scaleFactor = getScaleFactor();
    Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;
    if (!compare(testColor, splashScreenColor)) {
        throw new RuntimeException(
                "Image with wrong resolution is used for splash screen!");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:UnixMultiResolutionSplashTest.java

示例2: testSplash

import java.awt.SplashScreen; //導入方法依賴的package包/類
static void testSplash(ImageInfo test) throws Exception {
    SplashScreen splashScreen = SplashScreen.getSplashScreen();

    if (splashScreen == null) {
        throw new RuntimeException("Splash screen is not shown!");
    }

    Graphics2D g = splashScreen.createGraphics();
    Rectangle splashBounds = splashScreen.getBounds();
    int screenX = (int) splashBounds.getCenterX();
    int screenY = (int) splashBounds.getCenterY();
    if (splashBounds.width != IMAGE_WIDTH) {
        throw new RuntimeException(
                "SplashScreen#getBounds has wrong width");
    }
    if (splashBounds.height != IMAGE_HEIGHT) {
        throw new RuntimeException(
                "SplashScreen#getBounds has wrong height");
    }

    Robot robot = new Robot();
    Color splashScreenColor = robot.getPixelColor(screenX, screenY);
    float scaleFactor = getScaleFactor();
    Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;

    if (!compare(testColor, splashScreenColor)) {
        throw new RuntimeException(
                "Image with wrong resolution is used for splash screen!");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:31,代碼來源:MultiResolutionSplashTest.java

示例3: testSplash

import java.awt.SplashScreen; //導入方法依賴的package包/類
static void testSplash(ImageInfo test) throws Exception {
    SplashScreen splashScreen = SplashScreen.getSplashScreen();

    if (splashScreen == null) {
        throw new RuntimeException("Splash screen is not shown!");
    }

    Graphics2D g = splashScreen.createGraphics();
    Rectangle splashBounds = splashScreen.getBounds();
    int screenX = (int) splashBounds.getCenterX();
    int screenY = (int) splashBounds.getCenterY();

    Robot robot = new Robot();
    Color splashScreenColor = robot.getPixelColor(screenX, screenY);

    float scaleFactor = getScaleFactor();
    Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;

    if (!compare(testColor, splashScreenColor)) {
        throw new RuntimeException(
                "Image with wrong resolution is used for splash screen!");
    }
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:24,代碼來源:MultiResolutionSplashTest.java

示例4: testSplash

import java.awt.SplashScreen; //導入方法依賴的package包/類
static void testSplash(ImageInfo test) throws Exception {
    SplashScreen splashScreen = SplashScreen.getSplashScreen();
    if (splashScreen == null) {
        throw new RuntimeException("Splash screen is not shown!");
    }
    Graphics2D g = splashScreen.createGraphics();
    Rectangle splashBounds = splashScreen.getBounds();
    int screenX = (int) splashBounds.getCenterX();
    int screenY = (int) splashBounds.getCenterY();
    System.out.println(screenX);
    System.out.println(screenY);
    Robot robot = new Robot();
    Color splashScreenColor = robot.getPixelColor(screenX, screenY);

    float scaleFactor = getScaleFactor();
    Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;
    if (!compare(testColor, splashScreenColor)) {
        throw new RuntimeException(
                "Image with wrong resolution is used for splash screen!");
    }
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:22,代碼來源:UnixMultiResolutionSplashTest.java

示例5: updateSplash

import java.awt.SplashScreen; //導入方法依賴的package包/類
/**
 * Updates the text displayed in the splash screen (normal launch only).
 * 
 * @param splash
 * 		The splash screen to update.
 * @param msg
 * 		The text message to display.
 */
private static void updateSplash(SplashScreen splash, String msg)
{	if(splash!=null)
	{	Graphics2D g = (Graphics2D)splash.createGraphics();
		Rectangle size = splash.getBounds();
		g.setComposite(AlphaComposite.Clear);
		g.fillRect(0,0,size.width,size.height);
		g.setPaintMode();
		g.setFont(new Font("Arial",Font.PLAIN,10));
		g.setColor(new Color(0,0,0,100));
		for(int i=0;i<GuiMiscTools.STARTUP_LEGAL.length;i++)
			g.drawString(GuiMiscTools.STARTUP_LEGAL[i],70,90+i*10);
		g.setColor(GuiColorTools.COLOR_SPLASHSCREEN_TEXT);
        g.drawString(msg,70,315);
        splash.update();
	}
}
 
開發者ID:vlabatut,項目名稱:totalboumboum,代碼行數:25,代碼來源:Launcher.java

示例6: testSplash

import java.awt.SplashScreen; //導入方法依賴的package包/類
static void testSplash(ImageInfo test) throws Exception {
    SplashScreen splashScreen = SplashScreen.getSplashScreen();

    if (splashScreen == null) {
        throw new RuntimeException("Splash screen is not shown!");
    }

    Graphics2D g = splashScreen.createGraphics();
    Rectangle splashBounds = splashScreen.getBounds();
    int screenX = (int) splashBounds.getCenterX();
    int screenY = (int) splashBounds.getCenterY();

    Robot robot = new Robot();
    Color splashScreenColor = robot.getPixelColor(screenX, screenY);

    float scaleFactor = getScaleFactor();
    Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;

    if (!testColor.equals(splashScreenColor)) {
        throw new RuntimeException(
                "Image with wrong resolution is used for splash screen!");
    }
}
 
開發者ID:infobip,項目名稱:infobip-open-jdk-8,代碼行數:24,代碼來源:MultiResolutionSplashTest.java

示例7: drawOnSplash

import java.awt.SplashScreen; //導入方法依賴的package包/類
private static void drawOnSplash(int percent) {
    SplashScreen splash = SplashScreen.getSplashScreen();
    if (splash == null) {
        System.out.println("No Splash Screen");
        return;
    }

    Rectangle bounds = splash.getBounds();
    Graphics2D g = splash.createGraphics();

    int height = 20;
    int x = 2;
    int y = bounds.height - height - 2;
    int width = bounds.width - 4;

    Color brightPurple = new Color(76, 36, 121);
    g.setColor(brightPurple);
    g.fillRect(x, y, width * percent / 100, height);
    splash.update();
}
 
開發者ID:CoEIA,項目名稱:DEM,代碼行數:21,代碼來源:Splasher.java

示例8: testSplash

import java.awt.SplashScreen; //導入方法依賴的package包/類
static void testSplash(ImageInfo test) throws Exception {
    SplashScreen splashScreen = SplashScreen.getSplashScreen();

    if (splashScreen == null) {
        throw new RuntimeException("Splash screen is not shown!");
    }

    Graphics2D g = splashScreen.createGraphics();
    Rectangle splashBounds = splashScreen.getBounds();
    int screenX = (int) splashBounds.getCenterX();
    int screenY = (int) splashBounds.getCenterY();

    if(splashBounds.width != IMAGE_WIDTH){
        throw new RuntimeException(
                "SplashScreen#getBounds has wrong width");
    }
    if(splashBounds.height != IMAGE_HEIGHT){
        throw new RuntimeException(
                "SplashScreen#getBounds has wrong height");
    }

    Robot robot = new Robot();
    Color splashScreenColor = robot.getPixelColor(screenX, screenY);

    float scaleFactor = getScaleFactor();
    Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;

    if (!compare(testColor, splashScreenColor)) {
        throw new RuntimeException(
                "Image with wrong resolution is used for splash screen!");
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:33,代碼來源:MultiResolutionSplashTest.java


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