Java Code Examples for java.awt.SplashScreen#update()

The following examples show how to use java.awt.SplashScreen#update() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KSE.java    From keystore-explorer with GNU General Public License v3.0 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 2
Source File: Main.java    From gsn with GNU General Public License v3.0 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 3
Source File: Opt4J.java    From opt4j with MIT License 5 votes vote down vote up
/**
 * Decorate the splash screen with the version and date.
 * 
 * @param splash
 *            the splash screen
 */
protected static void decorateVersionDate(SplashScreen splash) {
	if (splash != null) {
		Graphics2D g = splash.createGraphics();
		g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		g.setColor(new Color(242, 130, 38));
		g.setFont(new Font("SansSerif", Font.BOLD, 11));
		g.drawString("version " + getVersion(), 170, 76);
		g.drawString(getDateISO(), 170, 91);
		splash.update();
	}
}