@Override protected void updateItem(final Tab tab, boolean empty) { super.updateItem(tab, empty); if (tab != null) { tab.getUnreadProperty() .addListener( new ChangeListener<Boolean>() { @Override public void changed( ObservableValue<? extends Boolean> observableValue, Boolean oldValue, Boolean newValue) { if (newValue) { getStyleClass().add("unread"); } else { getStyleClass().remove("unread"); } } }); Entity entity = tab.getEntity(); setPrefHeight(32); if (entity instanceof Server) { setPrefHeight(40); Label net = new Label("network"); net.getStyleClass().add("network"); VBox box = new VBox(); Label name = new Label(entity.getName()); name.getStyleClass().add("network-name"); box.getChildren().addAll(net, name); setGraphic(box); } else if (entity instanceof Channel) { final Label label = new Label(entity.getName().substring(1)); label.getStyleClass().add("name"); final HBox box = new HBox(); box.getChildren().addAll(FontAwesome.createIcon(FontAwesome.COMMENTS), label); setGraphic(box); } else if (entity instanceof User) { final Label label = new Label(entity.getName()); label.getStyleClass().add("name"); final HBox box = new HBox(); box.getChildren().addAll(FontAwesome.createIcon(FontAwesome.USER), label); setGraphic(box); } } }