Loading JavaFX Application Resources

As you might already know, JavaFX allows you to use your existing Swing components in your applets. All you have to do is to add a few lines of JavaFX code. However, you may run into unexpected problems because of Java Web Start security model. We had such an issue in one of our projects, when we tried to transform a custom swing component into a JavaFX widget. The problem was that the resources such as button icons were not being loaded correctly. When I investigated the code, I noticed that I was using ClassLoader.getSystemClassLoader calls to load resources. However, Java Web Start uses a user-level classloader to load the application resources instead of the system classloader. I got rid of the problem by replacing ClassLoader.getSystemClassLoader calls with this.getClass().getClassLoader().


I hope this tip saves some time for you.


Yücel Ünlü

Comments

Popular posts from this blog

Powerful Free Webinar Network for Oracle Developers

Monitoring Oracle Database with Zabbix