This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Book GUI - URLyBird Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Book GUI - URLyBird" Watch "Book GUI - URLyBird" New topic
Author

Book GUI - URLyBird

Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

Hi Rancherss
What do you have done about book GUI ? Could you ranchers give me some sugestions ?
I've thought in put one button with label "Book" below room list. The user must select one record in the jtable and click in this button. So, system will open another modal GUI where user must type customer onwer number.
Someone did diferent ? or have another approach ?
Regards.


Fernando Franzini - Java Blog
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
I have a "Reserve Room" button, and the owner text field are in one JPanel with a TitledBorder. I have another JPanel with a TitledBorder for my Search function. And, yes, the user must select one record in the table by clicking on it. I display an error label if that doesn't happen.


SCJP, SCJD
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

Hi Anne

Did you put jtextfield for onwer number int the same GUI wich is jTable....at botton ?
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
Yes, it's all in the main GUI, and the JPanels are at the top. Not quite sure what your actual question was. I hope I answered it, though!
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

Hi Anne
Let me see if I understood correctly:
In your jtable gui, you have the first jpanel, with titledborder showing "Seach Stuff". Inside it, you put finders widget.
Below this, you have your JTable with scroolpane.
Below jtable, you have another jpanel with titledborder showing "Book stuff" whith one input to type owner number and button to call book operation.

Regard.
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
Without drawing a picture, this is a bit difficult! The two panels are at the top. I have combo boxes for Name and Location and Search button in Search Panel. Right next door is Reserve Panel with CSR ID text input and Reserve button. The table is below the panels, and I have an Exit button on the bottom right. I do have a small menu at the very top, also. Did I answer you this time?
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

Hi Anne..you did and thanks for help.
But....I feel that your "Reserve Panel" maybe.....could be below Jtable....not next to.
I dont know but, following user's workflow....first he should select one line that indicating what record and after put CSR and click in the reserve button.
Why did you do in this way ?
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
I tried following that workflow thing, too. That's why the Exit button is where it's at. I agree that the Search/Select/Reserve flow is a little bit back and forth/up and down but it looks more organized the way I have it, IMO.
Bob Wheeler
Ranch Hand

Joined: Apr 24, 2009
Posts: 317
Hi,

my GUI is more or less similar to Fernando one. I have a borderlayout with three parts, NORTH, CENTER and SOUTH.
In the north part I have my search panel including two textfields and next to it a search button, of course on the right side. So nothing else there. I try to keep similar things together.
In the center part I have my jtable and in the south part I have my book button (If new function will be added like delete or update I can put them together with the book button.)
If I want to book a room, I have to select a row. If the selected room is bookable my book button is enabled (like my book menu item). After pressing the book button a modal jdialog comes up asking for the customer id. Again, if the update functionality is implemented I would bring a JDialog (or similar) up.
I tried to keep it very easy. Nothing special. I guess the user just want to search something by typing words not reading some manual.
Last, to exit my application, I have a menu with File (->Exit), Edit(->Book, -> Search) and Help (->Help, ->About) like every application.

cheers
Bob


SCJP 6 - SCJD - SCWCD 5 - SCBCD 5
JavaEnterpriseEditionFaq - TomcatFaq
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

Hi Bob
Thanks for the tips
And what did you do when user click in "about" menu ?
Bob Wheeler
Ranch Hand

Joined: Apr 24, 2009
Posts: 317
Fernando Franzini wrote:Hi Bob
Thanks for the tips
And what did you do when user click in "about" menu ?

Well, you got me
I didn't implement it right now. I sort of feel (you know stomach feeling) that an application needs an about menu item. If I leave it there, a window would pop up with information about the application (version number, year etc.) But maybe that is too much and against the KISS principle. On the other side nearly every application has this menu item and it wouldn't be that much work. So still open for discussion in my brain.

cheers
Bob
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

you know stomach feeling
was good !!! lollllllllll
I've thought the same about it.....
KISS principle ? I never heard about...Would you mind to explain ?
Bob Wheeler
Ranch Hand

Joined: Apr 24, 2009
Posts: 317
Fernando Franzini wrote:I've thought the same about it.....
KISS principle ? I never heard about...Would you mind to explain ?

