javafx checkbox

public class EffectTest extends Application {
public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) {
        Scene scene = new Scene(new Group());
        stage.setTitle("Tooltip Sample");
        stage.setWidth(300);
        stage.setHeight(150);
        final CheckBox cb = new CheckBox("checkBox");
        final Tooltip tooltip = new Tooltip("$ tooltip");
        tooltip.setFont(new Font("Arial", 16));
        cb.setTooltip(tooltip);
        cb.selectedProperty().addListener(new ChangeListener<Boolean>() {
           public void changed(ObservableValue<? extends Boolean> ov,
             Boolean old_val, Boolean new_val) {
             System.out.println(cb.isSelected());
          }
        });

        ((Group) scene.getRoot()).getChildren().add(cb);

        stage.setScene(scene);
        stage.show();
    }
    
    
    
}

 

posted on 2015-08-11 11:16  rojas  阅读(678)  评论(0编辑  收藏  举报