473,386 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Problem with SwingUtilities.invokeLater

madhoriya22
252 100+
Hi,
I have one thread, inside which I am calling a method.
Expand|Select|Wrap|Line Numbers
  1. new Thread(new Runnable() {
  2.        public void run() {                    
  3.             InvoiceVO returnedInvoiceVO = finalizeHandler.postAndPrint();
  4.             :
  5.             :
  6. }
  7.  
Inside that method I am calling another thread to show a message to user if some exception occurs.
Expand|Select|Wrap|Line Numbers
  1. protected InvoiceVO postAndPrint() {   
  2.         InvoiceVO returnedInvoiceVO = null;
  3.         try {
  4.             returnedInvoiceVO = InvoiceBL.printInvoice(invoiceVO, customerVO);
  5.         } catch (final ApplicationException aerr) {
  6.                SwingUtilities.invokeLater(new Runnable() {
  7.                 public void run() {                                 
  8.                     clientApplicationContext.getMessageMgr().showMessage(finalizeDialog, 
  9.                     aerr.getUserMessageID(), aerr.getUserMessageParameters(), 7);
  10.                     finalizeDialog.lblErrorMsg.setText("");                   
  11.                 }
  12.             });
  13.         }
  14.         return returnedInvoiceVO;
  15.     }
  16.  
Now the problem is that the message is disappearing without being visible to the user(Its like flash). The control is not staying on the message modal window(it should stay there). I am not able to find the exact problem.

Is the previous thread is completing before the current thread. If this is the case then what could be the solution.

thanks and regards,
Amit
May 25 '09 #1
1 2960
r035198x
13,262 8TB
Why not use the SwingWorker for this?
See if this article helps.
May 25 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David | last post by:
Hello I'm writting an apllication and i like to display and offscreen image. However my code doesn't seem to work. It compiles and runs properly but What i want is to associate the button of the...
1
by: Chris P. Bacon | last post by:
I'm writing a Java IRC client and I have a problem in that, whenever the program connects to an IRC server the graphics freezes. Someone said that I needed to use threads using invokeLater so I...
11
by: Jos? Cardoso | last post by:
Hi, I have developed a java application that interacts with a database. Now i've the folowing problem: - I have a list retrieved from the database(about 200 records); - for each, i do a...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
1
by: cnixuser | last post by:
Hello, I am currently attempting to implement a simple actionlistener for a button in a JFrame that was created via "drag and drop" with the Netbeans 5.0 IDE, the code that I am using to implement...
3
by: sumuka | last post by:
Hello, I'm doing a project in java using swings ,im able to create a panel and frame but i have a problem in event handling.I have added the MouseMotionListener but it's giving some error .Here i...
5
by: wajedali | last post by:
Hi I am having trouble rendering a combo box with icon near the text. Below is a simple code which demonstrates my problem. import java.awt.Component; import java.util.HashMap; import...
1
by: stevedub | last post by:
I am having some trouble configuring my array to read from a sequential file, and then calling on that to fill an array of interests. I think I have the class set up to read the file, but when I run...
10
by: Elaine121 | last post by:
Hi i've been batteling for hours and can't seem to find the problem. When my server runs and I press the connect button the gui freezes until the client gui is terminated.. only then the gui becomes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.