Netbeans platform animated splash screen

Our maven / Netbeans platform application uses a custom image at startup, replacing

Nbm branding> core.jar> org.netbeans.core.startup> splash.gif

I tried to make it animated .gif, but only the first frame is displayed.

How could an animated splash screen be implemented, perhaps by running some JavaFX window animations?

I saw another SO question , but they did not answer it - please note that I am asking about how to integrate a custom splash screen with my Netbeans Platform, and not how to build it.

+5
source share
2 answers

, , .

, , :

import java.lang.reflect.Method;

public class CustomStartup {

    private static final String NB_MAIN_CLASS = "org.netbeans.core.startup.Main";

    public static void main(String[] args) throws Exception {
        // do whatever you need here (e.g. show a custom login form)
        System.out.println("Hello world! I am a custom startup class");
        JWindow splash = initSplash();

        // once you're done with that, hand control back to NetBeans
        ClassLoader classloader = Thread.currentThread().getContextClassLoader();
        Class<?> mainClass = Class.forName(NB_MAIN_CLASS, true, classloader);

        Object mainObject = mainClass.newInstance();
        Method mainMethod = mainClass.getDeclaredMethod("main", new Class[]{String[].class});
        mainMethod.invoke(mainObject, (Object) args);

        splash.setVisible(false);
    }
}

JavaFX, JWindow :

public JWindow initSplash(){
       JWindow window = new JWindow();
       final JFXPanel fxPanel = new JFXPanel();
       window.add(fxPanel);
       window.setVisible(true);
       window.setLocationRelativeTo(null);

        Platform.runLater(new Runnable() {

            @Override
            public void run() {
                Scene scene = new Scene(new CustomFxSplash(), 475, 300, true);
                fxPanel.setScene(scene);
            }
        }
       return window;
}

, :

  • NetBeans, --nosplash.

  • , -J-Dnetbeans.mainclass=com.package.splash.CustomStartup

  • , platform/core.

+2

NetBeans, , : org.netbeans.core.startup.

, gif, - ( 546)

graphics.drawImage(image, 0, 0, null);

, gif ImageObserver, , null, imageUpdate() ImageObserver .

gif : Animated Gif Image Observer

, , NetBeans, , NetBeans.

, !

+1

All Articles