File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes User Interface Modelling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "User Interface Modelling" Watch "User Interface Modelling" New topic
Author

User Interface Modelling

Gurpreet Saini
Ranch Hand

Joined: Jun 09, 2002
Posts: 295
Hi reader,
I wanted to know is it OK to create Menu's and Buttons for the same purpose of searching records and similarly for button also ?.
Thank you,
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Gurpreet,
If I understand your question right, you are asking if it is OK to have a Menu item and a Button do the same thing. If that is your question, I did exactly that as well as create accelerators. I think that it's always good to give the user plenty of input options since some are more comfortable with a keyboard than a mouse.
Hope this helps,
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Gurpreet Saini
Ranch Hand

Joined: Jun 09, 2002
Posts: 295
Hi morris,
yes, you understand my question. If you could please give me some hint about deploying accelators (I suppose they are short cuts for keyboard ) in menus. It would be nice of you. On other hand you told me to use buttons. can I ask you how did you used in your application, I mean to say how did it apperared in your GUI. One thing more morris I had used null layout in my GUI, will this work. Further I had only used JTable , two buttons (Flight reservation and exit) and menus. Tell me if I am wrong in any area.
Thank you,
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
If you could please give me some hint about deploying accelators (I suppose they are short cuts for keyboard ) in menus.

Look up javadocs for setAccelerator() and setMnemonic().

I had used null layout in my GUI, will this work.

That will work, but it will cost you a lot of GUI points. The common practice is to use layout managers so that your app frame is resizable and the controls are presented as expected on all platforms.
Eugene.
[ August 03, 2002: Message edited by: Eugene Kononov ]
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Ditto what Eugene said. You should use layout managers so that if the frame is resized the components will grow or shrink accordingly. As for using buttons, that's your choice. My JTable was set up for single row selection and was uneditable. I had a booking panel which followed the selected row and the user entered the number of seats in a text box (whose DocumentModel prevented an incorrect input such as more seats than were available or non integral characters) and a "Book Flight" button. But there are countless ways that flight booking can be accomplished. So just do it in a manner that you feel most non-tech-savvy users will be able to understand.
Hope this helps,
Michael Morris
Gurpreet Saini
Ranch Hand

Joined: Jun 09, 2002
Posts: 295
Hi readers,
Yes, I will do as you suggest. But which layout do you suggest that I should use ?. Secondly, morris you told me that your Booking was encapsulated with row selection. But I would be using another window for booking tickets. That is client would be having all the list of destinations and as user select's any destination it will get its respected Flight no.s designated for that route and thus with the no. of passengers entered by user will get detected from actual DataInfo object.
Thirdly, I am using WindowHandler class which will keep track of the instances of windows active. That it would not allow the user to keep on activating windows for fun. As this would keep on eating machine resources. I had designed excepton for this stating "You had already activated window, you may open it again but after closing this window". Means after closing the respective window then only user can activate it. What is you sugession about this. Shall I keep it or abort it ?.
Thank you,
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Gurpreet,
The layout manager (or managers) you use depends on the position of your components. You will usually need a combination of layout managers or use the much feared GridBagLayout which gives total control over your Frame but is very complicated. I used combinations of Border, Grid and Flow. Remeber that you can nest JPanels inside of other JPanels, each having their particular layout.
I'm not suggesting that you accomplish booking the same way I did or that my solution is superior to all others because it is not. The main consideration is can all users easily understand how to book a flight. How is your input accomplished? Do you pop up a dialog when the user selects a row? If you'll give me a little more info on your booking procedure maybe I can give you an opinion.
Hope this helps,
Michael Morris
Gurpreet Saini
Ranch Hand

Joined: Jun 09, 2002
Posts: 295
Hi Morris,
I would do exactly what you had earlier suggested, because I feel your design is much more good. This is for the reason that it reduces the coding overload and secondly, the user can simply understand the procedure for booking seats. In my design after reading your post I changed my booking UI design. The user simply first had to select a row then it will click on a button called "FLIGHT RESERVATIONS" then a Window will appear with a textfield asking for number for passengers to book. once the user presses "BOOK SEATS" button in that window it will further proceed. Is this OK. Does it require any enhancement then let me know.
Secondly, there was another thing I wanted to ask I had posted this thing in my earlier posts but no one had replied. I am implementing a class called WindowHandler which will keep track of all the active instances. If any window is active and user again tries to open the same window then exception would be thrown stating "that your so and so window is active, you may again open it but after closing it". This I had developed for the reason that it will give no chance to the user to play with program. As this would result in unneccessary wastage of system resources. Because when we instantiate a class it consumes lot of system memory. What you have to say over this ?.
Thank you,
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937

If any window is active and user again tries to open the same window then exception would be thrown stating "that your so and so window is active, you may again open it but after closing it".

This is very awkward. Why not instead make the window modal or disable the "open window" functionality if the window is already open?
Eugene.
Gurpreet Saini
Ranch Hand

Joined: Jun 09, 2002
Posts: 295
Hi Kononov,
Yes, you are right it seems to be awkward. But I want to give user full independence to do anything with program but of course in limits. I shall try your other option that is making window modal. Let me do the coding then I will tell you.
Thank you friend,
 
GeeCON Prague 2014
 
subject: User Interface Modelling