?
Solved

How to create a responsive GUI in Java Swing?

Posted on 2004-09-15
9
Medium Priority
?
1,475 Views
Last Modified: 2011-09-20
Hi all,

I am new to JAVA Development and I am developing an application that reads a content of a folder and the XML files and parse the files and transform them into html.

Every thing seems to work fine. I use JFileChooser. and get the directory as input. I also have kept a label in to show the status. For getting th efiles in the directory I use a method. For parsin gI use another method and for transforming I use another method. All the methods are in different classes. When I click the accept button. the status bar need to change to "Processing the input" then when it is parsing the XML files it needs to show "Parsing..." and when transforming it needs to show "Transforming"... I have used the JLabels setText() options but it is not happening. the JLabel is not updating its value.

Any Idea on this...

Thanks and regards,
Arul...
:)
0
Comment
Question by:sarulprakash
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 12064792
0
 
LVL 37

Accepted Solution

by:
zzynx earned 150 total points
ID: 12064799
The purpose of SwingWorker is to implement a background thread that you can use to perform time-consuming operations
without affecting the performance of your program's GUI
0
 
LVL 6

Expert Comment

by:expertmb
ID: 12064909
the events related to ui controls are run within a single thread edt(event dispatch thread). when the accept button is clicked the, till the event completes the other gui events or repaints are held, no other events will be executed. thats the reason setting the label with different texts is not happening.

use swing worker thread as suggested by zzynx.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:sarulprakash
ID: 12065430
thank you zzynx for the information.

- Arul :)
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12065891
Thanks for accepting.

PS. For my interest: what kind of answer would you have given an A-grade?
0
 
LVL 1

Author Comment

by:sarulprakash
ID: 12072372
Hi zzynx,

If you have provided the comment like whats is wrong with my current practice, novice like me will be able to understand better.Example is what expertmb has given. I would have given A for that. Sorry if I am wrong about making this kind of decision.

Your link solved the problem for me thats for sure. and thanks a lot for that.

Arul....
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12072596
>>If you have provided the comment like whats is wrong with my current practice,
>>novice like me will be able to understand better
I see.

>>Sorry if I am wrong about making this kind of decision.
Nothing wrong with that. You decide. Just to know for myself for future comments.

>>Example is what expertmb has given.
Then I wonder why you didn't split the points.

>>Your link solved the problem for me thats for sure. and thanks a lot for that.
You're welcome.
0
 
LVL 1

Author Comment

by:sarulprakash
ID: 12075267
how do we split points. This is my first posting in this forum. : (

Arul.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 12075383
>>This is my first posting in this forum
Then browsing through the help files is a certainly a good idea ;°)

>>how do we split points
Read the item "Can I split the points" at
http://www.experts-exchange.com/Programming/Programming_Languages/Java/help.jsp
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question