Link to home
Start Free TrialLog in
Avatar of ninedoors19
ninedoors19Flag for Canada

asked on

Using SwingWorker example

I am new to java and swing and I'm having a hard time working with swingworker.  My goal is to have a interface that allows the user to click a button which will download data from a php page on my web server.  It will give a json string as a response.  This program will update the embedded database in the program syncing the 2 databases.  This si what I thought the update class should do:

1) layout the GUI for the user - it will have an download button (have this done)
2) have a progress bar so the user knows it is moving along (not done)
3) have an actionlistener for the download button (done)
4) create a swingworker thread to connect to the url and get the json string (not done)
5) parse the json into a java object(not done)
6) update the database tables (around 10 in total), pass back progress to progress bar after each update(I can do this)
7) have a popup notify the user when the background update is done

I am using Gson as my json parser.

I will attach the class file I have right now.  I don't need the code to be tested but just a general idea of the best way to go about it.  I am just having a hard time wrapping my head around the process of it all.  For the database stuff it will be enough to say "update database here".  Really just need how to setup the swingworker thread.

Thanks Nick Update.java
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ninedoors19

ASKER

Was looking for a more in depth answer.
:)