Sitemap

Amicuk Programming Answers

Problem with JWindow

2015-10-11   Views:0

Advertisement

Hi all, I have a very important question.... I created a small application and when i launch it, i'd like to have a JWindow displayed on my screen only during 5 seconds.... So i run my application, my JWindow is displayed during 5 seconds and then th

Hi all,
I have a very important question....
I created a small application and when i launch it, i'd like to have a JWindow displayed on my screen only during 5 seconds.... So i run my application, my JWindow is displayed during 5 seconds and then the application "really" begins.
But how do i have to proceed to have my JWindow displayed only during 5 seconds and then close automatically???
Thanx very much for helping....

The replay answer
Advertisement
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.Timer;
public class SplashWindow
    public static void main(String[] args)
        JFrame f = new JFrame();
        showSplash(f);
        JPanel panel = new JPanel();
        panel.setBackground(Color.red);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.getContentPane().add(panel);
        f.setSize(400,300);
        f.setLocationRelativeTo(null);
    private static void showSplash(final Component c)
        JLabel label = new JLabel("hang on, it's coming...", JLabel.CENTER);
        final JWindow w = new JWindow();
        w.getContentPane().add(label);
        w.setSize(200,200);
        w.setLocationRelativeTo(null);
        w.setVisible(true);
        final Timer timer = new Timer(5000, new ActionListener()
            public void actionPerformed(ActionEvent e)
                w.dispose();
                c.setVisible(true);
        timer.setRepeats(false);
        timer.start();
}

Go to See the other 4 answers

Jpopupmenu visibility problem with JWindows

Category:DefaultRelease time:2015-10-11Views:130

Hello, BACKGROUND: I am attempting to implement a feature similar to one found in the netbeans IDE for a programming editor I am helping to write. The feature is an autocomplete/function suggestion based on the current word being typed, and an api po[More]

Two very STRANGE problems with JWindow and JTextField

Category:DefaultRelease time:-0001-11-30Views:130

I am having some trouble in the program that I am making. It is a Swing based GUI. I have a JWindow with a JPanel in it that holds JTextFields and JLabels. problem1----I can't see a caret in any of the textfields but I can still enter text. problem2-[More]

Problems with JWindow

Category:DefaultRelease time:-0001-11-30Views:130

Hello! I was trying to make a splash screen with JWindow class. But nothing but a blank JWindow is shown after the program is run. I've already searched the forum for solution to this kind of problem and I found that few had similar problems. Accordi[More]

AlwaysOnTop problem for JWindows

Category:DefaultRelease time:-0001-11-30Views:130

Hello everyone.I have the following problem I got an application that allows user to create multiple JWindows under one JFrame. The parent JFrame itself is not set to be AlwaysOnTop, neither are JWindows. This is optional. Each JWindow can be set to[More]

Problem with JWindow

Category:DefaultRelease time:2015-10-11Views:130

Hi all, I have a very important question.... I created a small application and when i launch it, i'd like to have a JWindow displayed on my screen only during 5 seconds.... So i run my application, my JWindow is displayed during 5 seconds and then th[More]

Problem with Mnemonic Alt F4 with JWindow in solaris OS urgent!......

Category:DefaultRelease time:-0001-11-30Views:130

hi all I have a problem with JWindow i created a menu where in i have all menuitems as i needed with a close MenuItem with Mnemonic ALT F4 i could not able to close the JWindow in solaris as iam not able to catch th e ALT F4 event please help guys an[More]

Multiple Threads Problem

Category:DefaultRelease time:2015-10-11Views:130

Hi, I am new to Java Threading and the current program that I am working is having problems. The program basically paints lines and dots or onto a JPanel which displays an image. There exists a thread here to suspend and resume the drawing at the use[More]

Help in jwindow

Category:DefaultRelease time:-0001-11-30Views:130

hi there i want to build an application with jwindow but i have a problem , the jwindow doesn't have a taskbar button how can i create oneI am not sure if there is no way (I am not an expert) but I would think that it might be easier to change JFrame[More]

JApplet to create Messenger like alert window

Category:DefaultRelease time:-0001-11-30Views:130

Hi, I have a JApplet which allow users to perform daily business process, mostly using the whole container, without any JFrame and JWindow. JDK used: 1.5.0_09 Now, I need to implement some sort of Collaboration system, to alert the user whenever ther[More]

Using JWindow  problem..

Category:DefaultRelease time:2015-10-11Views:130

Hi I am using JWindow for showing a splash window before the application starts. First i use a JPasswordField for Login but i unable i type in it then i use progress bar and still it is unable to get any value for update. when i use JFrame it all wor[More]

I am having a crash problem

Category:DefaultRelease time:2015-10-11Views:130

and it seems to be getting worse. Specifically, I have a G4 AGP, with 8xxRAM 1.3giggle cpu three firewire devices, Maxtor HD, buffalo HD and lacie dvd burner (multi recorder). I upgraded the internal DVD to a Samsung burner a long while ago. This pro[More]

Hot
i bought a second hand iphone 3g last week and it wont let me get my apps cause it says that i need IOS 5. on my itunes it say that the IOs 4.2.1 is current and that no update is needed. i stil tried to download fb but it wont let me cause i dont hav [More]
Hi, I would like to know what the most efficient way of moving all my old iPhone contacts and calendar etc. from my old Macbook Pro and iPhone 3G to my new MacBook Pro and iPhone 4? It doesn't seem that straight forward? Thanks, Chris.Use migration a [More]
Env:Oracle 9I Report Writer If I have a Table with the flwg data: TableA Col1   Col2  Col3   Amt 1                   10 2                   20 3                   30 4                   40How can I get the report output in the format below: ....      [More]
I just upgraded from PS elements 8 to 12 and can't find the "shut off application frame" option? Photoshop Elements 12 OSXI didn't think that was an option in PSE12. Do you mean the ability to see through the application to the desktop? It used [More]
Hi all, I am new to the Migration Workbench tool - so excuse me if I ask some silly questions. I have a MSAccess 2002 application with some tables and forms (plus macros) - When run the omwb2002.mde program (version 10.1.0.4.0) - select my mdb file, [More]
Hello Experts,   Actually I had an issue while opeing SAP Standard Query, this issue is due to some missing BI Content information then I requested Basis team to apply SAP Note, they came back to me saying that SAP Note is already applied, then immed [More]
I recently had my iPad substituted by Apple. Thru iTunes I used an old back-up to download for the new devise. The problem is that in the meantime the e-mail address used for my Apple ID no longer exists (old job) and now everything I try to do on th [More]
This problem is mostly a minor annoyance. The Mac eventually boots up. When booting up, a folder displaying a '?' is displayed. This icon is then replaced with a folder displaying what looks like Mac OS classic. The icons swap back and forth a few ti [More]
Dear All, I have a translation issue in Oracle Discoverer viewer by the name of the Month in German. If I login in the German version of the system and try to run a report with the month "MAI-10" no data is retrieved. And if I select the English [More]
I have a G4 dual mirror door. it will just power down by itself. The place where it plugs into the back of the computer is very loose and is the culprit -- what is this even called and what do I need to fix it? is it the power supply? thanks! sueWelc [More]