This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: GridLayout in GUI

 
Terry Martinson
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to improve the look of my client GUI - my initial draft was really rough. I am trying to use some of the simpler layouts like BorderLayout, FlowLayout and GridLayout rather than going more complex with GridBagLayout.
I use a GridLayout for my search criteria panel, with the prompts in the left column and a combo box in the right column.
Here are my questions:
1. My action buttons are extremely big - they fill up the whole column width. My understanding is the GridLayout ignores component sizes and does it like this on purpose. Any opinions out there on whether this type of thing will lose marks?
2. Should my prompts be left justified or right justified in the column. Kathy and Bert's Sun Certified Java Programmer and Developer book shows an example on p. 617 where the prompts are right justified. Alain Trottier's Exam Cram book shows an example on p. 229 where they are left justified.
3. I have a situation where there is a search panel GridLayout on the left of the screen with 3 rows and a book panel GridLayout on the right of the screen with 2 rows. In this case, the right side with two rows has larger ROW height than the left side, because ultimately the 2 GridLayout panels have the same height. (i.e. height of the layout panel is fixed at x, left side's row's height is 1/3x, right side row's height is 1/2 x) Opinions on whether this will lose marks?
Help appreciated. I am new to this GUI stuff and struggling a bit.
TJ
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since GridLayout divides the grids evenly according to the length and width of the largest component added, thus, it is not so good if you want to control the size.
You may consider GridBagLayout, which you can specify the size of the grid component by component.
In my implementation, I simply follow Max's approach, using BorderLayout.
The data window is added to the BorderLayout.CENTER, and the search/book buttons and fields to BorderLayout.SOUTH.
I feel it looks good, so I wont waste time to change the layout.
In fact, I prefer to spend more time to test the locking, and the server function (including Data), and write a better document becos GUI is only 40 marks, while the 3 others worth 230 marks.
 
Bharat Ruparel
Ranch Hand
Posts: 493
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Nick,
You wrote:

In fact, I prefer to spend more time to test the locking, and the server function (including Data), and write a better document becos GUI is only 40 marks, while the 3 others worth 230 marks.

I thought similarly and ended-up loosing 15 points in the GUI section since I had forgotten what the TableModel really was and that it extended the AbstractTableModel and why. Please know the risk(s) that you are taking.
Regards.
Bharat
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Yes, you are right. Trade off always has risk.
But you now just lost 15 marks.
However, when I read other post, someone scored 44 marks only in the locking part. I think, if we spend so much time in order to gain 15 marks more, why dont we use those time to further check other parts?
There is no prefect systems, we just try to make it as best as possible within limited time.
Of course, if you use 2 years to complete this assignment, it may become prefect.
Nick.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic