Java Code Examples for java.awt.SplashScreen

The following are top voted examples for showing how to use java.awt.SplashScreen. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openjdk-jdk10   File: UnixMultiResolutionSplashTest.java   Source Code and License 8 votes vote down vote up
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!");
    }
}
 
Example 2
Project: scratch-bench   File: ScratchBench.java   Source Code and License 7 votes vote down vote up
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);
    }
}
 
Example 3
Project: IO   File: GUILauncher.java   Source Code and License 7 votes vote down vote up
@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);
    }
}
 
Example 4
Project: openjdk-jdk10   File: MultiResolutionSplashTest.java   Source Code and License 6 votes vote down vote up
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!");
    }
}
 
Example 5
Project: openjdk9   File: MultiResolutionSplashTest.java   Source Code and License 6 votes vote down vote up
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!");
    }
}
 
Example 6
Project: openjdk9   File: UnixMultiResolutionSplashTest.java   Source Code and License 6 votes vote down vote up
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!");
    }
}
 
Example 7
Project: CanReg5   File: CanRegClientApp.java   Source Code and License 6 votes vote down vote up
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();
    }
}
 
Example 8
Project: keystore-explorer   File: KSE.java   Source Code and License 6 votes vote down vote up
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();
	}
}
 
Example 9
Project: torgo   File: MainSplash.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example 10
Project: totalboumboum   File: Launcher.java   Source Code and License 6 votes vote down vote up
/**
 * 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();
	}
}
 
Example 11
Project: infobip-open-jdk-8   File: MultiResolutionSplashTest.java   Source Code and License 6 votes vote down vote up
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!");
    }
}
 
Example 12
Project: jdk8u-dev-jdk   File: MultiResolutionSplashTest.java   Source Code and License 6 votes vote down vote up
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!");
    }
}
 
Example 13
Project: DEM   File: Splasher.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 14
Project: DEM   File: Splasher.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 15
Project: magarena   File: MagicMain.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example 16
Project: olivia-swing   File: OliviaSwingLauncher.java   Source Code and License 6 votes vote down vote up
/**
 * スプラッシュを描画する.
 */
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();
}
 
Example 17
Project: MediathekView   File: MediathekAuto.java   Source Code and License 6 votes vote down vote up
public MediathekAuto(String[] ar) {
    if (ar != null) {
        if (ar.length > 0) {
            if (!ar[0].startsWith("-")) {
                if (!ar[0].endsWith(File.separator)) {
                    ar[0] += File.separator;
                }
                pfad = ar[0];
            }
        }
    }
    try {
        final SplashScreen splash = SplashScreen.getSplashScreen();
        if (splash != null) {
            splash.close();
        }
    } catch (Exception ignored) {
        SysMsg.sysMsg("NoSplashscreen");
    }
}
 
Example 18
Project: marmotta   File: SplashScreenListener.java   Source Code and License 6 votes vote down vote up
/**
 * Acknowledge the occurrence of the specified event.
 *
 * @param event LifecycleEvent that has occurred
 */
@Override
public void lifecycleEvent(LifecycleEvent event) {
    if(event.getType().equals(Lifecycle.AFTER_START_EVENT)) {
        if(!GraphicsEnvironment.isHeadless()) {
            SplashScreen splashScreen = SplashScreen.getSplashScreen();
            if(splashScreen != null) {
                try {
                    splashScreen.close();
                } catch (IllegalStateException e) {
                    
                }
            }
        }
    } else if(event.getType().equals(Lifecycle.BEFORE_START_EVENT)) {
        if(!GraphicsEnvironment.isHeadless()) {
            showStatus("Starting Apache Tomcat ...");
            showProgress(0);
        }
    }
}
 
Example 19
Project: gsn   File: Main.java   Source Code and License 6 votes vote down vote up
private static void updateSplashIfNeeded(String message[]) {
	boolean headless_check = isHeadless();

	if (!headless_check) {
		SplashScreen splash = SplashScreen.getSplashScreen();
		if (splash == null)
			return;
		if (splash.isVisible()) {
			//Get a graphics overlay for the splash screen
			Graphics2D g = splash.createGraphics();
			//Do some drawing on the graphics object
			//Now update to the splash screen

			g.setComposite(AlphaComposite.Clear);
			g.fillRect(0,0,400,70);
			g.setPaintMode();
			g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
			g.setColor(Color.BLACK);
			g.setFont(new Font("Arial",Font.BOLD,11));
			for (int i=0;i<message.length;i++)
				g.drawString(message[i], 13, 16*i+10);
			splash.update();
		}
	}
}
 
