本文整理匯總了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!");
}
}
示例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!");
}
}
示例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!");
}
}
示例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!");
}
}
示例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();
}
}
示例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!");
}
}
示例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();
}
示例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!");
}
}