1

As the title says, I have a gridpane with several elements in it in JavaFX & I was wondering if I could use CSS to position this in the bottom right of the scene? I've tried using setID on my gridpane then referring to it in the CSS but it doesn't seem to work.

Eventually I want to have images in the top right and all the left of the scene and have the gridpane sit in the bottom right, however I can't even get this to position correctly.

Any help would be appreciated.

Andrew
  • 159
  • 2
  • 11
  • The intention is that CSS should be used to *style* your application, and FXML (or Java) should be used to perform the layout. Your question is not very precise anyway: you can only have one root of a scene, and that root will fill the scene irrespective of any layout settings it has. So you should be thinking about positioning your nodes within the root pane, not within the scene. There may be some cases where you can force CSS to give the layout effect you want, but it is not the intended use and would likely be difficult to maintain. At any rate, you should show what you have tried. – James_D Jan 17 '17 at 01:41

1 Answers1

0

I solved this using: -fx-alignment: bottom-right;

in my CSS

Andrew
  • 159
  • 2
  • 11
  • However, as [explained in another question](http://stackoverflow.com/questions/41007690/unable-to-center-a-grid-using-javafx), the alignment property of a `GridPane` aligns all of the grid pane's content. So it is not clear how you are now going to align other content (your images) to the top right and to the left. – James_D Jan 17 '17 at 01:57