Example 20
Project: gitblit   File: Launcher.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) {
	final SplashScreen splash = SplashScreen.getSplashScreen();
	
	File libFolder = new File("ext");
	List<File> jars = findJars(libFolder.getAbsoluteFile());
	
	// sort the jars by name and then reverse the order so the newer version
	// of the library gets loaded in the event that this is an upgrade
	Collections.sort(jars);
	Collections.reverse(jars);
	for (File jar : jars) {
		try {
			updateSplash(splash, Translation.get("gb.loading") + " " + jar.getName() + "...");
			addJarFile(jar);
		} catch (IOException e) {

		}
	}
	
	updateSplash(splash, Translation.get("gb.starting") + " Gitblit Authority...");
	GitblitAuthority.main(args);
}
 
Example 21
Project: gitblit   File: GitblitManagerLauncher.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) {
	final SplashScreen splash = SplashScreen.getSplashScreen();
	
	File libFolder = new File("ext");
	List<File> jars = findJars(libFolder.getAbsoluteFile());
	
	// sort the jars by name and then reverse the order so the newer version
	// of the library gets loaded in the event that this is an upgrade
	Collections.sort(jars);
	Collections.reverse(jars);
	for (File jar : jars) {
		try {
			updateSplash(splash, Translation.get("gb.loading") + " " + jar.getName() + "...");
			addJarFile(jar);
		} catch (IOException e) {

		}
	}
	
	updateSplash(splash, Translation.get("gb.starting") + " Gitblit Manager...");
	GitblitManager.main(args);
}
 
Example 22
Project: IRCBlit   File: Launcher.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) {
	final SplashScreen splash = SplashScreen.getSplashScreen();
	
	File libFolder = new File("ext");
	List<File> jars = findJars(libFolder.getAbsoluteFile());
	
	// sort the jars by name and then reverse the order so the newer version
	// of the library gets loaded in the event that this is an upgrade
	Collections.sort(jars);
	Collections.reverse(jars);
	for (File jar : jars) {
		try {
			updateSplash(splash, Translation.get("gb.loading") + " " + jar.getName() + "...");
			addJarFile(jar);
		} catch (IOException e) {

		}
	}
	
	updateSplash(splash, Translation.get("gb.starting") + " Gitblit Authority...");
	GitblitAuthority.main(args);
}
 
Example 23
Project: IRCBlit   File: GitblitManagerLauncher.java   Source Code and License 6 votes vote down vote up
public static void main(String[] args) {
	final SplashScreen splash = SplashScreen.getSplashScreen();
	
	File libFolder = new File("ext");
	List<File> jars = findJars(libFolder.getAbsoluteFile());
	
	// sort the jars by name and then reverse the order so the newer version
	// of the library gets loaded in the event that this is an upgrade
	Collections.sort(jars);
	Collections.reverse(jars);
	for (File jar : jars) {
		try {
			updateSplash(splash, Translation.get("gb.loading") + " " + jar.getName() + "...");
			addJarFile(jar);
		} catch (IOException e) {

		}
	}
	
	updateSplash(splash, Translation.get("gb.starting") + " Gitblit Manager...");
	GitblitManager.main(args);
}
 
Example 24
Project: jaer   File: JAERViewer.java   Source Code and License 5 votes vote down vote up
public SplashHandler(java.awt.SplashScreen splashScreen) {
    if (splashScreen == null) {
        log.warning("null splash screen passed in");
        return;
    }
    this.splashScreen = splashScreen;
    this.g = splashScreen.createGraphics();
    logger = Logger.getLogger("");
    logger.addHandler(this);
}
 
Example 25
Project: LibGDX-SplashScreen-Example   File: DesktopSplashWorker.java   Source Code and License 5 votes vote down vote up
@Override
public void closeSplashScreen() {
    SplashScreen splash = SplashScreen.getSplashScreen();
    if (splash != null) {
        splash.close();
    }
}
 
