java.awt.SplashScreen Java Examples
The following examples show how to use
java.awt.SplashScreen.
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: RESTUtil.java From rest-client with Apache License 2.0 | 6 votes |
/** * * @Title : closeSplashScreen * @Description: close splash screen * @Param : * @Return : void * @Throws : */ public static void closeSplashScreen() { SplashScreen ss = SplashScreen.getSplashScreen(); if (null == ss) { return; } try { ss.close(); } catch(Exception e) { // Ignore this exception } }
Example #2
Source File: MultiResolutionSplashTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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 #3
Source File: Main.java From gsn with GNU General Public License v3.0 | 6 votes |
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 #4
Source File: MagicMain.java From magarena with GNU General Public License v3.0 | 6 votes |
/** * 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 #5
Source File: MultiResolutionSplashTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
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
Source File: MultiResolutionSplashTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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 #7
Source File: UnixMultiResolutionSplashTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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 #8
Source File: KSE.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
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
Source File: MultiResolutionSplashTest.java From hottub with GNU General Public License v2.0 | 6 votes |
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 #10
Source File: AppSplashScreen.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** 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 #11
Source File: EarthApp.java From collect-earth with MIT License | 5 votes |
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 #12
Source File: Main.java From gsn with GNU General Public License v3.0 | 5 votes |
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 #13
Source File: TinkerTimeLauncher.java From TinkerTime with GNU General Public License v3.0 | 5 votes |
@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 #14
Source File: DBrowser.java From Rel with Apache License 2.0 | 5 votes |
private static boolean executeSplashInteractor(Runnable splashInteraction) { if (SplashScreen.getSplashScreen() == null) return false; // Non-MacOS if (!Util.isMac()) { splashInteraction.run(); closeSplash(); return true; } // MacOS Display display = Display.getDefault(); final Semaphore sem = new Semaphore(0); Thread splashInteractor = new Thread(() -> { splashInteraction.run(); sem.release(); display.asyncExec(() -> {}); closeSplash(); }); splashInteractor.start(); // Interact with splash screen while (!display.isDisposed() && !sem.tryAcquire()) if (!display.readAndDispatch()) display.sleep(); return true; }
Example #15
Source File: MultiResolutionSplashTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
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 #16
Source File: MultiResolutionSplashTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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 #17
Source File: MultiResolutionSplashTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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 #18
Source File: MultiResolutionSplashTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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 #19
Source File: MultiResolutionSplashTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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 #20
Source File: MultiResolutionSplashTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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 #21
Source File: Opt4J.java From opt4j with MIT License | 5 votes |
/** * 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(); } }
Example #22
Source File: MultiResolutionSplashTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
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 #23
Source File: KSE.java From keystore-explorer with GNU General Public License v3.0 | 4 votes |
/** * 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 = 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); String languageCode = applicationSettings.getLanguage(); if (!ApplicationSettings.SYSTEM_LANGUAGE.equals(languageCode)) { Locale.setDefault(new Locale(languageCode)); } updateSplashMessage(splash, res.getString("KSE.InitializingSecurity.splash.message")); initialiseSecurity(); // list of files to open after start List<File> parameterFiles = new ArrayList<>(); 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 #24
Source File: DBrowser.java From Rel with Apache License 2.0 | 4 votes |
private static void closeSplash() { SplashScreen splash = SplashScreen.getSplashScreen(); if (splash != null) splash.close(); }
Example #25
Source File: DBrowser.java From Rel with Apache License 2.0 | 4 votes |
private static void launch(String[] args) { Display.setAppName(Version.getAppName()); Display.setAppVersion(Version.getVersion()); final Display display = new Display(); OpenDocumentEventProcessor openDocProcessor = new OpenDocumentEventProcessor(); display.addListener(SWT.OpenDocument, openDocProcessor); openDocProcessor.addFilesToOpen(args); if (Util.isMac()) executeSplashInteractor(() -> { try { Thread.sleep(300); } catch (InterruptedException e1) { } }); try { Class.forName("org.reldb.rel.Rel"); localRel = true; } catch (ClassNotFoundException cnfe) { localRel = false; } OSSpecific.launch(Version.getAppName(), event -> quit(), event -> new AboutDialog(shell).open(), event -> new Preferences(shell).show() ); if (!Util.isMac()) { SplashScreen splash = SplashScreen.getSplashScreen(); if (splash != null && localRel && !Preferences.getPreferenceBoolean(PreferencePageGeneral.SKIP_DEFAULT_DB_LOAD)) { Graphics2D gc = splash.createGraphics(); Rectangle rect = splash.getBounds(); int barWidth = rect.width - 20; int barHeight = 10; Rectangle progressBarRect = new Rectangle(10, rect.height - 20, barWidth, barHeight); gc.draw3DRect(progressBarRect.x, progressBarRect.y, progressBarRect.width, progressBarRect.height, false); gc.setColor(Color.green); (new Thread(() -> { while (SplashScreen.getSplashScreen() != null) { int percent = Loading.getPercentageOfExpectedMessages(); int drawExtent = Math.min(barWidth * percent / 100, barWidth); gc.fillRect(progressBarRect.x, progressBarRect.y, drawExtent, barHeight); splash.update(); try { Thread.sleep(250); } catch (InterruptedException e) { } } })).start(); } } shell = createShell(); shell.setImage(IconLoader.loadIcon("RelIcon")); shell.setImages(loadIcons(display)); shell.setText(Version.getAppID()); shell.addListener(SWT.Close, e -> { shell.dispose(); }); shell.addDisposeListener(e -> quit()); shell.layout(); Loading.start(); Core.launch(openDocProcessor, shell); if (!Util.isMac()) closeSplash(); shell.open(); while (!display.isDisposed()) { try { if (!display.readAndDispatch()) display.sleep(); } catch (Throwable t) { System.out.println("DBrowser: Exception: " + t); t.printStackTrace(); } } }
Example #26
Source File: Opt4J.java From opt4j with MIT License | 4 votes |
public SplashScreen getSplash() { return splash; }
Example #27
Source File: SplashProgressReporter.java From magarena with GNU General Public License v3.0 | 4 votes |
public SplashProgressReporter(final SplashScreen splash) { this.splash = splash; }
Example #28
Source File: Opt4J.java From opt4j with MIT License | 4 votes |
public SplashDecorator(SplashScreen splash) { this.splash = splash; }
Example #29
Source File: ConsoleUserInterface.java From aion-germany with GNU General Public License v3.0 | 4 votes |
public ConsoleUserInterface() { SplashScreen.getSplashScreen().close(); }
Example #30
Source File: PdfsamApp.java From pdfsam with GNU Affero General Public License v3.0 | 4 votes |
private void closeSplash() { Optional.ofNullable(SplashScreen.getSplashScreen()).ifPresent(SplashScreen::close); }