Launching Splash Screen on the click of a button
Situation: I have an application running, and when the user clicks a button on the main menu, a new dialog opens.
Problem: This dialog takes awhile to load as it is retreiving information from the database etc ... hence I would like to launch a splash screen in one thread and the other dialog in a second thread.
Following is the Splash Screen class:
public class SplashScreen extends JWindow {
public SplashScreen(int d) {
duration = d;
this.launchSplash();
public void launchSplash() {
JPanel content = (JPanel) getContentPane();
content.setBackground(Color.white);
// Set the window's bounds, centering the window
int width = 350;
int height = 255;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int x = (screen.width - width) / 2;
int y = (screen.height - height) / 2;
setBounds(x, y, width, height);
// Build the splash screen
JLabel label = new JLabel();
label.setIcon(new ImageIcon(getClass().getResource("loading.gif")) );
label.setHorizontalAlignment(JLabel.CENTER);
content.add(label, BorderLayout.CENTER);
// Display it
this.setVisible(true);
// Wait a little while, maybe while loading resources
try {
Thread.sleep(duration);
} catch (Exception e) {
this.setVisible(false);
// System.exit(0);
// public static void main(String[] args) {
// // Throw a nice little title page up on the screen first
// SplashScreen splash = new SplashScreen(10000);
// // Normally, we'd call splash.launchSplash() and get on
// // with the program. But, since this is only a test...
// System.exit(0);
// }When I run this as a standalone, it works fine (i.e. uncomment the 'main' function). But when I try to call it from another function, it doesn't launch.
Eg: I am calling it when a button has been clicked. Code is as follows:
public void actionPerformed(ActionEvent e) {
SplashScreen sd = new SplashScreen(10000);
// Calling the dialog (that takes a long time to load) here
}Would like to know whether
[1] is it possible to launch a splash screen on the click of a button? As usually a splash screen is done at the beginning of an application before anything is loaded. In my case an application is already running, during which a splash screen needs to be launched.
[2] Would using the new splashscreen class of Java 6.0 support this?
[3] If not what is the best way to approach this problem
Appreciate any input.
Thanks,
Edited by: mnr on Feb 20, 2008 9:47 AM
Thanks Michael_Dunn, I see what you mean.
I know this is not exactly as you suggested, but when I tried the following I got a partial solution. Just wanted to know whether I am on the right track.
I wrote a small class for the thread
public class cSplashScreenThread extends Thread {
public volatile boolean finished = false;
public cSplashScreenThread(){
// override run() method in interface
public void run() {
SplashScreen sd = new SplashScreen(10000);
}This calls the SplashScreen(code encl in earlier post).
In the main application I added the following
public void actionPerformed(ActionEvent e) {
// SPLASH SCREEN
// SwingUtilities.invokeLater(new Runnable() {
// public void run() {
cSplashScreenThread sd = new cSplashScreenThread();
sd.start();
sd.finished = true;
// DIALOG
SwingUtilities.invokeLater(new Runnable() {
public void run() {
DialogToCall tempDialolog = new DialogToCall(.......);
tempDialolog .setVisible(true);
:When I run this in the application, the SplashScreen does indeed appear(earlier I wasn't able to see the splashScreen), and I notice (when I put a breakpoint at the pt where it calls the dialog), that it is going and creating the dialog etc, but the dialog never appears ...... after the splash screen closes, nothing else happens!
Could you please guide me on what best to do?
Thanks,
Edited by: mnr on Feb 21, 2008 11:19 AM
Similar Messages
-
Method to build a logo splash screen at the start of the DVD
We are attempting to place a logo splash screen on a DVD. We want the logo screen to be viewed at the beginning, when the disc is first inserted into the DVD player. We want the logo to be seen only one time before the main menu appears, and not seen again while the user navigates around the DVD. Right now our logo screen comes up at the beginning followed by the DVD’s main menu. That’s the first part of what we are trying to accomplish. However, when the “DVD Menu” button on the remote is selected, the disc goes all the way back to the logo splash screen. The viewer has to sit through the logo presentation again before moving on to the main menu. What we want is for the main menu to appear when the menu button is selected on the remote, and not the logo screen. I could not find the answer in the manual. I’m not sure what this process (or menu) with the logo is called for an index search. Commercial movies on DVD have this function. Any ideas?
PowerMac G5 Mac OS X (10.4)
Dual 800 PowerMac G4 Mac OS X (10.2.x)hey Ralph, also make very sure your connections tab's disc "menu" option is NOT set as the splash scrren.
so what you have to do to see it is:
click on your connections tab. then click on any grey area in your connections window.
then the discs connections will appear on the conection tab.
the 'title menu" connection should be visible, if that says "splash scrren (or whatever you named the splash scrren" change it to "main menu 1" and that should do it.
also, amke sure you follow the above instructions as well!
hope that helps
Mikey -
ADD Splash Screen to the SAP B1 DE Simple Installer.
can i add a Splash Screen to the SAP B1 DE Simple Installer ?
if yes how to do it.
when i deploy my addons i want the installer to accept an installation serial & install the addons only if the serial key entered in valid.
has someone done this thing before or can someone help me in doing this.
thanks in advance
Ketan JoshiHi Ketan,
You can add as many screens as you like in the simple installer. You only need to open the generated project and add you screen as the other steps already there. To desing your screen you only have to manage with .NET windows design.
Regards
Trinidad. -
How to open another Swing Screen from a click on a button
hi All
i want to open a screen on a click on a button also tell me what is the correct way does i write the internal frame and add all gul components in constructor or call some other function by creating it object in actionperformed method of button
PLZ HelpIf you want to use JInternalFrame then you have
JDesktopPane. you add all the internal frames in JDesktopPane.
while JDesktopPane is added in the main JFrame.
something like this
JFrame mainFrame=new JFrame("main Frame");
JDektopPane desktopPane=new JDesktopPane();
mainFrame.getContentPane().add(desktopPane);
JInternalFrame iFrame=new JInternalFrame();
/....your logic and iFrame settings.
desktopPane.add(iFrame);--
As per buttons, I think those buttons are the buttons added in JToolbar -
I have Pages 09 and I have created a business card using the template but can't figure out how to duplicate it to the other 9 spaces on the page. I am and sure I am going to look daft coz its only the click of a button but I can't work it out Thanks
I do the following: Hold down the command key and highlight all the items to be reproduced. Then hold down option and drag the items from the first to each subsequent card.
-
How to Validate a User on the click of a button in Oracle APEX
Hi,
How to Validate a User on the click of a button in Oracle APEX.
say for e.g: I want to allow only a specific user to go beyond after clicking on a button and restrict all the other Users. Any ideas please.
Thanks in Advance,
AfWell , the actual idea was to hide the button for specific users and show the button only for some specific users... is this possible...?
@ AndyH: yeah, what you have suggested also fits well for my requirement... Could you please let me know how can i achieve it...
Regards,
Af -
How to make an animation play on the click of a button
Hi,
I am trying to find an advanced action that allows me to PLAY an animation (swf) on the click of a button. Currently I am showing a swf but this does not allow the animation to play out.
Thanks in advance,
LiamHi Lilybiri,
Thank you for the information.
However what I mean to say is that if you insert a standard button and try to excute "Apply effect" option on button th option will be greyed out.
Also you can apply the "Apply effect" option on Slide either "On Slide Enter" or "On Slide Exit" option. As what i understand from "Apply effect" option is to create an event based animation triggers using the following steps:
Select the object that is the base for the event. For example, to apply an effect to an object after a specific slide begins, select the slide.
In the Actions panel, select Apply Effect in the On Enter or On Success drop-down lists.
In the Object Name drop-down list, select the object to which you want to apply an effect.
Thank you again for providing us the useful information.
Thanks and Regards
Loveesh -
I want to refresh my jsf page on the click of command button.
Hi all,
i m using JDEV 11.1.2.1.0
i have created one jsf page with fragment i want to refresh my whole page on the click of command button which is present in fragment page.Besause i want to refresh some field but those are present in jsf page so i cant apply partial trigger because command button property in fragment page backing bean class and those attribute which i want to refresh its property in other class.
thanks.
Rafati didnt get you from your content so i go with subject for giving your answer
refreshing some of the fields
BindingContainer bindings = getBindings();
DCIteratorBinding dciter = (DCIteratorBinding)bindings.get("xIterator");
ViewObject vo = dciter.getViewObject();
Row row = vo.getCurrentRow();
vo.executeQuery();or else drop execute operation as button to execute vo.
to refresh a page
partial trigger nice options.
to performs instant refresh
af:poll component
so if you don mine give me some scenario using hrschema i may give a liitle try to my small brain :) -
How to reset the iphone without being able to use the screen or the sleep and awake button?
how to reset the iphone without being able to use the screen or the sleep and awake button?
Hey einsoccerstar,
Thanks for the question. You can restore your iPhone in recovery mode utilizing the home button:
If you can't update or restore your iPhone, iPad, or iPod touch
http://support.apple.com/kb/ht1808
Thanks,
Matt M. -
Closing a splash screen using mouse click.
When I click the image it does not close the splash screen. What do I fix and why? Thank you.
package splash;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.JWindow;
public class SplashWindow2 extends JWindow {
public SplashWindow2 (String filename, Frame f) {
super(f);
try {
JLabel l = new JLabel(new ImageIcon(filename));
jbInit();
catch(Exception e) {
e.printStackTrace();
private void jbInit() throws Exception {
// Add the mouse listener
this.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(MouseEvent e) {
this_mousePressed(e);
getContentPane().add(l, BorderLayout.CENTER);
// Size the image
pack();
// Centre the image
Dimension screenSize =
Toolkit.getDefaultToolkit().getScreenSize();
Dimension labelSize = l.getPreferredSize();
setLocation(screenSize.width/2 - (labelSize.width/2),
screenSize.height/2 - (labelSize.height/2));
setVisible(true);
void this_mousePressed(MouseEvent e) {
System.out.println("TESTING");
setVisible(false);
dispose();
JLabel l ;
package splash;
import java.awt.*;
import javax.swing.*;
public class SplashWindow2Test
public static void main(String[] args)
JFrame frame = new JFrame("Splash Screen Test");
SplashWindow1 splashWindow = new SplashWindow1("D:\\javatest\\test\\gif\\JSplash.gif", frame);
splashWindow.show(); // Makes the window visible, brings it in front of other windows
// frame.setBounds(100, 100, 400, 400);
// frame.show();
splashWindow.requestFocus();
}try this modified code (it works) -
package splash;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.JWindow;
public class SplashWindow2 extends JWindow {
public SplashWindow2 (String filename, Frame f) {
super(f);
try {
l = new JLabel(new ImageIcon(filename));
jbInit();
catch(Exception e) {
e.printStackTrace();
private void jbInit() throws Exception {
// Add the mouse listener
this.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(MouseEvent e) {
this_mousePressed(e);
getContentPane().add(l, BorderLayout.CENTER);
// Size the image
pack();
// Centre the image
Dimension screenSize =
Toolkit.getDefaultToolkit().getScreenSize();
Dimension labelSize = l.getPreferredSize();
setLocation(screenSize.width/2 - (labelSize.width/2),
screenSize.height/2 - (labelSize.height/2));
setVisible(true);
void this_mousePressed(MouseEvent e) {
System.out.println("TESTING");
setVisible(false);
dispose();
JLabel l ;
package splash;
import java.awt.*;
import javax.swing.*;
public class SplashWindow2Test
public static void main(String[] args)
JFrame frame = new JFrame("Splash Screen Test");
SplashWindow2 splashWindow = new SplashWindow2("//D:\\javatest\\test\\gif\\JSplash.gif", frame);
splashWindow.show(); // Makes the window visible, brings it in front of other windows
// frame.setBounds(100, 100, 400, 400);
// frame.show();
splashWindow.requestFocus();
} -
Capturing the values of screen elements on click of execute button
Hello folks,
Is there a way to capture the values entered in the screen on click of the execute button?
What I want to do is, I have a selection screen where-in a user can fill the input fields (parameters and select-options). Now when the user clicks on the execute button, the values of all the screen elements (no matter if they are filled or empty) should be stored in variable, so that I can use these values again when I am calling this program from another program.
I want to do something similar to saving a variant, but this save should happen on click of Execute button and user need not require to explicitly save these values as variant.
Hope I am clear enough to put my query in front of you all.
It would be a great thing if you could help me.
Need your help.
Thanks in advance.Hi,
You need something like this
REPORT A.
TABLES: sflight.
PARAMETERS: pa_scarr TYPE sflight-carrid.
SELECT-OPTIONS so_conn FOR sflight-connid.
DATA: BEGIN OF it_selscr_values OCCURS 0.
INCLUDE STRUCTURE rsparams.
DATA END OF it_selscr_values.
START-OF-SELECTION.
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = it_selscr_values. "here you have all parameters' values from selection screen
"later in some other program you can use this table to call report A filling its selection screen with these default values like
SUBMIT a WITH SELECTION-TABLE it_selscr_values.
Regards
Marcin -
Premiere CC - Crash on splash screen - Tried the usual solutions
Premiere CC crashes immediately upon the splash screen appearing.
I've tried everything I've read here that might work:
Reinstalling
Clearing the preferences in the AppData folder
Signing out and logging back in to CC
Restarting the computer
Updating the video card
Changing language preferences
Still nothing.
Here is the error log:
System
Provider
[ Name]
Application Error
EventID
1000
[ Qualifiers]
0
Level
2
Task
100
Keywords
0x80000000000000
TimeCreated
[ SystemTime]
2014-02-05T01:17:39.000000000Z
EventRecordID
63376
Channel
Application
Computer
Studio
Security
EventData
Adobe Premiere Pro.exe
7.2.1.4
52aed7f3
amdocl64.dll
10.0.1084.4
50d22720
c0000005
0000000000062e07
1340
01cf22100e91f7b0
C:\Program Files\Adobe\Adobe Premiere Pro CC\Adobe Premiere Pro.exe
C:\Windows\system32\amdocl64.dll
4d77ae70-8e03-11e3-a368-00044b03b541Welcome to the forum, Duklyon,
The "Faulting Module Path" (amdocl64.dll) led me to this thread: http://forums.adobe.com/thread/1343944?tstart=0. The solution recommended there is to delete that dll file from C:\Windows\system32\. -
PS CS6 crashes on launch splash screen
Using windows 8.1, 64 bit HP Envy Laptop, i5 processor, 8 GB RAM....why
We can't know since you haven't bothered to provide the crash log or at least tell us at which point it is crashing. You know, those cute texts on the splash screen mean something...
Mylenium -
BDC - How to ignore skipped screens when user click on back button
Hello all,
I am working on a module pool program. From this custom transaction I am calling a standard SAP screen using BAC call transaction. I am calling this screen by skipping 2-3 screens and user can directly see the 3 screen on an event on my custom transaction.
Now my issue is whenever the user want to back, he clicks on back button then user have to back from all the screens that I skipped.
Is this any way by which if user click on back then he can directly go to my custom transaction.
Please suggest.
FYI..
I am calling IA06 - Inspection characterstics screen from my custom screen using BDC.
Thanks,
Sanket SethiHi Jovito,
I also think the same that it's not possible. Now my issue is how to get my requirement.
FYI..
To open Classification screen directly we have a function module CLFM_OBJECT_CLASSIFICATION. But if I want to open IA06
Inspection characterstics screen we don't have any FM or API to do the same.
So how will I get my requirement done. That why I use the BDC call transaction to open IA06 Insp. characterstics screen but here I am facing this Back issue.
Please advice if there is any suggestion. -
Action is no getting triggered on the click of a button in an Adobe form.
Hi All,
I have created a Form using ALD 8.1.
I have created a connction with the SAP using WSDL.
The connection is getting established and it is ahowing SOAP Binding also,
I am passing a input parameter. on the click of the button the function module should return some values.
But there is no effect on the execute button.
No action is getting triggered.
Tried establishing connection through JavaScript also.Cross post locked
Rob
Maybe you are looking for
-
Video Out in Boot Camp with Windows XP
Sorry, this is my first help request... i hope i write in a correct section. I installed Windows XP SP2 with boot camp in my Mac Book Pro. I have the third part MiniDisplay Port to HDMI adapter with audio. I use it for projector. I always use it with
-
Why can't I see my Canon MP510 printer in my System Preferences?
Hi... I've spent hours trying to find my issue in these discussions. I bought a Canon Pixma MP510 with my Macbook and it was easy to install and I began printing immediately with no problems. Recently, I kept getting a strange message that one of my
-
I have an apple tv that says that it's not connected to my computer when it is
Its home sharing
-
i am having difficulties sharing my imovie 5.0.2 file. it stops short with the note that permissions or drive space are causing the problem. i repaired the permissions and my drive has 3x the needed space and ran a osx repair of the drive. in my movi
-
ITunes is stuck on "Purchasing", but hasn't started downloading
Hi All, I'm hoping someone can help me. I'm trying to purchase The Walking Dead, Season 2, which is currently available as a Season Pass (despite the season being complete, now). I downloaded season 1, no problem, but when I try to download season 2