Creating a simple splash screen

Hi,
I'm trying to create a simple splash screen with maybe a button. When this is pressed, the next thing shown in the application window should be the cylinder with my picture of Arizona on it.
Can anyone help?
Also trying to place a new image onto the cylinder shape when the Open button is pressed in the FileChooser dialog box.
Could someone help with this problem, I'm not sure what else is required.
Thanks.
import com.sun.j3d.utils.geometry.Cylinder;
import com.sun.j3d.utils.image.*;
import com.sun.j3d.utils.universe.*;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.event.*;
import com.sun.j3d.utils.applet.MainFrame;
import java.io.*;
import java.util.*;
import javax.media.j3d.*;
import javax.vecmath.*;
import java.awt.Container;
import javax.media.j3d.Group;
import com.sun.j3d.utils.image.TextureLoader;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar.*;
import javax.swing.JMenuItem;
//import javax.swing.JSlider;
import javax.swing.*;
import javax.swing.filechooser.*;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
public class ProjectCylinder extends JApplet
// Variable declarations
JMenuBar menuBar;
JMenu jMenu, jSubMenu;
JCheckBoxMenuItem cbMenuItem;
JRadioButtonMenuItem rbMenuItem;
Container C=getContentPane();
//JSlider sliderbar;
// To setup the menu bar, options etc.
public void init()
new ProjectCylinder();
//Create a file chooser
final JFileChooser fc = new JFileChooser();
menuBar = new JMenuBar();
menuBar.setPreferredSize(new Dimension(400, 20));
setJMenuBar(menuBar);
JMenuItem jMenuItem;
// Building the File menu
jMenu = new JMenu("File");
jMenu.setMnemonic(KeyEvent.VK_F);
menuBar.add(jMenu);
jMenuItem = new JMenuItem("Open...", new ImageIcon("A:/open.gif"));
jMenuItem.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
int returnVal = fc.showOpenDialog(ProjectCylinder.this);
if (returnVal == JFileChooser.APPROVE_OPTION)
try
File file = fc.getSelectedFile();
// in here is supposed to be the functionality of putting a new image onto the cylinder
catch(FileNotFoundException f)
// do something here
jMenuItem.setMnemonic(KeyEvent.VK_O);
jMenuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_T, ActionEvent.ALT_MASK));
jMenu.add(jMenuItem);
jMenu.addSeparator();
// File Save
jMenuItem = new JMenuItem("Save", new ImageIcon("A:/save.gif"));
jMenuItem.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
int returnVal = fc.showSaveDialog(ProjectCylinder.this);
if (returnVal == JFileChooser.APPROVE_OPTION)
File file = fc.getSelectedFile();
//this is where a real application would save the file.
jMenuItem.setMnemonic(KeyEvent.VK_O);
jMenuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_T, ActionEvent.ALT_MASK));
jMenu.add(jMenuItem);
// File Close
jMenuItem = new JMenuItem("Close");
jMenuItem.setMnemonic(KeyEvent.VK_O);
jMenuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_T, ActionEvent.ALT_MASK));
jMenu.add(jMenuItem);
jMenuItem = new JMenuItem("Exit", KeyEvent.VK_T);
jMenuItem.setMnemonic(KeyEvent.VK_T);
jMenuItem.setAccelerator(KeyStroke.getKeyStroke(
KeyEvent.VK_T, ActionEvent.ALT_MASK));
jMenu.add(jMenuItem);
C.add("South", menuBar);
//sliderbar = new JSlider(JSlider.HORIZONTAL, 0, 30);
//menuBar.add(sliderbar);
//C.add("South", menuBar);
// end init
public BranchGroup createSceneGraph()
BranchGroup objRoot = new BranchGroup();
TransformGroup objScale = new TransformGroup();
Transform3D t3d = new Transform3D();
t3d.setScale(1.2); //Size of cylinder
objScale.setTransform(t3d);
objRoot.addChild(objScale);
TransformGroup objTrans = new TransformGroup();
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
objScale.addChild(objTrans);
// Set up the colours
Color3f black = new Color3f(0.0f, 0.0f, 0.0f);
Color3f white = new Color3f(1.0f, 1.0f, 1.0f);
Color3f red = new Color3f(0.7f, .15f, .15f);
// Set up the texture map
TextureLoader loader = new TextureLoader("A:\\Arizona.jpg","LUMINANCE", new Container());
Texture texture = loader.getTexture();
texture.setBoundaryModeS(Texture.WRAP);
texture.setBoundaryModeT(Texture.WRAP);
texture.setBoundaryColor( new Color4f( 0.0f, 1.0f, 0.0f, 0.0f ));
// Set up the texture attributes
TextureAttributes texAttr = new TextureAttributes();
texAttr.setTextureMode(TextureAttributes.MODULATE);
Appearance ap = new Appearance();
Material mat = new Material();
ap.setTexture(texture);
ap.setTextureAttributes(texAttr);
//set up the material
ap.setMaterial(new Material(white, red, white, red, 1.0f));
// Create a cylinder
int primflags = Cylinder.GENERATE_NORMALS +Cylinder.GENERATE_TEXTURE_COORDS;
Cylinder CylinderObj = new Cylinder(0.5f, 0.5f, primflags, ap);
objTrans.addChild(CylinderObj);
//Add to scene graph
BoundingSphere bounds =new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
//Shine coloured lights
Color3f lColor1 = new Color3f(0.7f, 0.0f, 0.7f);
Color3f lColor2 = new Color3f(0.7f, 0.7f, 0.0f);
Vector3f lDir1 = new Vector3f(-1.0f, -1.0f, -1.0f);
Vector3f lDir2 = new Vector3f(0.0f, 0.0f, -1.0f);
DirectionalLight lgt1 = new DirectionalLight(lColor1, lDir1);
DirectionalLight lgt2 = new DirectionalLight(lColor2, lDir2);
lgt1.setInfluencingBounds(bounds);
lgt2.setInfluencingBounds(bounds);
objScale.addChild(lgt1);
objScale.addChild(lgt2);
// Let Java 3D perform optimizations on this scene graph.
objRoot.compile();
return objRoot;
} // end BranchGroup createSceneGraph
public ProjectCylinder()
C.setLayout(new BorderLayout());
Canvas3D c = new Canvas3D(null);
C.add("Center", c);
// Create a simple scene and attach it to the virtual universe
BranchGroup scene = createSceneGraph();
SimpleUniverse u = new SimpleUniverse(c);
u.getViewingPlatform().setNominalViewingTransform();
u.addBranchGraph(scene);
} // end ProjectCylinder
public static void main(String argv[])
BranchGroup group;
new MainFrame(new ProjectCylinder(), 300, 300);
} // end void main
} // end class ProjectCylinder

