Jonathan
Jonathan

Reputation: 93

How to create your own button and Use it with Scene Builder for javafx

Hello everyone I've been curious to know is it possible to create your own button, as in for example in Photoshop. Then use this "custom button" in place of the default ones in scene builder. Or is there an import function as to where I can use my custom button? Just started using Scene builder so I am not to familiar around what it can and cant do. Thank you!

Being specific I want to mold an imagine as a certain shape. Then use this molded image as a button. So I do not want to use the tradition button shape but instead a custom shape. Im not sure if this is even possible but any tips will be grateful!

Upvotes: 1

Views: 4748

Answers (1)

jewelsea
jewelsea

Reputation: 159341

  1. You can style a button using css.
  2. If such styling is insufficient for your purposes, you can create a custom button skin.
  3. If you need additional properties for your button, then you can subclass Button or ButtonBase (this is how JavaFX internally implements other button-like things with additional properties such as CheckBoxes, ToggleButtons, RadioButtons, etc).

Either way Scene Builder doesn't really care, there is nothing really special to do in Scene Builder and either option works with Scene Builder. You just use Scene Builder to place "normal" buttons in your application's FXML files and set the appropriate css style-class for the button to use your custom css and, if necessary, custom skin and the button will be styled accordingly.

Upvotes: 2

Related Questions