0

是否可以标记一些分页控制按钮以指示页面包含重要内容?
示例:更改按钮 5 和 7 的背景颜色,
非常感谢。

4

1 回答 1

0
    public void colorImportantIndicatorButton(Parent node) {
    int i = 0;
     for (Node subNode : node.getChildrenUnmodifiable()) {
       if (subNode.getClass().getSimpleName().equals("IndicatorButton")) {
          subNode.setId("IB" + i); 
          if ( isImportant(i) ) { 
            subNode.setStyle("-fx-background-color:red;"); 
          } 
         i++;
        } 

        if (subNode instanceof Parent) {
           colorImportantIndicatorButton((Parent) subNode); 
        } 
      } 
    } 

    public boolean isImportant(int index){ // return true or false } 
于 2018-04-27T13:43:26.077 回答