Jav 8 Splash Screen.getSplashScreen()始终返回null。使用JNLP文件通过Java Web Start调用Jar

时间:2017-09-06 10:45:46

标签: java-8 splash

manifest file
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 20.1-b02 (Sun Microsystems Inc.)
SplashScreen-Image: Images/Splash.gif
Permissions: all-permissions

应用程序名称:DealEntry应用程序

The path to the splash screen is correct

在SplashScreen.getSplashScreen()上返回null。不知怎的,它在我的应用程序中不起作用。 Altough我尝试了一个有效的演示。

    import org.apache.log4j.Logger;

    import javax.swing.*;
     import java.awt.*;
     import java.awt.*;
     import java.awt.event.*;
     import java.awt.*;
     import java.awt.event.*;

     public class Splash extends Frame implements ActionListener {
        static void renderSplashFrame(Graphics2D g, int frame) 
        {
        final String[] comps = {"foo", "bar", "baz"};
        g.setComposite(AlphaComposite.Clear);
        g.fillRect(120,140,200,40);
        g.setPaintMode();
        g.setColor(Color.BLACK);
        g.drawString("Loading "+comps[(frame/5)%3]+"...", 120, 150);
    }
    public Splash() {
        final SplashScreen splash = SplashScreen.getSplashScreen();

当使用javaws执行jar os时,始终返回null。

    if (splash == null) {
            System.out.println("SplashScreen.getSplashScreen() returned 
    null");
            return;
        }
        Graphics2D g = splash.createGraphics();
        if (g == null) {
            System.out.println("g is null");
            return;
        }
   }
    public void actionPerformed(ActionEvent ae) {
    }

    private static WindowListener closeWindow = new WindowAdapter(){
        public void windowClosing(WindowEvent e){
            e.getWindow().dispose();
        }
    };

    public static void main (String args[]) {
        Splash test = new Splash();
     }
}

0 个答案:

没有答案