• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How do I adjust the rows in a JavaFX program?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to make it so the contents of the second row's contents and the contents of the rows after it are closer to the left. I can't figure out how to do this.



Attached is a screenshot of the current result.
Baseball-Team-Screenshot.PNG
Current Result
Current Result
 
Greenhorn
Posts: 23
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jack --

  I'm not sure this would work in your larger program, but it has worked for me.

  Instead of a grid, make your table(?) a VBox of HBoxes.   Within each of the HBoxes you can put Regions of whatever width to move the visual components left or right as desired.   I'm not sure this is an elegant solution, and it took me a bit of head-scratching and trial-and-error to make it work.   Another possibility, I suppose, would be to construct HBoxes in Grid cells and add Regions as needed in the Grid cells.

  Hope this helps!

  -- Chris
 
Bartender
Posts: 303
12
IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The solution Chris suggested is exactly what I was going to suggest. There may be situations where you need a different container but the HBox/VBox combo frequently works out fine. Sometimes I'll use a regular Pane and just do absolute placement with the Pane inside of an HBox or VBox (or another container), if you really need to get precise placement (best to use Scene Builder when doing that). So Pane + Scene Builder is another option for you if you drop GridPane, depending on your overall requirements.

GridPane to me feels like one of those components that's good to use when it happens to work the way you want, but if you want to go outside of how it normally behaves, you might want to look elsewhere. I haven't really used it (that I recall) in many years of using JFX, but maybe if I get some time I'll look into what could be done in this case without dropping it. I think there's a few things you can do here but I don't know if it'd be worth it.
 
My pie came with a little toothpic holding up this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic