4673_j
4673_j

Reputation: 497

Using FontAwesomeFX, how to have two icons for one button?

In my JavaFX program I am using FontAwesomeFX to add icons to buttons, labels, etc.

The way how I style this is through the .fxml file:

    <Button fx:id="btnGoToWeb"
            onAction="#btnGoToWeb">
        <tooltip>
            <Tooltip text="Go to Web"/>
        </tooltip>
        <graphic>
            <FontAwesomeIconView glyphName="GLOBE" size="1.6em"/>
        </graphic>
    </Button>

Producing this button:

Button with 1 icon

I would like to know how I can add 2 icons to one button. I would like to have something like shown below (please note the image is modified to illustrate the desired output):

enter image description here

Upvotes: 2

Views: 988

Answers (1)

SedJ601
SedJ601

Reputation: 13858

Per @Slaw comment.

<Button mnemonicParsing="false" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1">
   <graphic>
      <HBox alignment="CENTER" spacing="5.0">
         <children>
            <FontAwesomeIconView />
            <FontAwesomeIconView />
         </children>
      </HBox>
   </graphic>
   <tooltip>
      <Tooltip text="Go to Web" />
   </tooltip>
</Button>

enter image description here

Upvotes: 1

Related Questions