本文整理汇总了Java中java.awt.SplashScreen类的典型用法代码示例。如果您正苦于以下问题:Java SplashScreen类的具体用法?Java SplashScreen怎么用?Java SplashScreen使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SplashScreen类属于java.awt包,在下文中一共展示了SplashScreen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: splashInit
import java.awt.SplashScreen; //导入依赖的package包/类
private static void splashInit()
{
mySplash = SplashScreen.getSplashScreen();
if (mySplash != null)
{ // if there are any problems displaying the splash this will be null
Dimension ssDim = mySplash.getSize();
int height = ssDim.height;
int width = ssDim.width;
// stake out some area for our status information
splashTextArea = new Rectangle2D.Double(15., height*0.88, width *3, 32.);
splashProgressArea = new Rectangle2D.Double(4, height*0.822, width-7.1,2);
// create the Graphics environment for drawing status info
splashGraphics = mySplash.createGraphics();
font = new Font("Dialog", Font.ROMAN_BASELINE, 14);
splashGraphics.setFont(font);
// initialize the status info
splashText("Starting...");
splashProgress(0);
}
}
示例3: start
import java.awt.SplashScreen; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
try {
BaseController.setStage(primaryStage);
BaseController.setHostServices(getHostServices());
primaryStage.getIcons().add(new Image("/com/ciphertechsolutions/io/ui/icons/ion.png"));
SplashScreen splash = SplashScreen.getSplashScreen();
MainScreenController root = BaseController.loadFXML(MainScreenController.getFXMLLocation(),
MainScreenController.class);
controller = new ProcessController();
root.setWorkflowController(controller);
root.performSetup();
primaryStage.setScene(root.getScene());
if (splash != null) {
splash.close();
}
primaryStage.show();
BaseController.changeScene(root.getScene());
}
catch (Exception e) {
BaseController.displayErrorPopup(e, "Failed to initialize! Details: ");
System.exit(1);
}
}
示例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();
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!");
}
}
示例5: 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!");
}
}
示例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();
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!");
}
}
示例7: splashMessage
import java.awt.SplashScreen; //导入依赖的package包/类
private static void splashMessage(String message, int progress) {
SplashScreen splash = SplashScreen.getSplashScreen();
int maxProgress = 100;
if (splash != null) {
Graphics2D g = splash.createGraphics();
g.setComposite(AlphaComposite.Clear);
g.fillRect(0, 0, splash.getSize().width, splash.getSize().height);
g.setPaintMode();
g.setColor(Color.BLACK);
g.setFont(new Font("SansSerif", Font.BOLD, 10));
g.drawString(message, 35, splash.getSize().height / 2 + 20);
g.drawRect(35, splash.getSize().height / 2 + 30, splash.getSize().width - 70, 9);
g.fillRect(37, splash.getSize().height / 2 + 32, (progress * (splash.getSize().width - 68) / maxProgress), 5);
splash.update();
}
}
示例8: updateSplashMessage
import java.awt.SplashScreen; //导入依赖的package包/类
private static void updateSplashMessage(SplashScreen splash, String message) {
// Splash screen may not be present
if (splash != null) {
Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 10);
Graphics2D g = splash.createGraphics();
g.setFont(font);
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// Wipe out any previous text
g.setColor(new Color(238, 238, 238)); // #EEEEEE
g.setPaintMode();
g.fillRect(12, 70, 250, 30); // (x,y) is top left corner of area
// Draw next text
g.setColor(new Color(96, 96, 96)); // #606060
g.setPaintMode();
g.drawString(message, 17, 86); // (x,y) is baseline of text
splash.update();
}
}
示例9: splashInit
import java.awt.SplashScreen; //导入依赖的package包/类
/**
* Initialize the splash graphic.
*/
protected static void splashInit() {
mySplash = SplashScreen.getSplashScreen();
if (mySplash != null) {
try {
// if there are any problems displaying the splash this will be null
splashDimension = mySplash.getSize();
splashImage = ImageIO.read(mySplash.getImageURL());
// create the Graphics environment for drawing status info
splashGraphics = mySplash.createGraphics();
font = new Font(Font.SANS_SERIF, Font.PLAIN, 16);
splashGraphics.setFont(font);
splashGraphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
// initialize the status info
splashText("Starting");
} catch (IOException ex) {
org.tros.utils.logging.Logging.getLogFactory().getLogger(MainSplash.class).warn(null, ex);
}
}
}
示例10: 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();
}
}
示例11: 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!");
}
}
示例12: drawOnSplashScreen
import java.awt.SplashScreen; //导入依赖的package包/类
public static void drawOnSplashScreen() {
SplashScreen splash = SplashScreen.getSplashScreen();
if (splash == null) {
System.out.println("No Splash Screen");
return;
}
try {
for (int i = 0; i <= 100; i++) {
drawOnSplash(i);
Thread.sleep(100);
}
} catch (InterruptedException e) {
}
ApplicationLauncher.lunch();
}
示例13: 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();
}
示例14: setSplashScreen
import java.awt.SplashScreen; //导入依赖的package包/类
/**
* Sets splash screen as defined in JAR manifest or via "-splash" command line.
* <p>
* Can override with custom splash by placing "splash.png" in mods folder.
*/
private static void setSplashScreen() {
splash = SplashScreen.getSplashScreen();
if (splash == null) {
System.err.println("Error: no splash image specified on the command line");
} else {
reporter = new SplashProgressReporter(splash);
try {
final File splashFile = MagicFileSystem.getDataPath(DataPath.MODS).resolve("splash.png").toFile();
if (splashFile.exists()) {
splash.setImageURL(splashFile.toURI().toURL());
}
} catch (IOException ex) {
// A problem occurred trying to set custom splash.
// Log error and use default splash screen.
System.err.println(ex);
}
}
}
示例15: drawSplash
import java.awt.SplashScreen; //导入依赖的package包/类
/**
* スプラッシュを描画する.
*/
public static void drawSplash() {
// スプラッシュスクリーンの取得
SplashScreen splash = SplashScreen.getSplashScreen();
if(splash == null) return;
//スプラッシュ画像のセット
setSplashImage(splash);
// スプラッシュに描画を行う
Graphics2D g = splash.createGraphics();
g.setRenderingHint(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.setFont(new Font("Meiryo", Font.PLAIN, 15));
g.setColor(Color.BLACK);
g.drawString("loading...", 80, 200);
g.setColor(Color.WHITE);
g.setFont(new Font("Meiryo", Font.BOLD, 12));
g.drawString(AppInfo.APP_TITLE, 30, 150);
g.dispose();
// スプラッシュの更新
splash.update();
}