splash screen using JWindow

HI ,i had crated a splash screen using JWindow and made JWindow.setVisible(true); during the loading time and then made Jwindow.dispose(); after it gets loaded...but it is not working a only a blank window is visible not its contents....what's wrong
[285 byte] By [madhan.ponnusamya] at [2007-10-3 10:23:33]
# 1
Did you add contents to it? Post a Short,Self Contained, Compilable and Executable, Example Program of your problem.
zadoka at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...
# 2
There are plenty of working examples on the forum. Use "splash" as a keyword and search the forum.
camickra at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...
# 3
do you have setVisible(true) AFTER you have added the components?
Michael_Dunna at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...
# 4

this the code which iam using....i will call this fn where ever needed and agin call it to dispose it

JWindow loadWindow = new JWindow();

JLabel lblLoad = new JLabel("loading");

private void showloading(){

if(loadWindow.isVisible()){

loadWindow.dispose();

}

else{

loadWindow.setVisible(true);

}

loadWindow.add(lblLoad);

loadWindow.setSize(150,50);

loadWindow.setLocation(100,400);

}

if i call this function it showing a window without the label

madhan.ponnusamya at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...
# 5

hi!

try this way...

JWindow loadWindow = new JWindow();

JLabel lblLoad = new JLabel("loading");

private void showloading(){

if(loadWindow.isVisible()){

loadWindow.dispose();

}

else{

loadWindow.add(lblLoad);

loadWindow.setSize(150,50);

loadWindow.setLocation(100,400);

loadWindow.setVisible(true);

}

}

:)

Aniruddha-Herea at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...
# 6
that is also not working....same blank Window coming again
madhan.ponnusamya at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...
# 7
in the above code setBackground is working but the label is not getting added
madhan.ponnusamya at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...
# 8

import javax.swing.JLabel;

import javax.swing.JWindow;

import javax.swing.SwingConstants;

public class SimpleSplashScreen {

public static void main(String[] arg) {

JWindow jwin = new JWindow();

jwin.getContentPane()

.add(

new JLabel("Loading Swing utilities...",

SwingConstants.CENTER));

jwin.setBounds(200, 200, 200, 100);

jwin.setVisible(true);

try {

Thread.sleep(1000);

} catch (InterruptedException e) {

e.printStackTrace();

}

jwin.setVisible(false);

jwin.dispose();

}

}

Prashant_SDNa at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...
# 9

[nobr]hi!

import java.awt.Color;

import java.awt.Insets;

import javax.swing.JLabel;

import javax.swing.JWindow;

import javax.swing.border.LineBorder;

/**

* @author: aniruddha<br>

* @date: Nov 22, 2006, 11:43:43 AM<br>

* @source: TestJwindow.java<br>

* @project: HelpForum<br>

*/

/**

* @author aniruddha

*

*/

public class TestJwindow

{

public static void main(String[] args)

{

JWindow loadWindow = new JWindow();

JLabel lblLoad = new JLabel(" Loading..........");

if(loadWindow.isVisible())

{

loadWindow.dispose();

}

else

{

loadWindow.getContentPane().setBackground(Color.gray);

lblLoad.setBorder(new LineBorder(Color.red, 3));

lblLoad.setForeground(Color.white);

loadWindow.add(lblLoad);

loadWindow.setSize(150, 50);

loadWindow.setLocationRelativeTo(null);

loadWindow.setVisible(true);

}

}

}

works fine with me..

:)[/nobr]

Aniruddha-Herea at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...
# 10
this code is working fine if runing seperatly.......but i need to call the class from another class....in that time it is not working
madhan.ponnusamya at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...
# 11

import javax.swing.JLabel;

import javax.swing.JWindow;

import javax.swing.SwingConstants;

public class SimpleSplashScreen {

SimpleSplashScreen()

{

JWindow jwin = new JWindow();

jwin.getContentPane()

.add(

new JLabel("Loading Swing utilities...",

SwingConstants.CENTER));

jwin.setBounds(200, 200, 200, 100);

jwin.setVisible(true);

try {

Thread.sleep(10000);

} catch (InterruptedException e) {

e.printStackTrace();

}

jwin.setVisible(false);

jwin.dispose();

}

}

call this from diffrent class, it will work

Prashant_SDNa at 2007-7-15 5:45:19 > top of Java-index,Desktop,Core GUI APIs...