This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Formating of Buttons in a Border Pane

 
Roger Wells
Ranch Hand
Posts: 51
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to learn how to create a ui

I am having problems understanding how to format this screen.

1. How do I center the top heading and have it always be centered within the scene when the user changes the size?
2. How do I get the 3 bottom buttons to have one on the left, one in the center, and one on the right and stay that way when the user changes the scene size?


 
Roger Wells
Ranch Hand
Posts: 51
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also want to add a grid pane to the left and a textarea to the right and replace the buttons.
Both grid and text should be scrolable

How do you edit a post once it has been posted?
 
Knute Snortum
Sheriff
Posts: 3324
84
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I center the top heading and have it always be centered within the scene when the user changes the size?

Set the top, left, and right anchors to 0, then set the Label's alignment to TOP_CENTER.
 
Knute Snortum
Sheriff
Posts: 3324
84
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I get the 3 bottom buttons to have one on the left, one in the center, and one on the right and stay that way when the user changes the scene size? 

Hmm... try a ButtonBar.
 
Knute Snortum
Sheriff
Posts: 3324
84
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you edit a post once it has been posted?

There's usually a small window in which you can edit a post before someone replies, but for the most part, you should post again to the thread -- not the entire post, but just the correction.  This is so that the replies don't become confusing if they refer to a part of the post that is now different.
 
Knute Snortum
Sheriff
Posts: 3324
84
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also want to add a grid pane to the left and a textarea to the right and replace the buttons.
Both grid and text should be scrolable 

Are you having problems with that?  What have you tried and what happened?  Do you have a specific question about this?
 
John Damien Smith
Ranch Hand
Posts: 321
19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AnchorPanes aren't good for modeling resizable UIs.  You are probably better off using a different container type.
You can better understand JavaFX container types and layout tips by reading the Oracle layout documentation:
  http://docs.oracle.com/javase/8/javafx/layout-tutorial/
 
John Damien Smith
Ranch Hand
Posts: 321
19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also try playing around with SceneBuilder and it's preview option to help understand how layouts work in JavaFX.
 
Knute Snortum
Sheriff
Posts: 3324
84
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SceneBuilder can be downloaded here.  It is mostly for using FXML with JavaFX.

Note: I haven't had much trouble using Anchor Panes for resizable GUIs.  It takes some fooling around but it works well after that.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!