KISS = Keep it simple stupid.
I think that is self explaining

cheers
Bob
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

lollllll
Yeap ...the user really need it !
Regards.
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
I used the same idea that Bob mentioned for the About menu item. It was originally going to be online help, but I decided to do the plain text version. I didn't want File to be up there by its lonely self, so I looked at Microsoft Word's About menu. It's got the version, my name and the year.
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

Using this thread..What do you ranchers have done about tool tip text ?
I've spending my brain on it and I found 2 possibilities:
1. Use setToolTipText(String) metod for all widgets.
2. Put some bar at GUI botton and when user pass mouse over widget, the system show some tip text inside this bar.
Any other ideias or sugestion ?
Regards.
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
Fernando,
I use setTooltipText for my widgets.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5139
    
  12

Anne Crace wrote:I use setTooltipText for my widgets.

That's what i did too, just keep it easy and simple (and nothing is easier than that, beside not using tool-tips of course )

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2242
    
    7

Hello there, my book GUI looks like this: when a record is clicked in the JTable, the book button at the bottom of my main panel enables. Once book button clicks, a modal dialog pops up letting users enter the customer id.

From some post don't really whose gui it was, if you are trying to repaint the jpanel with say the book panel ... I personally think it will be much complicated for SCJD. A modal dialog popup would just do fine. But if you managed to do the repaint dynamically for book then do the same thing for search and whatever other functions/buttons you have to make the whole gui consistent.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

Goodd !!!
What do you guys set in main GUI tittle ?
I've thought to set "SCJD Assignment - URLyBird Version x.y.z".
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
I just use "URLyBird".
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5139
    
  12

Fernando Franzini wrote:What do you guys set in main GUI tittle ?

I used "URLyBird x.y.z Client Application" and "URLyBird x.y.z Server Application". Don't spend to much time thinking about this one ;)

Kind regards,
Roel
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
Don't spend to much time thinking about this one ;)

I agree!!
Fernando Franzini
Ranch Hand

Joined: Jan 09, 2009
Posts: 486
    
    2

I won't !!
Regards.
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2242
    
    7

I just use "URLyBird Local" and "URLyBird Remote" for stand-alone and network respectively. No title for server because no GUI.
Christian Kindler
Greenhorn

Joined: Apr 16, 2009
Posts: 18
K. Tsang wrote:No title for server because no GUI.