Example 26
Project: Example.EMA.Java.SpeedGuide   File: SpeedGuide.java   Source Code and License 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
	try {
		final SplashScreen splash = SplashScreen.getSplashScreen();

        // Determine if we passed anything on the cmd line
        parseCmdLine();

        // Define our controllers
        SpeedGuideViewController viewController = loadFXMLController("view/SpeedGuideView.fxml");
        SpeedGuideConnection connectionController = loadFXMLController("view/ConnectionDialog.fxml");

		// Wire up our Model/View/Controllers
		viewController.setConnectionViewController(connectionController);
		viewController.setDebug(m_debug);
		viewController.defineControlBindings(m_consumer);

		// Notify our consumer some setup information
        m_consumer.setDebug(m_debug);
        m_consumer.setViewController(viewController);

		// Define the main viewing scene,
        AnchorPane layout = viewController.getLayout();
		Scene scene = new Scene(layout, layout.getPrefWidth(), layout.getPrefHeight());

		// Prevent the user from resizing the window too small
		primaryStage.setMinHeight(layout.getMinHeight());
		primaryStage.setMinWidth(layout.getMinWidth());

		// Assign to our main stage and show the application to the end user
		primaryStage.setTitle("Speed Guide");
		primaryStage.setScene(scene);
		primaryStage.show();

		// Set up our EMA Consumer and launch a thread to run...
        Thread t = new Thread(m_consumer);
        t.start();

    	Application.Parameters params = getParameters();
    	connectionController.initialize(params.getNamed().get(HOST_PARAM),
    						  			params.getNamed().get(SERVICE_PARAM),
    						  			params.getNamed().get(USER_PARAM),
    						  			m_consumer);

        // Attempt to Connect into Elektron
		if ( splash != null )
			splash.close();
        connectionController.connect();
	} catch  (Exception e) {
		System.out.print("Exception in Application Start: ");
		e.printStackTrace();
		stop();
	}
}
 
Example 27
Project: jdk8u-jdk   File: MultiResolutionSplashTest.java   Source Code and License 5 votes vote down vote up
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!");
    }
}
 
Example 28
Project: jdk8u_jdk   File: MultiResolutionSplashTest.java   Source Code and License 5 votes vote down vote up
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!");
    }
}
 
Example 29
Project: lookaside_java-1.8.0-openjdk   File: MultiResolutionSplashTest.java   Source Code and License 5 votes vote down vote up
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!");
    }
}
 
Example 30
Project: sldeditor   File: AppSplashScreen.java   Source Code and License 5 votes vote down vote up
/**
 * Splash initialise.
 */
public static void splashInit() {
    splashScreenObj = SplashScreen.getSplashScreen();
    if (splashScreenObj != null) {
        createTextArea();

        // create the Graphics environment for drawing status info
        splashGraphics = splashScreenObj.createGraphics();
        splashGraphics.setFont(font);

        // Display the version number
        splashText(getVersionString());
    }
}
 
Example 31
Project: skin-composer   File: DesktopLauncher.java   Source Code and License 5 votes vote down vote up
@Override
public void closeSplashScreen() {
    SplashScreen splash = SplashScreen.getSplashScreen();
    if (splash != null) {
        splash.close();
    }
}
 
Example 32
Project: jeveassets   File: SplashUpdater.java   Source Code and License 5 votes vote down vote up
/** Creates a new instance of SplashUpdater. */
public SplashUpdater() {
	splash = SplashScreen.getSplashScreen();
	loadingImages = new BufferedImage[8];
	for (int i = 0; i < 8; i++) {
		try {
			loadingImages[i] = ImageIO.read(getClass().getResource("gui/images/loading0" + (i + 1) + ".png"));
		} catch (IOException ex) {
			LOG.warn("SplashScreen: loading0{}.png (NOT FOUND)", (i + 1));
		}
	}
}
 
Example 33
Project: icedtea-web   File: Launcher.java   Source Code and License 5 votes vote down vote up
/**
 * Launches a JNLP applet. This method should be called from a
 * thread in the application's thread group.
 * <p>
 * The enableCodeBase parameter adds the applet's codebase to
 * the locations searched for resources and classes.  This can
 * slow down the applet loading but allows browser-style applets
 * that don't use JAR files exclusively to be run from a applet
 * JNLP file.  If the applet JNLP file does not specify any
 * resources then the code base will be enabled regardless of
 * the specified value.
 * </p>
 *
 * @param file the JNLP file
 * @param enableCodeBase whether to add the codebase URL to the classloader
 * @param cont container where to put application
 * @return application
 * @throws net.sourceforge.jnlp.LaunchException if deploy unrecoverably die
 */
