Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java.awt.GridLayout  RSS feed

 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"java.awt.GridLayout 1.0
Parameters: rows The number of rows in the grid
columns The number of columns in the grid
hgap The horizontal gap to use in pixels (negative values
force an overlap)
vgap The vertical gap to use in pixels (negative values
force an overlap)
"

Core Java Vol 1 (8th Edition), Pg. 377

Do you have an example of where hgap and vgap might be applied?
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, but you can create an example to test it out.
 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:No, but you can create an example to test it out.


Yes, I tried, but I could see no difference between just using the first two parameters, and, using the latter two parameters. For example this is from a demo calculator application (Chapter 9 of Core Java Vol I (8th Ed.):



NOTE (to admin): It would be nice if the blogger (for example myself) has the functionality to enhance text within the code... code tags as say bold, italic, underlined, etc.
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post your SSCCE demonstrating the problem.
 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:Post your SSCCE demonstrating the problem.


Well I'm still working on that, since I am not sure how the latter two parameters would affect the display.
 
Rob Camick
Ranch Hand
Posts: 2787
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All you do is create a simple program. Run it once with value of 0, and a second time with value of 10. Presumably you should see a gap of 0 pixels in the first case and a gap of 10 pixels in the second case. You can also change the background color of the panel to some color other than the default to make it easier to see the gap.
 
Jon Camilleri
Ranch Hand
Posts: 664
Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:All you do is create a simple program. Run it once with value of 0, and a second time with value of 10. Presumably you should see a gap of 0 pixels in the first case and a gap of 10 pixels in the second case. You can also change the background color of the panel to some color other than the default to make it easier to see the gap.


Yes sorry you were right, I attached before and after screenshots, when updating:



before.JPG
[Thumbnail for before.JPG]
Scr - No gaps
after.JPG
[Thumbnail for after.JPG]
Scr vertical gap=10; horizontal gap=10
after-2.JPG
[Thumbnail for after-2.JPG]
Scr horizontal gap=5; vertical gap=10
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jon Camilleri wrote: . . . NOTE (to admin): It would be nice if the blogger (for example myself) has the functionality to enhance text within the code... code tags as say bold, italic, underlined, etc.
The idea of code in the code tags is that you can copy and paste it (I usually have to click "view plain" first), and execute it immediately. If there were colour or bold tags, they would cause compiling errors. It is possible to add comments saying // this line throws the Exception or say in the text "line 97 is where the problem appears to be."
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!