Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2010
    Posts
    8
    Rep Power
    0

    Default SplashScreen.getSplashScreen() returned null

    Plesae need support for resolve this issue this code alwayes return null
    output is "SplashScreen.getSplashScreen() returned null"
    i created folder images under root folder and this folder have image


    package misc;

    import java.awt.*;
    import java.awt.event.*;

    public class SplashDemo extends Frame implements ActionListener {
    static void renderSplashFrame(Graphics2D g, int frame) {
    final String[] comps = {"foo", "bar", "baz"};
    g.setComposite(AlphaComposite.Clear);
    g.fillRect(130,250,280,40);
    g.setPaintMode();
    g.setColor(Color.BLACK);
    g.drawString("Loading "+comps[(frame/5)%3]+"...", 130, 260);
    g.fillRect(130,270,(frame*10)%280,20);
    }
    public SplashDemo() {
    super("SplashScreen demo");
    setSize(500, 300);
    setLayout(new BorderLayout());
    Menu m1 = new Menu("File");
    MenuItem mi1 = new MenuItem("Exit");
    m1.add(mi1);
    mi1.addActionListener(this);

    MenuBar mb = new MenuBar();
    setMenuBar(mb);
    mb.add(m1);
    final SplashScreen splash = SplashScreen.getSplashScreen();
    if (splash == null) {
    System.out.println("SplashScreen.getSplashScreen() returned null");
    return;
    }
    Graphics2D g = (Graphics2D)splash.createGraphics();
    if (g == null) {
    System.out.println("g is null");
    return;
    }
    for(int i=0; i<100; i++) {
    renderSplashFrame(g, i);
    splash.update();
    try {
    Thread.sleep(200);
    }
    catch(InterruptedException e) {
    }
    }
    splash.close();
    setVisible(true);
    toFront();
    }
    public void actionPerformed(ActionEvent ae) {
    System.exit(0);
    }
    public static void main (String args[]) {
    SplashDemo test = new SplashDemo();
    }
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Please read the SplashScreen API as it may have answered your question:
    This class cannot be instantiated. Only a single instance of this class can exist, and it may be obtained using the getSplashScreen() static method. In case the splash screen has not been created at application startup via the command line or manifest file option, the getSplashScreen method returns null.
    Also, please use code tags when posting code (please see my signature links for more information).

    I'm curious: why AWT and not Swing?

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Since this isn't a NetBeans question but rather an AWT/Swing question, I'm moving this thread.

Similar Threads

  1. Server returned HTTP response code: 500
    By fuliangQ in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 04-09-2009, 04:55 AM
  2. Cant we have two values returned from a method in a class
    By jaiminparikh in forum Advanced Java
    Replies: 7
    Last Post: 03-21-2009, 04:20 AM
  3. Returned type changes if class is extended. How?
    By Gelembjuk in forum New To Java
    Replies: 10
    Last Post: 10-31-2008, 12:18 PM
  4. problems with class Splashscreen in netbeans
    By ernieBob in forum NetBeans
    Replies: 0
    Last Post: 02-07-2008, 02:30 AM
  5. Server returned HTTP response code: 500
    By Heather in forum Java Servlet
    Replies: 1
    Last Post: 07-09-2007, 05:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •