java.awt.SplashScreen#update ( )源码实例Demo

下面列出了java.awt.SplashScreen#update ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: keystore-explorer   文件: KSE.java
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();
	}
}
 
源代码2 项目: gsn   文件: Main.java
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();
		}
	}
}
 
源代码3 项目: opt4j   文件: Opt4J.java
/**
 * 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();
	}
}