I agree with you that for a server application a GUI might be a ad idea. But:

  • you are not allowed to use command line arguments other than the single mode flag
  • you are not allowed to use command line property specifications
  • all configuration must be done via a GUI
  • no manual editing of any files


  • So how do you specify the port and the location of the database file when running in server mode?
    K. Tsang
    Bartender

    Joined: Sep 13, 2007
    Posts: 2242
        
        7

    Haha I have a "setup" window title for both my client and server. Something like "Server Setup", "Local Client Setup"...
    Fernando Franzini
    Ranch Hand

    Joined: Jan 09, 2009
    Posts: 486
        
        2

    If I want to book a room, I have to select a row. If the selected room is bookable my book button is enabled (like my book menu item). After pressing the book button a modal jdialog comes up asking for the customer id. Again, if the update functionality is implemented I would bring a JDialog (or similar) up

    Hi Bob Wheeler .
    Would you mind to answer some questions ?
    1. Which jtable event did you use to enable book button ?
    2. About your jdialog...did you put jmenu options inside it or just textfield and buttons to user type owner number ?
    Regards
    Roel De Nijs
    Bartender

    Joined: Jul 19, 2004
    Posts: 5139
        
      12

    Hi Fernando,

    I'm not Bob Wheeler , but I can tell you how I did both things.

    To make my book-button enable/disable depending on the selected room in the JTable, I used following code:


    My room detail dialog contained only text fields and 2 radio buttons (for smoke property). Most of these text fields and radio buttons were disabled when user wanted to book room, because only the customer id matters in this case.

    Kind regards,
    Roel
    Bob Wheeler
    Ranch Hand

    Joined: Apr 24, 2009
    Posts: 317
    Hi Fernando,

    sorry for the late reply.

    Fernando Franzini wrote:
    1. Which jtable event did you use to enable book button ?

    Like Roes said, I used a ListSelectionListener. There I checked if the owner field is empty (disable book button/menu item) or not (enable book button/menu item).

    Fernando Franzini wrote:
    2. About your jdialog...did you put jmenu options inside it or just textfield and buttons to user type owner number ?
    Regards

    I don't use menu items there. I have some labels and textfields about the room properties (name , location, etc.). In a separate line I ask for the customer ID in bold and bigger font.
    I could reuse with small changes this dialog for the create or delete operations.

    cheers
    Bob
    Fernando Franzini
    Ranch Hand

    Joined: Jan 09, 2009
    Posts: 486
        
        2

    Thanks Roel and Bob
    Fernando Franzini
    Ranch Hand

    Joined: Jan 09, 2009
    Posts: 486
        
        2

    Hi folks

    Continuing this thread....another questions (Bob, Roel and anoother ranchers..... )
    Did you update the jtable after book room ? I mean...the user need to see that room in the grid have changed !!!....the customer id must appear there !
    Wich approach did you guys used or sugest ?
    Regard.
    Anne Crace
    Ranch Hand

    Joined: Aug 29, 2005
    Posts: 223
    Hi Fernando,
    I overrode AbstractTableModel for my custom table model. You need to override the method for starters. I hardcoded the column index because you are only required to write to one field for this version (at least as far as the GUI goes. I also called with the same row for first and last .
    Fernando Franzini
    Ranch Hand

    Joined: Jan 09, 2009
    Posts: 486
        
        2

    Hi Anne

    Yahhh !! I got...but I'm in another Jdialog reference...I dont have acess for the another BookGUI variables...I'll see what I do.....
    Thanks for sugestions
    Regard.
    Roel De Nijs
    Bartender

    Joined: Jul 19, 2004
    Posts: 5139
        
      12

    Hi Fernando,

    Don't know if you have Andrew's SCJD book, but I followed a similar approach as used in the book: when a room is booked, I search again for the records (reusing the criteria the user entered before making the booking).


  • it is easy and simple
  • you don't need extra code (or implement the setValue-method like Anne suggested), because finding rooms is a functionality you already have
  • you have an up-to-date version of all rooms in the JTable (and not just the room that was booked)



  • 2 server requests (1 for booking and 1 for finding rooms again)
  • more network traffic


  • For me the advantages beat the disadvantages, so I followed that approach and I think the accessor liked it

    Kind regards,
    Roel
    Fernando Franzini
    Ranch Hand

    Joined: Jan 09, 2009
    Posts: 486
        
        2

    Hi Roel

    Thanks again...your explanations are always clear
    My question is "how do it"
    Cause my ListWindow open an jdialog (where user type customer id and room is updated)...and how this jdialog will update jtable in another Jframe ? invoke 'call back' method passing 'this' as reference ?
    How did you do ?...or do you have another sugestions ?
    Regard.
    Roel De Nijs
    Bartender

    Joined: Jul 19, 2004
    Posts: 5139
        
      12

    Hi Fernando,

    This is how it works (in english/pseudo-code of course). In my main window I have a method that has the following
  • get selected room from table (table model)
  • open the room details dialog with the selected room (user can enter here the customer id, only valid customer id is allowed and user can cancel or confirm booking)
  • if user confirmed the dialog pass all necessary information to the book-method of my controller
  • finally search criteria are passed to find-method of my controller to search again all rooms. this find method is returning an instance of my custom tabler model, which is used to refresh my jtable


  • To summarize: all this happens in my main window, so I always have access to jtable. And my room details dialog has a method which will return the room-object with the values entered by the user.

    Hope you got it!

    Kind regards,
    Roel
    Fernando Franzini
    Ranch Hand

    Joined: Jan 09, 2009
    Posts: 486
        
        2

    Thanks Roel
    Already implemented !!
    Regard
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Book GUI - URLyBird
     
    Similar Threads
    Question about Server GUI
    GUI design
    NX: UrlyBird reserve requirement question
    About the suncertify.properties file
    NX: Using SwingUtilties.InvokeAndWait method in GUI