Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boxes = new CheckBox[]{lenPetCb, lenSepCb, larPetCb, larSepCb};
- int i;
- for(i=0;i<4;i++)
- {
- final CheckBox cb = boxes[i];
- cb.selectedProperty().addListener((observable, oldValue, newValue) -> {
- if( newValue.booleanValue() ){
- switch (cb.getId()){
- case "lenPetCb": lenPetCol.setStyle("-fx-border-color: yellow;");
- break;
- case "lenSepCb": lenSetCol.setStyle("-fx-border-color: yellow;");
- break;
- case "larPetCb": larPetCol.setStyle("-fx-border-color: yellow;");
- break;
- case "larSepCb": larSetCol.setStyle("-fx-border-color: yellow;");
- break;
- }
- }
- else if( !newValue.booleanValue() ){
- System.out.println("Deselezionato: "+cb.getId());
- switch (cb.getId()){
- case "lenPetCb": lenPetCol.setStyle("-fx-border-color: none;");
- break;
- case "lenSepCb": lenSetCol.setStyle("-fx-border-color: none;");
- break;
- case "larPetCb": larPetCol.setStyle("-fx-border-color: none;");
- break;
- case "larSepCb": larSetCol.setStyle("-fx-border-color: none;");
- break;
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment