• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

[UB1.1.2] Swing Threading

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am currently starting to think about the UI part of the assignment, but have never done any Swing programming before. And I have a few questions....

What sort of techniques are people using to prevent the UI freezing while a long search is being run? Is this something that needs consideration for this assignment, or is it a little out of scope?

Also, features like sorting in the results and the ability to change servers on the fly (without restarting the app) would appear to be out of scope ("you will not receive extra credit points for work beyond the requirements...")
What sort of features have people implemented that are in this grey area?

Cheers
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
I'm also more or less a newbee at Swing so my approach was to keep it simple. For example I have no threading for my search method and I can't change the server on the fly. Even though I have not implemented any threading on the client side maybe it could be a good idea, maybe someone else will respond to your question which has done this?? Also, regarding the GUI I think you should check that you GUI looks good when the user changes the size of the window, minimizes and maximizes etc.

I have chosen to sort the results so that bookable rooms appear at the top of the list sorted on date (that is those closest to the current date appear first). The records that have a date that is in the past are put last in the list but with no sorting since i didn't want the sorting taking too much CPU time.


Regards,
Kalle
 
Harry Pearson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Kalle

I think you are right, keeping it simple is a good principle to follow.

I have given the user the option of excluding rooms that cannot be booked from the search - so i don;t have to sort anything to deliver usable results.

The K.I.S.S. principle is a good point though.

Thanks.
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


What sort of techniques are people using to prevent the UI freezing while a long search is being run? Is this something that needs consideration for this assignment, or is it a little out of scope?

Also, features like sorting in the results and the ability to change servers on the fly (without restarting the app) would appear to be out of scope ("you will not receive extra credit points for work beyond the requirements...")
What sort of features have people implemented that are in this grey area?

Cheers



I let the user to change database or server on the fly. It's usability of the UI to me. For ex, when the user brings up the configuration dialog and changes the application configuration (new database file or server), the option would be:
1) to put up a dialog and says something like "The configuration won't be in effect until the application is restarted"
2) restart the database or reconnect to the server.
I chose to do #2 because there is not much more work to be done.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My project is B&S. In my GUI, I implemented the following:

  • Sort by any field(when clicking on the corresponding table column header).
  • Highlight edited rows/De-highlight when changes are committed to DB.
  • Status bar (showing recently used functionality, last modified time, etc.).
  • Delete selected records.
  • Create a new record.
  • Refresh data table.
  • Print table (it takes just one line for this: table.print() (Java 5.0 or later)).
  • User input validation for table (JTable), input dialog, etc.
  • Search criteria for (not only name/location but) all the fields.


  • I tried to relate these functionalities to future enhancements in my design doc.

    Chulwoo
     
    Ranch Hand
    Posts: 194
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I think if you need a good start to the worry about the Iconic swing "Freeze" then do start using the JProfiler, it does help a lot. I have faced a lot of the Swing Freeze issues and i prefer to add the frame.dispose() method and explicitly release all the resources in that method.

    Somehow Swing does not clearly handle the multilevel releases so do that yourself. Do this for all of your classes that will have GUI related instances. That will help you in the long term.
     
    Ranch Hand
    Posts: 918
    IntelliJ IDE Java Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi,

    It is also not so bad if the UI froze durilg a long operation, in this you you can signal to the suer that something is gonion.
    You may show a message like -
    "this will take a while" or you can use a progress bar. I prefer the first one, is more simple.

    Regards M.
     
    Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
    We need your help - Coderanch server fundraiser
    https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    reply
      Bookmark Topic Watch Topic
    • New Topic