1

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

Rüdiger Herrmann
  • 20,512
  • 11
  • 62
  • 79
SDS
  • 828
  • 3
  • 17
  • 35

2 Answers2

0

JavaFX shortens the label automatically, when the size of the control (a button in your case) is too small for the text. This is independent of E4. So if you increase the size of the button, the complete text will show.

I looked at your project and I am wondering why you are using the SWT renderers, although you want to use JavaFX!

If you want to use E4 + JavaFX I recommend to use the e(fx)clipse renderers. This tutorial should get you started: https://wiki.eclipse.org/Efxclipse/Tutorials/Tutorial4

christoph.keimel
  • 1,240
  • 10
  • 24
  • I tried `button.setMaxWidth(Double.MAX_VALUE);` but the result is still the same – SDS Apr 08 '15 at 13:32
  • With `button.setMaxWidth` you are only setting the maximum (!) width, not the actual width. Try `button.setPrefWidth` or `button.setMinWidth`. – christoph.keimel Apr 09 '15 at 14:20
0

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.

SDS
  • 828
  • 3
  • 17
  • 35