8

I'd like to create a custom loading screen for a JavaFX application. Don't want the user to see the Java coffee cup icon, I want to put my own graphic there!

I've found out how to provide a static image, or even an animated GIF, but I'm more interested in a Flash-like screen where I can specify what the state of the image looks like at certain percentages.

Any ideas?

David Koelle
  • 20,370
  • 23
  • 91
  • 129
  • This should be easily doable if you are using java web-start to launch your application. In the JNLP file, you can mention: ` `. This is under the `` tag. – Aspirant Dec 09 '13 at 18:54

4 Answers4

4

For JavaFX2, you can set a custom preloader. You have complete control over then scene. I haven't used them personally, but this might be what you want. http://docs.oracle.com/javafx/2/deployment/preloaders.htm

Brian Blonski
  • 1,732
  • 17
  • 22
2

If you're setting things up as shown on This blog entry, it looks like the answer would be 'no' - the loading graphic is just part of the overall options that are passed to the applet. Because this applet could be any java code (not just javaFX), there's no way to tie your custom renderer in.

Atiaxi
  • 1,629
  • 1
  • 13
  • 18
2

you should use java timer:

Timer tm= new Timer(); 
Stage ilk;
int count;

public  void check() {      

    ilk=new Stage();
    TimerTask mission;

    gorev = new TimerTask() {
        @Override
        public void run() {

            Group root = new Group();     

            Scene scene;
            scene = new Scene(root, 960, 540);
            scene.setFill(Color.BLACK);
            ilk.setScene(scene);
            ilk.setTitle("Splash Screen"); 

            sayac++;
            if(count==5){
                tm.cancel();
                ilk.show();  
            }
        }
    };
    tm.schedule(mission, 0, 2000);
}
Morchul
  • 1,877
  • 1
  • 6
  • 19
drojokef
  • 417
  • 1
  • 4
  • 15
0

For changing the coffee cup icon:

stage.getIcons().add(new Image("images/myimage.png"));

and here is a reference for a very clear preloader screen out there and awesome css too: http://docs.oracle.com/javafx/2/best_practices/jfxpub-best_practices.htm

ufukomer
  • 863
  • 12
  • 15