This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Here is a picture of my GUI when it first opens up:
everything is good. however, here's what happens when I resize it a bit smaller from the bottom:
the search pane components are missing and part of the book button is obscured. now when I make things even smaller everything is obscured but the table:
the JFrame uses a BorderLayout. What can I do to fix this problem? I've looked at ComponentListener to resize the window whenever someone wants to make it too small, but this seems like a hack. [ September 10, 2003: Message edited by: Ramses Tutoli ] [ September 10, 2003: Message edited by: Ramses Tutoli ]
Oh and two things. First does the Book button make a screen pop up for the user to enter the customer number? But mainly, I'd switch the Search and the JTable around. The search (combos and search button) first at the top, then the JTable underneath it, then the Book button at the bottom. Just like a person reads top to bottom, left to right (sure some go right to left, but Sun is in the US, so its US standards. ), a GUI should work the same, it is simpler and easier to handle from a user point of view. Mark
Joined: Oct 08, 2001
Or set the size of the window, and don't let the users resize the screen. That's what I did, still got 24/24 on GUI. I think it is safe to say that you got lucky, Mark. I've never seen a good quality Java apps that would not allow you to resize the frame.
Another suggestion: try putting the Location JComboBox (and JLabel) below the Name, rather than to the right. Your current setup is basically forcing the minimum width to be bigger than it needs to be. Once your window does below that minimum, that's wht creates problems. The problem with having a single JScrollPane around everything is that when you've got an outer scroll pane and one or more inner scroll pane, the outer one may kick in too soon, when you really want the inner panes (esp. the JTable's scroll pane) to handle most of the load. When you've got scrollpanes inside scrollpanes, things get more complex, and "who's in charge" depends a lot on which layout manager you're using; I find it too much of a pain to deal with. Though to be fair, that may just be because I never spent enough time working at mastering the technique; I just avoid nesting scrollpanes.
"I'm not back." - Bill Harding, Twister
Joined: Sep 05, 2003
Some good advice here. I opted to go with my plan to put a scrollpane around the frame, however. Here's how it looks now (shrunken down a bit):
here's how it looks when it's resized:
I like this solution better than preventing them from resizing at all or using ComponentListener to force a minimum height and width because i want the user to have more choice in choosing the display size he wants. If I explain my design decision in this way, I won't get docked any points if the reviewer doesn't agree with my choice, will I?
You know what, I think the new way is very pretty. I like the look of the screen, and I think the scrollbars look good if the screen is shrunk. I have seen that in many production commercial applications on the market. I don't think you'd lose points in that area. Mark
Joined: Jan 30, 2000
Yeah, it does seem decent. As long as the table's scroller kicks in before the outer scroller, all is well. Guess I was traumatized by a bad experience with this; need to experiment more.