aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes [UB1.1.2] Swing Threading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "[UB1.1.2] Swing Threading" Watch "[UB1.1.2] Swing Threading" New topic
Author

[UB1.1.2] Swing Threading

Harry Pearson
Greenhorn

Joined: Nov 14, 2006
Posts: 3
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
Kalle Tjarnlund
Greenhorn

Joined: Aug 20, 2006
Posts: 10
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


SCJP 1.5<br />SCJD URLyBird (in progress)
Harry Pearson
Greenhorn

Joined: Nov 14, 2006
Posts: 3
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.
Mike Ngo
Ranch Hand

Joined: Oct 16, 2006
Posts: 89

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.
Chulwoo Choi
Ranch Hand

Joined: Apr 11, 2005
Posts: 65
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
    Sam Codean
    Ranch Hand

    Joined: Feb 26, 2006
    Posts: 194
    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.


    -Sam Codean<br />SCJP 1.4 (98%)<br />SCJD 5.0 (87.5%)
    Mihai Radulescu
    Ranch Hand

    Joined: Sep 18, 2003
    Posts: 916

    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.


    SCJP, SCJD, SCWCD, OCPJBCD
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: [UB1.1.2] Swing Threading