protected ApplicationInstance launchApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
    if (!file.isApplet()) {
        throw launchError(new LaunchException(file, null, R("LSFatal"), R("LCClient"), R("LNotApplet"), R("LNotAppletInfo")));
    }
  
    if (JNLPRuntime.getForksAllowed() && file.needsNewVM()) {
        if (!JNLPRuntime.isHeadless()) {
            SplashScreen sp = SplashScreen.getSplashScreen();
            if (sp != null) {
                sp.close();
            }
        }
    }
    if (handler != null) {
        handler.launchInitialized(file);
    }
    
    AppletInstance applet = null;
    try {
        ServiceUtil.checkExistingSingleInstance(file);
        applet = createApplet(file, enableCodeBase, cont);
        applet.initialize();
        applet.getAppletEnvironment().startApplet(); // this should be a direct call to applet instance
        return applet;
    } catch (InstanceExistsException ieex) {
        OutputController.getLogger().log("Single instance applet is already running.");
        throw launchError(new LaunchException(file, ieex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LSingleInstanceExists")), applet);
    } catch (LaunchException lex) {
        throw launchError(lex, applet);
    } catch (Exception ex) {
        throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCLaunching"), R("LCouldNotLaunch"), R("LCouldNotLaunchInfo")), applet);
    }finally{
        if (handler != null) {
            handler.launchStarting(applet);
        }
    }
}
 
Example 34
Project: jwarframe   File: SplashUpdater.java   Source Code and License 5 votes vote down vote up
private SplashUpdater() {
	splash = SplashScreen.getSplashScreen();
	loadingImages = new BufferedImage[8];
	for (int i = 0; i < 8; i++) {
		try {
			loadingImages[i] = ImageIO.read(getClass().getResource("gui/images/loading0" + (i + 1) + ".png"));
		} catch (IOException ex) {
			LOG.warn("SplashScreen: loading0{}.png (NOT FOUND)", (i + 1));
		}
	}
	animator = new Animator();
	paineter = new Paineter();
}
 
Example 35
Project: demyo   File: Start.java   Source Code and License 5 votes vote down vote up
private static void closeSplashScreen() {
	if (GraphicsEnvironment.isHeadless()) {
		return;
	}
	SplashScreen splash = SplashScreen.getSplashScreen();
	if (splash != null) {
		try {
			splash.close();
			LOGGER.debug("Successfully closed the splash screen");
		} catch (IllegalStateException e) {
			LOGGER.debug("Splash screen already closed; no big deal");
		}
	}
}
 
Example 36
Project: grafikon   File: ApplicationStarter.java   Source Code and License 5 votes vote down vote up
public void start() throws ApplicationStarterException {
        log.trace("Start starter.");
        if (SplashScreen.getSplashScreen() == null) {
            startFrame();
        } else {
            startOriginal();
        }
        log.trace("End starter.");
}
 
Example 37
Project: jupdate   File: SplashUpdater.java   Source Code and License 5 votes vote down vote up
private SplashUpdater() {
	splash = SplashScreen.getSplashScreen();
	loadingImages = new BufferedImage[8];
	for (int i = 0; i < 8; i++) {
		try {
			loadingImages[i] = ImageIO.read(getClass().getResource("loading0" + (i + 1) + ".png"));
		} catch (IOException ex) {
			//LOG.warn("SplashScreen: loading0{}.png (NOT FOUND)", (i + 1));
		}
	}
	animator = new Animator();
	paineter = new Paineter();
}
 
Example 38
Project: GdxStudio   File: GdxStudio.java   Source Code and License 5 votes vote down vote up
static void createSplash(){
	Graphics2D g = null;
    final SplashScreen splash = SplashScreen.getSplashScreen();
    if (splash == null) createFrameWithoutSplash();
    else {
     g = splash.createGraphics();  
     renderSplashFrame(g, 1, "Initializing");
     splash.update();
     renderSplashFrame(g, 2, "Loading Icons");
     splash.update();
     Icon.loadIcons();
     renderSplashFrame(g, 3, "Loading Frame");
     splash.update();
     Frame.getInstance().setIconImage(Icon.icon("icon").getImage());
     Frame.getInstance().setTitle("GdxStudio");
	 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	 Frame.getInstance().setSize(screenSize);
	 Frame.getInstance().setLocation(0, 0);
	 Frame.getInstance().setLocationRelativeTo(null);
	 renderSplashFrame(g, 4, "Loading Explorer");
     splash.update();
     renderSplashFrame(g, 5, "Loading SideBar");
     splash.update();
     Frame.getInstance().initSideBar();
     renderSplashFrame(g, 6, "Loading Status Bar");
     splash.update();
     Frame.getInstance().initStatusBar();
     renderSplashFrame(g, 7, "Loading Content");
     splash.update();
     Frame.getInstance().initContent();
     renderSplashFrame(g, 8, "Loading ToolBar");
     splash.update();
     Frame.getInstance().initToolBar();
     renderSplashFrame(g, 9, "Finished");
     splash.update();   
    }
}
 
Example 39
Project: TinkerTime   File: TinkerTimeLauncher.java   Source Code and License 5 votes vote down vote up
@Override
public void run() {
	// Get App Icons
	ImageManager imageManager = new ImageManager();
	List<Image> appIcons = new ArrayList<Image>();
	appIcons.add(imageManager.getImage("icon/app/icon 128x128.png"));
	appIcons.add(imageManager.getImage("icon/app/icon 64x64.png"));
	appIcons.add(imageManager.getImage("icon/app/icon 32x32.png"));
	appIcons.add(imageManager.getImage("icon/app/icon 16x16.png"));

	// Hide Splash Screen so the JFrame does not hide when appearing
	SplashScreen s = SplashScreen.getSplashScreen();
	if (s != null){
		s.close();
	}

	// Initialize Frame
	JFrame frame = new JFrame(TinkerTimeLauncher.FULL_NAME);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setLayout(new BorderLayout());
	frame.setIconImages(appIcons);
	frame.setJMenuBar(menuBar);
	frame.add(toolBar, BorderLayout.NORTH);
	frame.add(modSelectorPanelController.getComponent(), BorderLayout.CENTER);
	frame.pack();
	frame.setLocationRelativeTo(null);
	frame.setVisible(true);
	frame.toFront();
}
 
Example 40
Project: olivia-swing   File: OliviaSwingLauncher.java   Source Code and License 5 votes vote down vote up
/**
 * 指定されたスプラッシュスクリーンにスプラッシュ画像を設定する.
 * @param splash 描画先のスプラッシュスクリーン
 */
private static void setSplashImage(SplashScreen splash) {
    try {
        GenericFile splashImageFile = OliviaSwingConstants.USER_SPLASH_IMAGE_FILE;
        if(splashImageFile.exists()) {
            splash.setImageURL(splashImageFile.getURL());
        } else {
            GenericFile logo = OliviaSwingConstants.DEFAULT_SPLASH_IMAGE_REOURCE;
            splash.setImageURL(logo.getURL());
        }
    } catch(Exception e) {
        //リソースが正常に配置されている限りここには到達しない
        throw new RuntimeException(e);
    }
}
 
Example 41
Project: planetBot   File: Splash.java   Source Code and License 5 votes vote down vote up
public Splash() {

		new Thread(new Runnable() {

			@Override
			public void run() {
				SplashScreen splash = SplashScreen.getSplashScreen();
				if (splash == null) {
					System.out.println("SplashScreen.getSplashScreen() returned null");
					return;
				}
				Graphics2D g = splash.createGraphics();
				if (g == null) {
					System.out.println("g is null");
					return;
				}
				
				g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
				Font font = g.getFont();
				g.setFont(new Font("Arial", Font.BOLD, 30));
				g.setColor(Color.WHITE);
				g.drawString("STAR MARINES", 105, 50);
				g.setFont(font);
				
				int i = 0;
				while (isVisibleSplash) {
					renderSplashFrame(g, i);
					splash.update();
					i++;
				}

				splash.close();
			}
		}).start();

	}
 
Example 42
Project: gsn   File: Main.java   Source Code and License 5 votes vote down vote up
private static void closeSplashIfneeded() {
	if (isHeadless())
		return;
	SplashScreen splash = SplashScreen.getSplashScreen();
	//Check if we have specified any splash screen
	if (splash == null) {
		return;
	}
	if (splash.isVisible())
		splash.close();
}
 
Example 43
Project: Lumpi   File: HostFrame.java   Source Code and License 5 votes vote down vote up
private void initSplashScreen() {
    final SplashScreen splash = SplashScreen.getSplashScreen();

    if (splash != null) {
        Graphics2D g = splash.createGraphics();

        if (g != null) {
            return;
        }

        splash.close();
    }
}
 
Example 44
Project: EntryManager   File: App.java   Source Code and License 5 votes vote down vote up
/**
 * Constructor #1.<br />
 * Default private constructor which load the arguments and set the configuration of the program.
 * @param args
 *        the arguments from the command line.
 */
private App (final String[] args) {
	super();
	
	// Load splash screen
	splashScreen = SplashScreen.getSplashScreen();
	if (splashScreen != null) {
		splashScreen.createGraphics();
	} else {
		lg.warning("Could not load splash screen");
	}
	
	// Load configuration
	config = new Configuration(Paths.get(args.length > 0 ? args[0] : ConfigurationKeys.FILE));
}
 
Example 45
Project: gitblit   File: Launcher.java   Source Code and License 5 votes vote down vote up
private static void updateSplash(final SplashScreen splash, final String string) {
	if (splash == null) {
		return;
	}
	try {
		EventQueue.invokeAndWait(new Runnable() {
			public void run() {
				Graphics2D g = splash.createGraphics();
				if (g != null) {
					// Splash is 320x120
					FontMetrics fm = g.getFontMetrics();
					
					// paint startup status
					g.setColor(Color.darkGray);
					int h = fm.getHeight() + fm.getMaxDescent();
					int x = 5;
					int y = 115;
					int w = 320 - 2 * x;
					g.fillRect(x, y - h, w, h);
					g.setColor(Color.lightGray);
					g.drawRect(x, y - h, w, h);
					g.setColor(Color.WHITE);
					int xw = fm.stringWidth(string);
					g.drawString(string, x + ((w - xw) / 2), y - 5);
					
					// paint version
					String ver = "v" + Constants.getVersion();
					int vw = g.getFontMetrics().stringWidth(ver);
					g.drawString(ver, 320 - vw - 5, 34);
					g.dispose();
					splash.update();
				}
			}
		});
	} catch (Throwable t) {
		t.printStackTrace();
	}
}
 
Example 46
Project: gitblit   File: GitblitManagerLauncher.java   Source Code and License 5 votes vote down vote up
private static void updateSplash(final SplashScreen splash, final String string) {
	if (splash == null) {
		return;
	}
	try {
		EventQueue.invokeAndWait(new Runnable() {
			public void run() {
				Graphics2D g = splash.createGraphics();
				if (g != null) {
					// Splash is 320x120
					FontMetrics fm = g.getFontMetrics();
					
					// paint startup status
					g.setColor(Color.darkGray);
					int h = fm.getHeight() + fm.getMaxDescent();
					int x = 5;
					int y = 115;
					int w = 320 - 2 * x;
					g.fillRect(x, y - h, w, h);
					g.setColor(Color.lightGray);
					g.drawRect(x, y - h, w, h);
					g.setColor(Color.WHITE);
					int xw = fm.stringWidth(string);
					g.drawString(string, x + ((w - xw) / 2), y - 5);
					
					// paint version
					String ver = "v" + Constants.getVersion();
					int vw = g.getFontMetrics().stringWidth(ver);
					g.drawString(ver, 320 - vw - 5, 34);
					g.dispose();
					splash.update();
				}
			}
		});
	} catch (Throwable t) {
		t.printStackTrace();
	}
}
 
Example 47
Project: obdq   File: OBDQ.java   Source Code and License 5 votes vote down vote up
@Override
    public void start(Stage pStage) 
    {  
        Globals.primaryStage=pStage;
        Globals.primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>()
        {
            @Override
            public void handle(WindowEvent event) 
            {
                destruct();
            }
        });
//        Globals.primaryStage.widthProperty().addListener(new ChangeListener<Number>() 
//        {
//            @Override public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneWidth, Number newSceneWidth) 
//            {
//                if(newSceneWidth.intValue()>ObdqProperties.MaxWidth)
//                     Globals.primaryStage.setWidth(ObdqProperties.MaxWidth);
//            }
//          });
        
        
        initialize();
        
            SettingsUtils.setPageHistory(LandingPage.class);
            Globals.Page=new Scene(Globals.root , ObdqProperties.defaultWindowWidth, ObdqProperties.defaultWindowHeight);
            Globals.Page.getStylesheets().addAll(SettingsUtils.getTheamFolderLocation()+SettingsUtils.cssLocation);
            Globals.currentPage=LandingPage.class;
            new LandingPage().getPageContent(Globals.root,Globals.pane);     

        Globals.primaryStage.setScene(Globals.Page);
        Globals.primaryStage.show();
        SplashScreen splash = SplashScreen.getSplashScreen();
        if(splash!=null)
        {
            splash.close();
            splash=null;
        }

    }
 