Yeah I thought JWindow should be used, but it's getting it into my project that is the real problem.

Similar Messages

  • Creating a fancy splash screen

    Hi
    Does anyone know how I can create a splash screen like those displayed by Adobe products, e.g.
    http://www.nationmaster.com/wikimir/images/upload.wikimedia.org/wikipedia/en/thumb/e/e0/S-comp-sw-aid-st.jpg/180px-S-comp-sw-aid-st.jpg
    If you look at the image, the butterly wings extend out into the screen.
    I'm not sure how I could add a graphic to a Swing component in order to achieve this, any ideas?
    thanks,
    BBB

    Camickr,
    I tried using the method you suggested but it doesn't seem to work. The JWindow simply gets resized to the JLayeredPane, so I end up with the Gray background of the JWindow instead of it being transparent so that you can see through to the desktop.
    Are you actually sure it's possible using the method you suggested?
    Here's my code:
    public class Splashing extends JWindow {
        public Splashing ()
            ImageIcon oIcon = new javax.swing.ImageIcon(BackgroundLayered.class.getClassLoader().getResource("images/splash_screen.gif"));
            JLabel oLabel = new JLabel(oIcon);
            oLabel.setSize( 500, 500 );
            JLayeredPane oLayer = new JLayeredPane();
            oLayer.add(oLabel, JLayeredPane.FRAME_CONTENT_LAYER, -1);
            oLayer.setPreferredSize( new Dimension(500,500) );
            oLayer.setMaximumSize( oLayer.getPreferredSize() );
            getContentPane().add(oLayer, java.awt.BorderLayout.CENTER);
        public static void main (String args [])
            Splashing oLay = new Splashing();
            oLay.pack();
            oLay.setVisible(true);
    }

  • Creating a simple Login screen

    Hi folks,
    I'm a beginner trying to develop some code for a simple login screen for a database.
    I know that some packages (Access) have tailor-made code for this but can't seem to find
    anything in Oracle to do this. Can anyone help or point me in the right direction ?
    I'm using Oracle 8i and Forms 6i(8.1.7) running on Windows NT4.
    Thanks in advance,
    John

    Forms has a default for that.
    When you start a form with Forms runtime, the login screen is displayed automatically.

  • Edge Animate correct software for Animated Splash Screen iOS app???

    Hi eveyone, I am fairly new to the mobile designing and come from a print background, 99% of my posts are on the InDesign forums.
    I was wondering if you could please direct me to the best way to create an Animated Splash Screen for iOS?
    Would Adobe Edge Animate be the right tool?
    Or is there a different way to do it?
    I thought it would be coded by the app developers but I can't really find enough info and I'm a bit out of my depth to understand all the websites I've read.

    Yes, it would be pretty simple with phonegap.
    http://www.lynda.com/Edge-Animate-tutorials/Creating-PhoneGap-Build-app-Edge-Animate/12430 7/127570-4.html

  • Splash screen - need help loading

    I am having trouble calling a simple splash screen class from my main application class; My main application class called PUI, with all of my code that is working, I created a very simple splash class called PS. I want the PS to show before the main PUI application loads. Here is the simple code for the PS class.
    public class PandoraSplash {
         public static void main(String[] arg) {
              JWindow window = new JWindow();
              window.getContentPane().add(
                        new JLabel("Loading PANDORA...", SwingConstants.CENTER));
              window.setBounds(200, 200, 200, 100);
              window.setVisible(true);
              try {
                   Thread.sleep(5000);
              } catch (InterruptedException e) {
                   e.printStackTrace();
              window.setVisible(false);
              window.dispose();
    } As you can see the Thread is set for 5000, then I want the main PUI to open. How do I call this class from PUI? also, How do I make this class come first in the load of the entire package?
    Thank you, all help will be much appreciated!

    Note: This thread was originally posted in the [New To Java|http://forums.sun.com/forum.jspa?forumID=54] forum, but moved to this forum for closer topic alignment.

  • Useful Code of the Day:  Splash Screen & Busy Application

    So you are making an Swing application. So what are two common things to do in it?
    1) Display a splash screen.
    2) Block user input when busy.
    Enter AppFrame! It's a JFrame subclass which has a glass pane overlay option to block input (setBusy()). While "busy", it displays the system wait cursor.
    It also supports display of a splash screen. There's a default splash screen if you don't provide a component to be the splash screen, and an initializer runner which takes a Runnable object. The Runnable object can then modify the splash screen component, for example to update a progress bar or text. See the main method for example usage.
    It also has a method to center a component on another component (useful for dialogs) or center the component on the screen.
    NOTE on setBusy: I do recall issues with the setBusy option to block input. I recall it having a problem on some Unix systems, but I can't remember the details offhand (sorry).
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    * <CODE>AppFrame</CODE> is a <CODE>javax.swing.JFrame</CODE> subclass that
    * provides some convenient methods for applications.  This class implements
    * all the same constructors as <CODE>JFrame</CODE>, plus a few others. 
    * Methods exist to show the frame centered on the screen, display a splash
    * screen, run an initializer thread and set the frame as "busy" to block 
    * user input. 
    public class AppFrame extends JFrame implements KeyListener, MouseListener {
          * The splash screen window. 
         private JWindow splash = null;
          * The busy state of the frame. 
         private boolean busy = false;
          * The glass pane used when busy. 
         private Component glassPane = null;
          * The original glass pane, which is reset when not busy. 
         private Component defaultGlassPane = null;
          * Creates a new <CODE>AppFrame</CODE>. 
         public AppFrame() {
              super();
              init();
          * Creates a new <CODE>AppFrame</CODE> with the specified
          * <CODE>GraphicsConfiguration</CODE>. 
          * @param  gc  the GraphicsConfiguration of a screen device
         public AppFrame(GraphicsConfiguration gc) {
              super(gc);
              init();
          * Creates a new <CODE>AppFrame</CODE> with the specified title. 
          * @param  title  the title
         public AppFrame(String title) {
              super(title);
              init();
          * Creates a new <CODE>AppFrame</CODE> with the specified title and
          * <CODE>GraphicsConfiguration</CODE>. 
          * @param  title  the title
          * @param  gc     the GraphicsConfiguration of a screen device
         public AppFrame(String title, GraphicsConfiguration gc) {
              super(title, gc);
              init();
          * Creates a new <CODE>AppFrame</CODE> with the specified title and
          * icon image. 
          * @param  title  the title
          * @param  icon   the image icon
         public AppFrame(String title, Image icon) {
              super(title);
              setIconImage(icon);
              init();
          * Creates a new <CODE>AppFrame</CODE> with the specified title and
          * icon image. 
          * @param  title  the title
          * @param  icon  the image icon
         public AppFrame(String title, ImageIcon icon) {
              this(title, icon.getImage());
          * Initializes internal frame settings. 
         protected void init() {
              // set default close operation (which will likely be changed later)
              setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
              // set up the glass pane
              glassPane = new JPanel();
              ((JPanel)glassPane).setOpaque(false);
              glassPane.addKeyListener(this);
              glassPane.addMouseListener(this);
          * Displays a new <CODE>JWindow</CODE> as a splash screen using the
          * specified component as the content.  The default size of the
          * component will be used to size the splash screen.  See the
          * <CODE>showSplash(Component, int, int)</CODE> method description for
          * more details. 
          * @param  c  the splash screen contents
          * @return  the window object
          * @see  #showSplash(Component, int, int)
          * @see  #hideSplash()
         public JWindow showSplash(Component c) {
              return showSplash(c, -1, -1);
          * Displays a new <CODE>JWindow</CODE> as a splash screen using the
          * specified component as the content.  The component should have all
          * the content it needs to display, like borders, images, text, etc. 
          * The splash screen is centered on monitor.  If width and height are
          * <CODE><= 0</CODE>, the default size of the component will be used
          * to size the splash screen. 
          * <P>
          * The window object is returned to allow the application to manipulate
          * it, (such as move it or resize it, etc.).  However, <B>do not</B>
          * dispose the window directly.  Instead, use <CODE>hideSplash()</CODE>
          * to allow internal cleanup. 
          * <P>
          * If the component is <CODE>null</CODE>, a default component with the
          * frame title and icon will be created. 
          * <P>
          * The splash screen window will be passed the same
          * <CODE>GraphicsConfiguration</CODE> as this frame uses. 
          * @param  c  the splash screen contents
          * @param  w  the splash screen width
          * @param  h  the splash screen height
          * @return  the window object
          * @see  #showSplash(Component)
          * @see  #hideSplash()
         public JWindow showSplash(Component c, int w, int h) {
              // if a splash window was already created...
              if(splash != null) {
                   // if it's showing, leave it; else null it
                   if(splash.isShowing()) {
                        return splash;
                   } else {
                        splash = null;
              // if the component is null, then create a generic splash screen
              // based on the frame title and icon
              if(c == null) {
                   JPanel p = new JPanel();
                   p.setBorder(BorderFactory.createCompoundBorder(
                        BorderFactory.createRaisedBevelBorder(),
                        BorderFactory.createEmptyBorder(10, 10, 10, 10)
                   JLabel l = new JLabel("Loading application...");
                   if(getTitle() != null) {
                        l.setText("Loading " + getTitle() + "...");
                   if(getIconImage() != null) {
                        l.setIcon(new ImageIcon(getIconImage()));
                   p.add(l);
                   c = p;
              splash = new JWindow(this, getGraphicsConfiguration());
              splash.getContentPane().add(c);
              splash.pack();
              // set the splash screen size
              if(w > 0 && h > 0) {
                   splash.setSize(w, h);
              } else {
                   splash.setSize(c.getPreferredSize().width, c.getPreferredSize().height);
              centerComponent(splash);
              splash.show();
              return splash;
          * Disposes the splash window. 
          * @see  #showSplash(Component, int, int)
          * @see  #showSplash(Component)
         public void hideSplash() {
              if(splash != null) {
                   splash.dispose();
                   splash = null;
          * Runs an initializer <CODE>Runnable</CODE> object in a new thread. 
          * The initializer object should handle application initialization
          * steps.  A typical use would be:
          * <OL>
          *   <LI>Create the frame.
          *   <LI>Create the splash screen component.
          *   <LI>Call <CODE>showSplash()</CODE> to display splash screen.
          *   <LI>Run the initializer, in which: 
          *   <UL>
          *     <LI>Build the UI contents of the frame.
          *     <LI>Perform other initialization (load settings, data, etc.).
          *     <LI>Pack and show the frame.
          *     <LI>Call <CODE>hideSplash()</CODE>.
          *   </UL>
          * </OL>
          * <P>
          * <B>NOTE:</B>  Since this will be done in a new thread that is
          * external to the event thread, any updates to the splash screen that
          * might be done should be triggered through with
          * <CODE>SwingUtilities.invokeAndWait(Runnable)</CODE>. 
          * @param  r  the <CODE>Runnable</CODE> initializer
         public void runInitializer(Runnable r) {
              Thread t = new Thread(r);
              t.start();
          * Shows the frame centered on the screen. 
         public void showCentered() {
              centerComponent(this);
              this.show();
          * Checks the busy state.
          * @return  <CODE>true</CODE> if the frame is disabled;
          *          <CODE>false</CODE> if the frame is enabled
          * @see  #setBusy(boolean)
         public boolean isBusy() {
              return this.busy;
          * Sets the busy state.  When busy, the glasspane is shown which will
          * consume all mouse and keyboard events, and a wait cursor is
          * set for the frame. 
          * @param  busy  if <CODE>true</CODE>, disables frame;
          *               if <CODE>false</CODE>, enables frame
          * @see  #getBusy()
         public void setBusy(boolean busy) {
              // only set if changing
              if(this.busy != busy) {
                   this.busy = busy;
                   // If busy, keep current glass pane to put back when not
                   // busy.  This is done in case the application is using
                   // it's own glass pane for something special. 
                   if(busy) {
                        defaultGlassPane = getGlassPane();
                        setGlassPane(glassPane);
                   } else {
                        setGlassPane(defaultGlassPane);
                        defaultGlassPane = null;
                   glassPane.setVisible(busy);
                   glassPane.setCursor(busy ?
                        Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR) :
                        Cursor.getDefaultCursor()
                   setCursor(glassPane.getCursor());
          * Handle key typed events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  ke  the key event
         public void keyTyped(KeyEvent ke) {
              ke.consume();
          * Handle key released events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  ke  the key event
         public void keyReleased(KeyEvent ke) {
              ke.consume();
          * Handle key pressed events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  ke  the key event
         public void keyPressed(KeyEvent ke) {
              ke.consume();
          * Handle mouse clicked events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  me  the mouse event
         public void mouseClicked(MouseEvent me) {
              me.consume();
          * Handle mouse entered events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  me  the mouse event
         public void mouseEntered(MouseEvent me) {
              me.consume();
          * Handle mouse exited events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  me  the mouse event
         public void mouseExited(MouseEvent me) {
              me.consume();
          * Handle mouse pressed events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  me  the mouse event
         public void mousePressed(MouseEvent me) {
              me.consume();
          * Handle mouse released events.  Consumes the event for the glasspane
          * when the frame is busy. 
          * @param  me  the mouse event
         public void mouseReleased(MouseEvent me) {
              me.consume();
          * Centers the component <CODE>c</CODE> on the screen. 
          * @param  c  the component to center
          * @see  #centerComponent(Component, Component)
         public static void centerComponent(Component c) {
              centerComponent(c, null);
          * Centers the component <CODE>c</CODE> on component <CODE>p</CODE>. 
          * If <CODE>p</CODE> is null, the component <CODE>c</CODE> will be
          * centered on the screen. 
          * @param  c  the component to center
          * @param  p  the parent component to center on or null for screen
          * @see  #centerComponent(Component)
         public static void centerComponent(Component c, Component p) {
              if(c != null) {
                   Dimension d = (p != null ? p.getSize() :
                        Toolkit.getDefaultToolkit().getScreenSize()
                   c.setLocation(
                        Math.max(0, (d.getSize().width/2)  - (c.getSize().width/2)),
                        Math.max(0, (d.getSize().height/2) - (c.getSize().height/2))
          * Main method.  Used for testing.
          * @param  args  the arguments
         public static void main(String[] args) {
              final AppFrame f = new AppFrame("Test Application",
                   new ImageIcon("center.gif"));
              f.showSplash(null);
              f.runInitializer(new Runnable() {
                   public void run() {
                        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                        f.getContentPane().add(new JButton("this is a frame"));
                        f.pack();
                        f.setSize(300, 400);
                        try {
                             Thread.currentThread().sleep(3000);
                        } catch(Exception e) {}
                        f.showCentered();
                        f.setBusy(true);
                        try {
                             Thread.currentThread().sleep(100);
                        } catch(Exception e) {}
                        f.hideSplash();
                        try {
                             Thread.currentThread().sleep(3000);
                        } catch(Exception e) {}
                        f.setBusy(false);
    "Useful Code of the Day" is supplied by the person who posted this message. This code is not guaranteed by any warranty whatsoever. The code is free to use and modify as you see fit. The code was tested and worked for the author. If anyone else has some useful code, feel free to post it under this heading.

    Hi
    Thanks fo this piece of code. This one really help me
    Deepa

  • Splash screen when running from shortcut

    I have a web start app, version 1.2, with a custom splash screen and icon (2 entries in jnlp, one with type="splash"). This works just fine IF you run from the web page (I get a nice splash, followed by the "loading" window with my nice icon). If after running the app twice and allowing it to create a desktop shortcut, I run from that shortcut - the splash screen doesn't show. The plain icon is still around, just not the splash.
    Anyone else seen this and know how to fix it?
    TIA
    Mike

    The splash screen never seems to display for very long, so I can't tell if it works correctly or not. I just created my own splash screen in the application and everything works great.

  • Splash screen needs to keep on top

    Hello Everyone,
    I have been working on application where i need to show splash screen before launching the actual application.
    I did create JDailog as splash screen and want to show this splash screen at top of all application but I don't want to set setAlwaysOnTop(true). becasue my requirement is that to keep splash screen on top at the time of launching. if user click any other application and splash screen doesn't remain on top, that is fine with me.
    i want when i do launch my application and start working on other application like MS word, splash screen must visible at the top of the active application.
    so what really i need to do to keep this on top of active application.
    I don't want to use setAlwaysOnTop(true). because it has certain limitations and that doesn’t really work in my case.
    really looking for your great response.
    Thanks,

    You could do setAlwaysOnTop( true ) to ensure that the splash screen is shown on top,
    and have a listener to reset it once it is made visible. Something like
    splash.addHierarchyListener( new HierarchyListener() {
         public void hierarchyChanged(HierarchyEvent e) {
              if ( HierarchyEvent.SHOWING_CHANGED == ( e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED ) ) {
                   splash.setAlwaysOnTop( false );
    };

  • Chromeless splash screen for application

    hi!
    Anyone know how to create a Chromeless splash screen for java application.Just like the startup screen for the normal application? When the java application start-up the screen will show, it's close after a few screen or user click a button.
    and is there anyway to add background image for a java application?
    Thank in advance!
    jet

    hi there, check a look at this code:
    import javax.swing.*;
    import java.awt.*;
    public class Splash implements Runnable, mainInterface{
    private String initMsg;
    public Splash(String initMsg) {
    this.initMsg = initMsg;
    public void run() {
    splashWindow.getContentPane().add(l, BorderLayout.CENTER);
    splashWindow.pack();
    splashWindow.setSize(splashWindow.getSize().width, splashWindow.getSize().height);
    splashWindow.setLocation(dim.width/2 - splashWindow.getWidth() /2,dim.height/2 -
    splashWindow.getHeight()/2);
    splashWindow.toFront();
    splashWindow.show(); }
    public JWindow getWindow()
    return splashWindow;
    }add this code to the main file
    private static void splash()
              th.start(); // I sleep to let the thread startup and display the window
                   while (splash3.getWindow() == null || !splash3.getWindow().isShowing())
                        try {
                             Thread.sleep(2000);
                        catch (InterruptedException e){}
         }hope u understand this
    asrar

  • J2ME splash screen using alerts

    Hi everyone,
    I have used alerts before with no problem, but I am having probelms using them to create a welcome splash screen. The code I have used is below:
    private void showSplashScreen(Display d)
         Image logo = null;
         try
         logo = Image.createImage("/images/logo.png");
         catch( IOException e )
                   System.out.println(e);
         Alert splash = new Alert( "Advanced Predictive Text", "David Fowler", logo, null);
         splash.setTimeout(3000);
         d.setCurrent(splash, tb); // tb is a global variable
         System.out.println("Displayed splash screen");
    The method is called on startup. The toolkit displays "Displayed splash screen", but nothing is shown on the emulator. If it's running the code why isn't the alert appearing? The textbox (tb) appears no probs!
    Three days prior to my final year demo...please help!!!
    Many thanks in advance,
    David Fowler

    try this...
    private void showSplashScreen()
         Image logo = null;
         try
              logo = Image.createImage("/images/logo.png");
         catch( IOException e )
              System.out.println(e);
         Alert splash = new Alert("Advanced Predictive Text", "David Fowler", logo, null);
         splash.setTimeout(3000);
         Display.getDisplay(this).setCurrent(splash);
         System.out.println("Displayed splash screen");
    }

  • Creating a splash screen for your app.

    Im trying to create a splash screen for my app but im not too sure how it's done.
    Im using the following piece of code.
    public static void main(String[] args)
              JPanel display = new JPanel();
              display.setPreferredSize(new Dimension( (300), (200) ));
              display.setBackground(Color.white);
                   // I WILL PUT AN IMAGE ICON ON A JLABEL HERE              
              display.setVisible(true);
                   // I WILL NEED A DELAY HERE
              test.instance();
    }The problem I am having is that the JPanel is not being displayed. I will also need a way to create a delay, I know that I can't just use Thread.sleep(5000); because the JPanel will require the thread to be running in order to display the panel.
    Does anyone know how I could get my JPanel to display and somehow insert a delay before test.instance();?
    Thanks.

    I made my own a few days before for a database program. It can be easily done with Threads.
    I recommend you create a new class to be used as the spalsh screen , it has to extends JFrame and implements Runnable.
    I ll give you an example. I used the spash screen to display the screen and also to laod the main GUI form so that when the spash screen dispose, the main GUI form displays instantly, making the user think that the application loads faster.
    public void run ()
            try
                 this.setVisible(true);
                 Thread.sleep(2000);
                 // sets the menu visible before disposing
                 guiMenu.setVisible(true);
                 // disposes the object and returns the resources to the OS
                 this.dispose();
            catch(InterruptedException exception)
                exception.printStackTrace();
    // this method must be implement in the class
    // that implements Runnable interface
    //MAIN
    public class Main
        public static void main(String[] args)
            Menu menu = new Menu();
            SplashScreen introScreen = new SplashScreen(menu);
            ExecutorService splashExecutor= Executors.newFixedThreadPool(1);
            splashExecutor.execute(introScreen);       
    }ExecutorService is a subinterface of Executor that declares methods for managing the threads. It also has the method execute (that provides the Executor interface) which when invoked calls the method public void run() of the argument class that must implement Runnable.
    Executors.newFixedThreadPool(1); creates a poll consisting of a 1 thread which is been used by splashExecutor to execute the Runnable.
    Hope i've been of some assistance!

  • Custom splash screen not appearing in the Dynamic created jnlp()

    Hi,
    I am not able to show my custom splash screen while starting the webstart application, instead getting the "sun webstart logo". I am dynamically generating the jnlp file using jsp (struts application). Application is working perfectly except custom splash screen. Below is my jsp which will generate the jnlp on fly. The test.gif file is in place.
    <% response.setContentType("application/x-java-jnlp-file");
      response.setHeader( "Pragma", "no-cache");
      response.setDateHeader( "Expires", 0 );%>
    <%@ page import="java.io.*" %> 
    <%String baseURL = WebUtil.webUrlParser(request.getRequestURL().toString(),request.getContextPath(),request.getServerPort());%>
    <jnlp      spec="1.0+" codebase="<%=baseURL%>/cs_jnlp">
    <information>
        <title>Launching JNLP</title>
        <vendor>Satyasai</vendor>
        <icon href="/images/test1.jpg"/>
        <homepage href="docs/help.html"/>
       <description>test</description>
            <icon kind="splash" href="images/test.gif" />
       </information>
          <security>
            <all-permissions/>
         </security>
         <resources>
       <j2se version="1.6+"/>
       <jar href="<%=baseURL%>/cs_jnlp/AppLaunch.jar"/>
      </resources>
           <application-desc main-class="Launch" >
           <%
           int roleId = (Integer)session.getAttribute(Constant.USER_TYPE);
           String sessionID=(String)request.getAttribute("SELECTION_SESSION_ID");
           String action=(String)request.getAttribute("action");
           String userID = (String)session.getAttribute(Constant.LOGIN_ID);       
           String sessionType=(String)request.getAttribute("sessionType");        
           %>
           <argument><%=sessionID%></argument>
           <argument><%=action%></argument>
           <argument><%=userID%></argument>
           <argument><%=sessionType%></argument> 
    </application-desc>
    </jnlp>If I use normal servlet - jsp using RequestDispatcher to forward request to a jsp which on fly creates jnlp, it shows the my custom splash screen. I am not very sure where is the difference. If I look at both generated jnlps they are almost one and the same. Can any one throw some insight on this.
    Thanks & Regards,
    Satyasai

    Hi Andrew,
    Thanks for your response.
    1. I have launched it number of times but no luck.
    2. I have written a jsp (using servlet + jsp no struts frame work) which will create jnlp on fly, which is showing my custom splash screen. If you refer in the initial post, it is not working with struts kind of framework. See the below jsp which shows custom splash screen. It worked without href.
    3. All jnlps are well formed and perfectly working in my development environment. For security purposes I have not shown some of the texts and logos.
    <% response.setContentType("application/x-java-jnlp-file");
      response.setHeader( "Pragma", "no-cache");
      response.setDateHeader( "Expires", 0 );%>
    <%@page import="java.util.ArrayList" %>
    <%
    String client = (String)request.getAttribute("clientLocation");
    String fileNames = (String)request.getAttribute("filenames");
    String url= (String)request.getAttribute("serverFilesLocation");
    String baseURL = "http://"+request.getLocalAddr()+":"+request.getServerPort()+request.getContextPath();
    %>
    <jnlp spec="1.0+" codebase="<%=baseURL%>/sw_jnlp"> 
      <information>
        <title>Softwares Download</title>
        <vendor>test</vendor>
        <icon href="/images/test1.jpg"/>
        <homepage href="docs/help.html"/>
       <description>Software Downloads </description>
            <icon kind="splash" href="images/logo_small.gif" />
       </information>
       <update check="timeout" policy="always"/>
          <security>
          <all-permissions/>
      </security>
      <resources>
        <j2se version="1.6+"/>        
        <jar href="mod.jar"/>  
      </resources> 
      <application-desc main-class="InstallSW">
      <argument><%=client%></argument>
      <argument><%=fileNames%></argument>
      <argument><%=url%></argument>
      </application-desc>
    </jnlp>Thanks & Regards,
    Satyasai

  • I created an application and in  that application if date is changed the application starts from splash screen on re-entering and if date is not changed and u re-enters the application then it open in page where u leaved.Not working in USA timezone.

    I created an application and in  that application if date is changed the application starts from splash screen on re-entering and if date is not changed and u re-enters the application then it open in page where u leaved.It works fine in our side (Timezone,kolkata ,india even for Timezone,slvaniya,USA) but our USA client is telling that on changing the date it not starts from start-up sequence.Can anyone plz suggest the reason for it.

    This is the code which we have used.
    //////////Return if it is first time for the day or not//////////////
    + (BOOL)isFirstTimeToday {
    BOOL result = YES;
    NSDate *now = [[NSDate alloc] init];     /// represents the current time
    NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
    NSDateComponents *components = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate: now];
    NSDate *today = [gregorian dateFromComponents:components];
    [now release];
    [gregorian release];
    NSDate *savedDate = [[NSUserDefaults standardUserDefaults] objectForKey:LAST_TIME_VISITED];
    if (savedDate) {
    if ([today earlierDate:savedDate] == today) {
    result = NO;
    return result;
    ////////Stores the date/////////////
    + (void)userDidVisitReenforceScreenToday {
    [[NSUserDefaults standardUserDefaults] setObject:[NSDate todayAtMidnight] forKey:LAST_TIME_VISITED];
    ////////////What [NSDate todayAtMidnight] stores/////////////////////
    + (NSDate *)daysFromNowAtMidnight:(NSInteger)nOfDays {
    NSDate *date = [NSDate dateWithTimeIntervalSinceNow: (86400*nOfDays)];
    NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
    NSDateComponents *components = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate: date];
    NSDate *dateAtMidnight = [gregorian dateFromComponents:components];
    [gregorian release];
    NSLog(@"dateAtMidnight : %@",dateAtMidnight);
    return dateAtMidnight;
    + (NSDate *)todayAtMidnight {
    return [self daysFromNowAtMidnight:0];
    Please Suggest..

  • I created an application and in  that application if date is changed the application starts from splash screen on re-entering and if date is not changed and u re-enters the application then it open in page where u leaved.It works with iPod not with iPhone

    I created an application and in  that application if date is changed the application starts from splash screen on re-entering and if date is not changed and u re-enters the application then it open in page where u leaved.It works with iPod not with iPhone

    Try posting in the developer forums to see if you can get some assistance,you'll have to be a registered developer for access though.
    developer.apple.com

  • How to create desktop application (AIR) splash screen FB 4.7 ?

    Hi.  I am using Flash Builder 4.7 and with the tutorials and the API documentation on Flex by Adobe I can't seem to find a good solution for creating a Splash Screen for an Adobe AIR Desktop application.  I have found some results for mobile applications but I didn't go into those because I am developing for the desktop.  However if some of the moblie results are valid for porting to desktop I will give them a shot.
    Can anyone point me in the right direction?
    Thanks in advance.
    P.S.  If I port to mobile, I will be porting to Android

    Did you try the newly released SDK from official page, rather than labs? I would also suggest running FB with Java 1.6, if you have it on Java 1.7 - FB4.7 is known to yield some quirks with new java VMs.
    Flash Builder is developed on top of Eclipse platform, which is basically a pluggable architecture - nothing wrong with that. Number of files do not really affect the overall application performance. In general you should not touch that, unless you really know what you doing and can manage all the dependencies on your own. I agree, though, that's is quite unfortunate that Adobe decided to hide the AIR SDK deep inside plugins, instead dragging it out to a top-level folder, where it's visible and available for change. It was possible with Flex SDK configured externally, so why not here?

Maybe you are looking for

  • Can you have two itunes accounts on a single phone?

    Is it possible on an iphone 5s to have two itunes accounts? My child is getting to an age, where they should have their own itunes account.  We share music and applications and i do not want to have to re-buy everything?

  • Black screen instead of TTYs after Xorg once started and leaved

    Hi, I've installed Arch on my laptop and experience following issue... I log in after boot and run "startx", then openbox starts properly. This is fine, but when I leave X, I can't see anything (TTY expected). I can switch to another TTY, login as ro

  • Error while retrieving data from a context node

    Hello All, I am trying to get the value that will be slected in status field(drop down) of opportunity page. lr_bt ?= me->typed_context->BTSTATUSs->collection_wrapper->get_current( ). CHECK lr_bt is bound. CALL METHOD lr_ent->get_property_as_string(

  • Online in-depth PS Course (not free)

    Hello, I have been using PS for about a year now and am becoming quite proficient. I have found lots of tutorial videos online that have helped immensely. However, I would like to formalize my learning because I am sure there are fundamentals that I

  • Problem to connect Developer Suite forms 9 with Oracle 9i Database

    Hi, I have a problem to connect Developer Suite Release 2 forms 9 with Oracle 9i database release 1. I have done net8 easy configuration but no success. Can any one help me to solve this problem. Thanks in Advance Nasir Ali Mughal