Код: Выделить всё
public class NewMain extends Application {
@Override
public void start(Stage primaryStage) {
var path = "M0,2 H8 V4 H0 Z M0,2 H1 V9 H0 Z M0,8 H8 V9 H0 Z M7,2 H8 V9 H7 Z";
var svgPath = new SVGPath();
svgPath.setContent(path);
var region = new Region();
region.setStyle("-fx-shape:\"" + path + "\";"
+ "-fx-scale-shape: false;"
+ "-fx-pref-width: 20px;"
+ "-fx-pref-height: 20px;"
+ "-fx-background-color: black");
var button = new Button(null, region);
VBox root = new VBox(svgPath, button);
root.setPadding(new Insets(20));
root.setSpacing(20);
Scene scene = new Scene(root, 100, 100);
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
< /p>
, как вы видите, svgpath рендерируется правильно, но значок в кнопке (с тем же SVG) размыт. Кто -нибудь может сказать, как это исправить?
Подробнее здесь: https://stackoverflow.com/questions/793 ... -in-javafx
Мобильная версия