Example 48
Project: brevis   File: Launcher.java   Source Code and License 5 votes vote down vote up
private void init(String[] args) throws Exception {
    final SplashScreen splash = SplashScreen.getSplashScreen();
    //System.err.println("Splash " + splash.getImageURL() );
    if (splash == null) {
    	System.err.println("Cannot launch splash screen. Proceeding.");
    }
    Method m = loadBrevisMain();
    if (splash != null) {
        splash.close();
    }
    invokeBrevisMain(m, args);
}
 
Example 49
Project: collect-earth   File: EarthApp.java   Source Code and License 5 votes vote down vote up
private static void closeSplash() {
	try {
		final SplashScreen splash = SplashScreen.getSplashScreen();
		if (splash != null) {
			splash.close();
		}
	} catch (final IllegalStateException e) {
		logger.error("Error closing the splash window", e); //$NON-NLS-1$
	}
}
 
Example 50
Project: IRCBlit   File: Launcher.java   Source Code and License 5 votes vote down vote up
private static void updateSplash(final SplashScreen splash, final String string) {
	if (splash == null) {
		return;
	}
	try {
		EventQueue.invokeAndWait(new Runnable() {
			public void run() {
				Graphics2D g = splash.createGraphics();
				if (g != null) {
					// Splash is 320x120
					FontMetrics fm = g.getFontMetrics();
					
					// paint startup status
					g.setColor(Color.darkGray);
					int h = fm.getHeight() + fm.getMaxDescent();
					int x = 5;
					int y = 115;
					int w = 320 - 2 * x;
					g.fillRect(x, y - h, w, h);
					g.setColor(Color.lightGray);
					g.drawRect(x, y - h, w, h);
					g.setColor(Color.WHITE);
					int xw = fm.stringWidth(string);
					g.drawString(string, x + ((w - xw) / 2), y - 5);
					
					// paint version
					String ver = "v" + Constants.getVersion();
					int vw = g.getFontMetrics().stringWidth(ver);
					g.drawString(ver, 320 - vw - 5, 34);
					g.dispose();
					splash.update();
				}
			}
		});
	} catch (Throwable t) {
		t.printStackTrace();
	}
}
 
