滚动窗格CSS不适用于滚动条JavaFx2.2

时间:2013-12-31 11:27:27

标签: css javafx-2

这是我的Scrollpane的fxml,它位于GridPane

    <ScrollPane fx:id="scrollPane" prefHeight="200.0" prefWidth="200.0" style=".scroll-pane .track{-fx-opacity: 0;}&#10;.scroll-pane .scroll-bar{-fx-base: transparent;}" vbarPolicy="AS_NEEDED" styleClass="myscrollpane" GridPane.columnIndex="0" GridPane.rowIndex="1">
  <content>
  </content>
  <GridPane.margin>
    <Insets top="10.0" />
  </GridPane.margin>
</ScrollPane>

我想申请的CSS是

.myscrollpane .scroll-bar:horizontal ,
.myscrollpane  .scroll-bar:vertical{
-fx-background-color:#d7dddd; 

}
.myscrollpane .increment-button ,
.myscrollpane .decrement-button {
-fx-background-color:transparent;
-fx-background-radius: 0em;
-fx-padding:0 0.5 0 0;

}
.mylistview  .scroll-bar .increment-arrow,
.mylistview  .scroll-bar .decrement-arrow {
-fx-shape: " ";
-fx-padding:0;
}
.myscrollpane .scroll-bar:horizontal .track ,
.myscrollpane .scroll-bar:vertical .track{
-fx-background-color: transparent;
-fx-border-color:derive(gray,80%);
-fx-background-radius: 0em;
}

.myscrollpane .scroll-bar:horizontal .thumb,
.myscrollpane .scroll-bar:vertical .thumb {

-fx-background-color : #989898;
-fx-background-insets: 1, 0, 0;
-fx-background-radius: 0em;

}
.myscrollpane .scroll-bar:horizontal:hover .track ,
.myscrollpane .scroll-bar:horizontal:pressed .track ,
.myscrollpane .scroll-bar:vertical:hover .track,
.myscrollpane .scroll-bar:vertical:pressed .track{
-fx-background-color: derive(#434343,20%);
-fx-opacity: 0.2;
-fx-background-radius: 0em;

}
.myscrollpane .scroll-bar .thumb:hover,
.myscrollpane .scroll-bar .thumb:pressed{
-fx-background-color: derive(black,50%);
}

使用myscrllpane是Scroll-pane的类。 但它没有任何意义。即直接在fxml中编写css或使用url嵌入CSS。因为我必须要求将其应用于滚动窗格的滚动条。

0 个答案:

没有答案