JavaFX ListView without horizontal scroll

When we use the standar JavaFX ListView we can have the problem that the text is wider than the available place.

As a consequence, the List View will show Horizontal scrollbars.

I thought about an easy solution of it and I made it. The solution can be found here:

The interesting part is:

* @author Diego Cirujano
public class EllipsisListCell
            extends ListCell<String> {

    private final Label label = new Label();
    private final StackPane pane;

    public EllipsisListCell() {
        pane = new StackPane();

    protected void updateItem(String item
                            , boolean empty) {
        if (empty || item == null) {
        } else {


I should spend some time to check if it would make sense to add this feature JavaFX Jira. Time to have a look to the original implementation.


2 thoughts on “JavaFX ListView without horizontal scroll

  1. Thank you very much for the example. I found that using this directly, I could no longer click on the items in the list. If you add “super.updateItem(item, empty);” in the overridden updateItem(…) method, it allows me to select items.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s