Example 51
Project: IRCBlit   File: GitblitManagerLauncher.java   Source Code and License 5 votes vote down vote up
private static void updateSplash(final SplashScreen splash, final String string) {
	if (splash == null) {
		return;
	}
	try {
		EventQueue.invokeAndWait(new Runnable() {
			public void run() {
				Graphics2D g = splash.createGraphics();
				if (g != null) {
					// Splash is 320x120
					FontMetrics fm = g.getFontMetrics();
					
					// paint startup status
					g.setColor(Color.darkGray);
					int h = fm.getHeight() + fm.getMaxDescent();
					int x = 5;
					int y = 115;
					int w = 320 - 2 * x;
					g.fillRect(x, y - h, w, h);
					g.setColor(Color.lightGray);
					g.drawRect(x, y - h, w, h);
					g.setColor(Color.WHITE);
					int xw = fm.stringWidth(string);
					g.drawString(string, x + ((w - xw) / 2), y - 5);
					
					// paint version
					String ver = "v" + Constants.getVersion();
					int vw = g.getFontMetrics().stringWidth(ver);
					g.drawString(ver, 320 - vw - 5, 34);
					g.dispose();
					splash.update();
				}
			}
		});
	} catch (Throwable t) {
		t.printStackTrace();
	}
}
 
