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
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);
}
}
:)
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();
}
}
[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]
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