Java Code Examples for javafx.scene.control.Button.setContentDisplay()

The following are Jave code examples for showing how to use setContentDisplay() of the javafx.scene.control.Button class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: NoMoreOversleeps   File: MainDialog.java   Source Code and License Vote up 6 votes
private void addIntegrationButtonsToVbox(Integration integration, VBox vbox)
{
	for (String buttonKey : integration.getActions().keySet())
	{
		System.out.println("*" + buttonKey);
		final Action clickableButton = integration.getActions().get(buttonKey);
		if (clickableButton.isHiddenFromFrontend())
		{
			continue;
		}
		final Button jfxButton = new Button(clickableButton.getName());
		jfxButton.setPadding(new Insets(2, 4, 2, 4));
		jfxButton.setMinWidth(256);
		jfxButton.setMaxWidth(256);
		jfxButton.setAlignment(Pos.BASELINE_LEFT);
		jfxButton.setContentDisplay(ContentDisplay.RIGHT);
		jfxButton.setTooltip(new Tooltip(buttonKey + "\n" + clickableButton.getDescription())); // I tried it, but it looks a bit janky
		jfxButton.setOnAction(new EventHandler<ActionEvent>()
		{
			@Override
			public void handle(ActionEvent arg0)
			{
				try
				{
					triggerEvent("<" + clickableButton.getName() + "> from frontend", null);
					clickableButton.onAction(null);
				}
				catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		});
		vbox.getChildren().add(jfxButton);
	}
}
 
Example 2
Project: marathonv5   File: GraphicButton.java   Source Code and License Vote up 5 votes
public GraphicButton() {
    super(400,100);
    ImageView imageView = new ImageView(ICON_48);
    Button button = new Button("button", imageView);
    button.setContentDisplay(ContentDisplay.LEFT);
    getChildren().add(button);
}
 
Example 3
Project: marathonv5   File: GraphicButton.java   Source Code and License Vote up 5 votes
public GraphicButton() {
    super(400,100);
    ImageView imageView = new ImageView(ICON_48);
    Button button = new Button("button", imageView);
    button.setContentDisplay(ContentDisplay.LEFT);
    getChildren().add(button);
}