Issue Related to Splash Screen in Java


 
Thread Tools Search this Thread
Top Forums Programming Issue Related to Splash Screen in Java
# 1  
Old 04-15-2009
Issue Related to Splash Screen in Java

Hi all,

Actually I want to flash the image which I have in my system and when I am trying to do it,it is not showing it.simply creates the frame but not displaying the image.I am attaching the code--


Quote:
import java.awt.*;
import javax.swing.*;

public class SplashScreen extends JWindow {
private int duration;
public SplashScreen(int d) {
duration = d;
}

// A simple little method to show a title screen in the center
// of the screen for the amount of time given in the constructor
public void showSplash() {

Dimension size = new Dimension(0,0);
// Set the window's bounds, centering the window
int width = 404;
int height =406;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int x = (screen.width-width)/2;
int y = (screen.height-height)/2;
System.out.println("x=="+x);
System.out.println("y=="+y);
setBounds(x,y,width,height);

// Build the splash screen
JLabel label = new JLabel(new ImageIcon("Logo.gif"));

// Display it
setVisible(true);

// Wait a little while, maybe while loading resources
try { Thread.sleep(duration); } catch (Exception e) {}

setVisible(false);
}

public void showSplashAndExit() {
showSplash();
System.exit(0);
}

public static void main(String[] args) {
// Throw a nice little title page up on the screen first
SplashScreen splash = new SplashScreen(5000);
// Normally, we'd call splash.showSplash() and get on with the program.
// But, since this is only a test...
splash.showSplashAndExit();
}
}

Please take a look on it and please provide your valuable suggestions on it so that I can flash the image.
# 2  
Old 04-15-2009
You have created a JLabel. But you have not added it to the container yet.

Do a
Code:
getContentPane().add (label)

Alternatively Java 6 has added some functionality for splash screens. See http://java.sun.com/docs/books/tutor...ashscreen.html
# 3  
Old 04-15-2009
after adding it,I am still not getting the image.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

IBM eServer X 335 stops boot process at Server splash screen

Hi there. I used to use linux a lot a number of years ago but it has been quite a while so ?I really consider myself a beginner again. I have an old IBM eServer X Series 335 machine and I want to get it back up and running for a number of reasons. I knew that one of the SCSI drives was bad and... (2 Replies)
Discussion started by: filch2
2 Replies

2. Shell Programming and Scripting

Need help in an issue related to mailx

Hello, I have a file temp.txt with the below contents : Sep 9 03:04:51 adcsdp01 MAPDR2_00: Unable to open trace file adpstartarv.log. (Error 110 Resource temporarily unavailable) Sep 9 03:05:35 adcsdp01 MAPDR2_00: SAP Service ADPMR2_00 successfully started. Sep 9 03:04:51 adcsdp01... (7 Replies)
Discussion started by: rahul2662
7 Replies

3. UNIX for Advanced & Expert Users

XUbuntu Live CD customizing using uck-gui. - Splash screen not changing

Hi all, I am customizing the Xubuntu 12.04 live cd.. Using uck-gui , i extracted the iso file and mounted in a location. Can anyone please help me out how to proceed with removing the splash screen ( the screen that gives loading image with xubuntu logo) or to change the logo that is in... (1 Reply)
Discussion started by: selvarajvs
1 Replies

4. Emergency UNIX and Linux Support

XUbuntu Live CD customizing using uck-gui. - Splash screen not changing

Hi all, I am customizing the Xubuntu 12.04 live cd.. Using uck-gui , i extracted the iso file and mounted in a location. Can anyone please help me out how to proceed with removing the splash screen ( the screen that gives loading image with xubuntu logo) or to change the logo that is in the... (1 Reply)
Discussion started by: selvarajvs
1 Replies

5. Red Hat

grub splash screen not displayed

I re-installed grub on /dev/sdb on a 3ware raid machine and now the grub splash screen is not displayed when booting. Server when boots up comes and halt in the grub menu and I need to manually load kernel and initrd to get the machine up. I have not changed any grub setting. I used the command... (0 Replies)
Discussion started by: anil510
0 Replies

6. Shell Programming and Scripting

Date related issue

Hi, I have TDATE=$(date '+%b %d') That stores "Sep 01" in the TDATE. How I can store "Sep 1"? Thanks in advance (3 Replies)
Discussion started by: dipeshvshah
3 Replies

7. Programming

Issue Related to Splash Screen

Hi Guys, I am working with Solaris 9 and we are developing the application which will work on different OS.So we develop the GUI using JAVA swings... we want to display a Splash screen before starting the installation of the application... 1st we develop our application for windows and it is... (1 Reply)
Discussion started by: smartgupta
1 Replies

8. Shell Programming and Scripting

Simple Shell Script Question.... [java related]

Hey guys! This is my first post, as im new here :S I have a simple problem for a big program. We have a .sh to install it, but when I run the .sh in terminal like i should, It says the class is not found. I believe it has to do with the syntax, as the person who made it is not a linux pro. I... (3 Replies)
Discussion started by: Drags111
3 Replies

9. Programming

help me with the error of Java related to UNIX

Can you help me with my code? I wrote a Java program and ran it in gdb, the debugger said that : (gdb) run handhelditems 1 1000 Starting program: /home/wqq/crawl/handhelditems/crawl_what_i_want handhelditems 1 1000 Program received signal SIGPWR, Power fail/restart. (2 Replies)
Discussion started by: cf.george
2 Replies

10. Shell Programming and Scripting

file related issue

Hi all, Anybody knows how to write a script to open a file and store the weekday(mon-sun) on first line and current datetime on the second line of the file. If file doesn't exist, create a new one and store the weekday and current datetime. If it already exists, open it and get both... (2 Replies)
Discussion started by: k_oops9
2 Replies
Login or Register to Ask a Question