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
Solved

How to create a responsive GUI in Java Swing?

Posted on 2004-09-15
9
1,230 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
  • 5
  • 3
9 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 12064792
0
 
LVL 37

Accepted Solution

by:
zzynx earned 50 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

860 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