Example 52
Project: kiosk   File: Kiosk.java   Source Code and License 5 votes vote down vote up
/**
 * Configures the splash screen for use.
 */
private static void configureSplashScreen() {
	splash = SplashScreen.getSplashScreen();
	if (splash == null) {
		// Unsupported.
		return;
	}
	splashGraphics = splash.createGraphics();
	setSplashScreenText(new String());
}
 
Example 53
Project: keystore-explorer   File: KSE.java   Source Code and License 4 votes vote down vote up
/**
 * Start the KeyStore Explorer application. Takes one optional argument -
 * the location of a KeyStore file to open upon startup.
 *
 * @param args
 *            the command line arguments
 */
public static void main(String args[]) {
	try {
		// To take affect these must be set before the splash screen is instantiated
		if (OperatingSystem.isMacOs()) {
			setAppleSystemProperties();
		} else if (OperatingSystem.isWindows7() || OperatingSystem.isWindows8() || OperatingSystem.isWindows10()) {
			String appId = props.getString("KSE.AppUserModelId");
			Shell32 shell32 = (Shell32) Native.loadLibrary("shell32", Shell32.class);
			shell32.SetCurrentProcessExplicitAppUserModelID(new WString(appId)).longValue();
		} else if (OperatingSystem.isLinux()) {
			fixAppClassName();
		}

		setInstallDirProperty();

		SplashScreen splash = SplashScreen.getSplashScreen();

		updateSplashMessage(splash, res.getString("KSE.LoadingApplicationSettings.splash.message"));
		ApplicationSettings applicationSettings = ApplicationSettings.getInstance();
		setCurrentDirectory(applicationSettings);

		updateSplashMessage(splash, res.getString("KSE.InitializingSecurity.splash.message"));
		initialiseSecurity();

		// list of files to open after start
		List<File> parameterFiles = new ArrayList<File>();
		for (String arg : args) {
			File parameterFile = new File(arg);
			if (parameterFile.exists()) {
				parameterFiles.add(parameterFile);
			}
		}

		// Create application GUI on the event handler thread
		updateSplashMessage(splash, res.getString("KSE.CreatingApplicationGui.splash.message"));
		SwingUtilities.invokeLater(new CreateApplicationGui(applicationSettings, splash, parameterFiles));
	} catch (Throwable t) {
		DError dError = new DError(new JFrame(), t);
		dError.setLocationRelativeTo(null);
		dError.setVisible(true);
		System.exit(1);
	}
}
 
