prs
prs

Reputation: 133

Javafx Image and Text align on Button

I created a javafx button and added image and text.I want text place to top and image place to middle of the javafx button.Is it possible with javafx and how can I do it?

Upvotes: 4

Views: 9844

Answers (2)

Eddie Fann
Eddie Fann

Reputation: 81

You can also use CSS for the button. The below example will display the text at the top with the image below (which seems counter-intuitive) for all buttons:

.button
{
  -fx-content-display: bottom;
}

Upvotes: 2

agonist_
agonist_

Reputation: 5032

You have to use button.setContentDisplay(ContentDisplay.TOP);

ContentDisplay

Upvotes: 10

Related Questions