Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can I align a setprompText in JavaFX in the center?

925633Mar 22 2012 — edited Mar 22 2012
I'm learning JavaFX and I have a small cosmetic issue. All of my content is centered, but I can't figure out how to center the prompttext (The text that is pre-filled in before you actually enter text in the textbox).

TextField username = new TextField();
username.setPromptText("Username");
username.setAlignment(Pos.CENTER); //This aligns only the text typed in. Not the promptTxt

In the above code, "Username" is not centered, but the text I type in is.
This post has been answered by jsmith on Mar 22 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 19 2012
Added on Mar 22 2012
5 comments
1,019 views