Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (Node node : officeHoursGridPane.getChildren()) {
- node.setOnMouseEntered((MouseEvent t) -> {
- node.setStyle("-fx-background-color:#f9f3c5;");
- Node source = (Node)t.getSource();
- Integer colIndex = GridPane.getColumnIndex(source);
- Integer rowIndex = GridPane.getRowIndex(source);
- //ystem.out.println("Collumn #: " + colIndex + "nRow #: " + rowIndex);
- for(int c = 0; c <= colIndex; c++){
- Node[] colNode = getNodeByColumnIndex(colIndex, officeHoursGridPane);
- int colCount=0;
- for(int v = 0; v <= colNode.length; v++){
- Node vertNode = colNode[v];
- vertNode.setStyle("-fx-background-color:#f9f3c5;");
- }
- }
- });
- node.setOnMouseExited((MouseEvent t) -> {
- node.setStyle("-fx-background-color:#ffffff;");
- });
- }
- public Node[] getNodeByColumnIndex (final int column, GridPane gridPane) {
- Node[] result = null;
- ObservableList<Node> childrens = gridPane.getChildren();
- int count = 0;
- for (Node node : childrens) {
- if(GridPane.getColumnIndex(node) == column) {
- result[count] = node;
- count++;
- if(count > column){
- break;
- }
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement