| | |
Splash screen in netbeans 6.0
![]() |
Hey
I'm trying to get a splash screen going for my application but having a problem in finding the image once the splash screen is called it returns a null.
I'm trying to use the java standard 6 way where the splash screen is displayed before the jvm is started and is displayed until a swing or awt container is displayed.
it fails at this point and returns null and continues on with the rest of the program as normal.
full code is as follows
The manifest code is
not sure if i have this right so this is my file format :
this is just a basic representation of the project hope it helps you to help me as i'm stumped at this point
Thanks
I'm trying to get a splash screen going for my application but having a problem in finding the image once the splash screen is called it returns a null.
I'm trying to use the java standard 6 way where the splash screen is displayed before the jvm is started and is displayed until a swing or awt container is displayed.
java Syntax (Toggle Plain Text)
if (splash == null) { System.out.println("SplashScreen.getSplashScreen() returned null"); return; }
it fails at this point and returns null and continues on with the rest of the program as normal.
full code is as follows
java Syntax (Toggle Plain Text)
package tree; import java.awt.*; import java.awt.event.*; public class splashScreen 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 splashScreen() { 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[]) { splashScreen test = new splashScreen(); } }
The manifest code is
java Syntax (Toggle Plain Text)
Manifest-Version: 1.0 Main-Class: tree/splashScreen SplashScreen-Image: tree/splash.png
not sure if i have this right so this is my file format :
Java Syntax (Toggle Plain Text)
myTree -project name scr HelpPanells -package tree -package splashScreen.java splash.png tree.exercises -package tree.exercises.pictures -package tree.icon -package
this is just a basic representation of the project hope it helps you to help me as i'm stumped at this point
Thanks
Last edited by toomuchfreetime; Apr 24th, 2008 at 1:53 pm.
•
•
Join Date: Nov 2007
Posts: 19
Reputation:
Solved Threads: 0
This site seems to contain some useful information.
http://java.sun.com/developer/techni.../splashscreen/
http://java.sun.com/developer/techni.../splashscreen/
-Signed Artmann
![]() |
Other Threads in the Java Forum
- Previous Thread: urgent reservation cancelling
- Next Thread: Uploaded Images Are Not Showing in jsp page
| Thread Tools | Search this Thread |
-xlint add android api applet application applications array arrays automation bank bi binary blackberry bluetooth chat class client code compile compiler component database development digit eclipse equation error event fractal freeze functiontesting game gameprogramming givemetehcodez graphics gui health html hyper ide idea image infinite input int integer j2me java javame javaprojects jetbrains jni jpanel jtable julia learningresources linux list login loop main map method methods mobile myregfun netbeans newbie nonstatic notdisplaying pearl problem program programming project qt recursion scanner screen scrollbar server set sms sort sorting spamblocker sql sqlserver string superclass swing system text-file thread threads tree variablebinding windows xor





