JavaFX2.0:如何使用CSS更改单选按钮圆圈的大小?

JavaFX2.0:如何使用CSS更改单选按钮圆圈的大小?,javafx,javafx-2,fxml,scenebuilder,Javafx,Javafx 2,Fxml,Scenebuilder,我尝试使用FXML和CSS更改应用程序构建中的单选按钮大小。 我使用sceneBuilder 谢谢你的帮助 下面是我单选按钮的实际CSS代码: .radio-button .radio{ -fx-border-width : 1px ; -fx-border-color : #000 ; -fx-background-color : white ; -fx-background-image : null ; -fx-border-radius : 15px ; -

我尝试使用FXML和CSS更改应用程序构建中的单选按钮大小。 我使用sceneBuilder

谢谢你的帮助

下面是我单选按钮的实际CSS代码:

.radio-button .radio{
-fx-border-width     : 1px   ;
-fx-border-color     : #000  ;
-fx-background-color : white ;
-fx-background-image : null  ;
-fx-border-radius    : 15px  ;
-fx-height           : 15px  ; /* Not working */
height               : 5px   ; /* Not working */
}
.radio-button .radio:selected{
-fx-background-color : white ;
-fx-background-image : null  ;
}
.radio-button -radio:armed{
-fx-background-color : white ;
-fx-background-image : null  ;
}
.radio-button -radio:determinate{
-fx-background-color : white ;
-fx-background-image : null  ;
}
.radio-button -radio:indeterminate{
-fx-background-color : white ;
-fx-background-image : null  ;
}

-fx填充:10px

单个填充值表示所有填充都相同,如果指定了一组四个填充值,则它们将用于区域的顶部、右侧、底部和左侧边缘

例如:

CssTest.java

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.RadioButton;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class CssTest extends Application 
{
    public void start(Stage stage) throws Exception
    {
        BorderPane root = new BorderPane();
        RadioButton radio = new RadioButton("radio-text");
        root.setCenter(radio);
        root.getStylesheets().add(getClass().getResource("/radio.css").toExternalForm());
        stage.setScene(new Scene(root));
        stage.show();
    }

    public static void main(String[] args)
    {
        launch(args);
    }
}
radio.css

.radio-button .radio {
    -fx-border-width: 1px;
    -fx-border-color: #000;
    -fx-background-color: white;
    -fx-background-image: null;
    -fx-border-radius: 15px;
    -fx-padding: 4px;
}
.radio-button .radio:selected {
    -fx-background-color: white;
    -fx-background-image: null;
}
.radio-button -radio:armed {
    -fx-background-color: white;
    -fx-background-image: null;
}
.radio-button -radio:determinate {
    -fx-background-color: white;
    -fx-background-image: null;
}
.radio-button -radio:indeterminate {
    -fx-background-color: white;
    -fx-background-image: null;
}
.radio-button .dot {
    -fx-background-radius: 15px;
    -fx-padding: 8px;
}
结果


要了解更多鼓舞人心的JavaFX CSS主题,请查看win7glass.CSSfrom

谢谢,但更改复选框和收音机按钮的大小无助于我衷心感谢您!