Results 1 to 5 of 5
  1. #1
    cool is offline Member
    Join Date
    Nov 2010
    Posts
    20
    Rep Power
    0

    Default Problem in action listener

    Hi,
    I am creating a backup application, in which after selecting files, when user clicks "Start Backup" button backup starts at back end, to check if the backup is completed i am created a file on completion of backup, so the application keeps checking every 2 sec if the file is created, and if its created it'll show a dialogue that backup completed...

    Now in meanwhile i have a status file which shows status of backup, to show that status i have created a JFrame which will read the file nad display its contents as labels,

    But Problem is until my backup completes, my application doesnt do anything, means it keeps checking status file only...

    So can anybody suggest what should i do to synchronize this process???

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I would make sure that you're doing the backup in a background thread such as a SwingWorker, and then add a PropertyChangeListener to the SwingWorker, one that monitor's your backup progress, and fire the listener whenever important changes in state occur (say each 1 or 10% completion and of course when it is done).

  3. #3
    cool is offline Member
    Join Date
    Nov 2010
    Posts
    20
    Rep Power
    0

    Default

    Thanks Fubarable,
    Actually i am not much familiar with swings. Thanks for your suggestion, i'll go through it and try implementing in my code.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default

    Recommended reading:
    Lesson: Concurrency in Swing (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    And it's Swing, not swings or Swings.

    db

  5. #5
    cool is offline Member
    Join Date
    Nov 2010
    Posts
    20
    Rep Power
    0

    Default

    Thanks Fubarable,
    Its working fine with swing worker class.... :)

    Thanks db, I don't why u always have problems in my post...

    Anyways thanks.

Similar Threads

  1. Simple Action/Listener Help GUI
    By aanders5 in forum New To Java
    Replies: 24
    Last Post: 10-18-2010, 06:43 PM
  2. Action Listener
    By greatmajestics in forum AWT / Swing
    Replies: 8
    Last Post: 03-25-2010, 05:39 PM
  3. Action Listener? how to use this?
    By jeffrey in forum New To Java
    Replies: 2
    Last Post: 10-12-2009, 08:51 AM
  4. action listener on jcombobox
    By chkm8 in forum New To Java
    Replies: 2
    Last Post: 02-05-2009, 10:14 AM
  5. [SOLVED] action listener and Jtextfield
    By tOpach in forum AWT / Swing
    Replies: 4
    Last Post: 12-16-2008, 01:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •