1 Reply Latest reply: Nov 6, 2012 5:33 AM by Andipa RSS

    Get Children of a GridPane and Make them bold

    dscarminiabielefeld
      Hello,

      i want to set the Children of a Gridpane bold. The Childrens types are text.
      private GridPane labelPane = new GridPane();
              final Text text  = new Text();
              final Text text1 = new Text();
              final Text text2 = new Text();
              final Text text3 = new Text();
         labelPane.getChildren().addAll(text, text1, text2, text3);
      So basically im searching for something like this:
      labelPane.getChildren().setFont(Weight.BOLD);
      Does java somehow recognize, that the childrens are from type text, so we can set them bold?
      Because ...
      Text test2 ) = new Text();
      text2.setFont(...)
      ... wouldn't be a problem. Do i have to choose another way?

      Thank you,
      regards
        • 1. Re: Get Children of a GridPane and Make them bold
          Andipa
          This is something you would define using CSS - and then assign the respective style class using getStyleClass().add(styleClassName) either on each individual text node or on the grid pane.

          In the lattercase CSS might look like this then (didn't check, might not work):
          .boldchildren-gridpane .text {
            -fx-font-weight:bold;
          }
          Edited by: Andipa on 06.11.2012 03:32