JavaFX Hide ScrollPane gray border

nailujed picture nailujed · Oct 15, 2012 · Viewed 15.2k times · Source

Is there any way of hiding the gray border of an ScrollPane control in JavaFX ?

Answer

Sergey Grinev picture Sergey Grinev · Oct 15, 2012

All controls in JavaFX can be modified using CSS styling. You may want to take a look at reference or tutorial.

Gray ScrollPane's border is actually the only part of the background which is visible behind the content. So you can change it by modifying the background:

    ScrollPane sp = new ScrollPane();
    sp.setStyle("-fx-background-color:transparent;");