Example 54
Project: grafikon   File: SplashScreenInfoOrig.java   Source Code and License 4 votes vote down vote up
public SplashScreenInfoOrig(SplashScreen splash, int x, int y) {
    this.splash = splash;
    this.x = x;
    this.y = y;
}
 
Example 55
Project: kkMulticopterFlashTool   File: KKMulticopterFlashTool.java   Source Code and License 4 votes vote down vote up
public KKMulticopterFlashTool(String[] args) {

		kk = this;
		evaluateCommandlineOptions(args);
		
		//check if the OS is Mac OS X
		if (System.getProperty("os.name").toLowerCase().contains("mac")) {
			SETTINGS_FILE = new File(System.getProperty("user.home")+"/Library/Preferences/","kkMulticopterFlashTool.properties");
			LOG_FILE = new File(getTempFolder(),"kkLogging.txt");
		}
		
		if (!isNoLogging ) initLogger();
		
		SplashScreen splash = SplashScreen.getSplashScreen();
		if (splash==null) {
			logger.log(Level.INFO, "Splash not loaded.");
		}
		
		
		logger.log(Level.INFO, System.getProperty("user.home"));
		logger.log(Level.INFO, System.getProperty("os.name"));
		

		loadSettings();
		loadTranslation();

		Runtime.getRuntime().addShutdownHook(new Thread() {
			public void run() {
				saveSettings();
			}
		});
		
		firmwareReader = new XmlReaderFirmwares(firmwareRepositoryURL);

		this.init();
		if (enableTweak) ColorTweaks.tweakColors();
		this.initGUI();
		
		this.addPropertyChangeListener(this);
		
		checkVersion();
	}
 
Example 56
Project: DEM   File: Splasher.java   Source Code and License 4 votes vote down vote up
public static void splashScreenWithProgressBar() {
    SplashScreen splash = SplashScreen.getSplashScreen();
    if (splash == null) {
        System.out.println("No Splash Screen");
        return;
    }

    final Image img = Toolkit.getDefaultToolkit().getImage(splash.getImageURL());
    final JFrame splashFrame = new JFrame();
    splashFrame.setUndecorated(true);

    final JPanel splashPanel = new JPanel() {
        @Override
        public void paintComponent(Graphics g) {
            g.drawImage(img, 0, 0, null);
        }
    };

    final JProgressBar progressBar = new JProgressBar();
    progressBar.setStringPainted(true);

    splashPanel.setLayout(new BorderLayout());
    splashPanel.add(progressBar, BorderLayout.SOUTH);

    splashFrame.add(splashPanel);
    splashFrame.setBounds(splash.getBounds());
    splashFrame.setVisible(true);

    new SwingWorker<Void, Integer>() {
        @Override
        protected Void doInBackground() throws Exception {
            try {
                for (int i = 0; i <100; i++) {
                    publish(i);
                    Thread.sleep(50);
                }
            } catch (InterruptedException e) {
            }

            return null;
        }

        @Override
        protected void process(List<Integer> chunks) {
            for (Integer chunk : chunks) {
                progressBar.setString("Loading module " + chunk);
                progressBar.setValue(chunk);
                splashPanel.repaint();
            }
        }

        @Override
        protected void done() {
            ApplicationLauncher.lunch();
            splashFrame.setVisible(false);
        }
    }.execute();
}
 
Example 57
Project: magarena   File: SplashProgressReporter.java   Source Code and License 4 votes vote down vote up
public SplashProgressReporter(final SplashScreen splash) {
    this.splash = splash;
}
 
Example 58
Project: pdfsam   File: PdfsamApp.java   Source Code and License 4 votes vote down vote up
private void closeSplash() {
    Optional.ofNullable(SplashScreen.getSplashScreen()).ifPresent(SplashScreen::close);
}
 
Example 59
Project: mkRemote   File: SystemTrayApplication.java   Source Code and License 4 votes vote down vote up
protected SplashScreen newSplashScreen() {
    return SplashScreen.getSplashScreen();
}
 
Example 60
Project: keystore-explorer   File: CreateApplicationGui.java   Source Code and License 3 votes vote down vote up
/**
 * Construct CreateApplicationGui.
 *
 * @param applicationSettings Application settings
 * @param splash              Splash screen
 * @param parameterFiles      File list to open
 */
public CreateApplicationGui(ApplicationSettings applicationSettings, SplashScreen splash, List<File>
parameterFiles) {
	this.applicationSettings = applicationSettings;
	this.splash = splash;
	this.parameterFiles = parameterFiles;
}