我似乎無法調整複選框,無論使用寬度/高度,minWidth/minHeight還是maxWidth/maxHeight。改變最小寬度似乎只以實現節點填充JavaFX,如何調整複選框的大小?
package checkboxtest;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class CheckBoxTest extends Application {
@Override
public void start(Stage primaryStage) {
CheckBox checkBoxResize = new CheckBox("Resize");
checkBoxResize.setMinWidth(300);
checkBoxResize.setMinHeight(300);
CheckBox checkBoxNoResize = new CheckBox("No Resize");
StackPane root = new StackPane();
root.getChildren().add(checkBoxResize);
root.getChildren().add(checkBoxNoResize);
Scene scene = new Scene(root, 300, 250);
primaryStage.setTitle("Hello Checkbox!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
你用CSS試過了嗎? [可能相關答案](http://stackoverflow.com/questions/12038179/javafx-2-0-how-to-change-the-size-of-the-radio-buttons-circle-with-css) – Spotted