JavaFX ScrollPane border and background

后端 未结 7 2289
独厮守ぢ
独厮守ぢ 2020-12-14 10:56

I\'m having some problem regarding the default background and border of the ScrollPane. Using this style made the problem clearer to see.

setStyle(\"-fx-back         


        
7条回答
  •  無奈伤痛
    2020-12-14 11:28

    Rather than use FXML or CSS I prefer to consume the event, but this only works on the portion that has content. If your scrollPane is larger than its content you also have to fill the remaining space.

    scrollPane.getContent().setOnMousePressed(Event::consume);
    scrollPane.setFitToHeight(true);
    scrollPane.setFitToWidth(true);
    

提交回复
热议问题