Search code examples
javajavafxeclipse-rcpe4efxclipse

JavaFx Button adds ellipsis when rendered on a E4 ToolControl


I've an E4 application which has a ToolControl, the class that handles the tool control creates a JavaFX button, for some reason the button adds ellipsis and I've no clue why.

Fx Button ellipsis

Here is the link to the sample application

https://github.com/SDSethia/ColoredButton.git


Solution

  • The button needs a layout (I wrapped mine in an HBox) for it to render correctly. Here is the modified code

        final FXCanvas canvas = new FXCanvas(parent, SWT.NONE);
        button = new Button();
        button.setText("FxButton (1)");
        button.setStyle("-fx-background-color: #186dee; -fx-text-fill: white;");
    
        final HBox box = new HBox();
        box.getChildren().add(button);
    
        final Scene scene = new Scene(box);
        canvas.setScene(scene);
    

    This solved the issue.