Das Einstellen der Eigenschaft -fx -Form mit SVG gibt ein verschwommenes Ergebnis bei JavafxJava

Java-Forum
Guest
 Das Einstellen der Eigenschaft -fx -Form mit SVG gibt ein verschwommenes Ergebnis bei Javafx

Post by Guest »

Ich möchte ein Symbol für meine Taste mit SVG und CSS (!) Einstellen. Dies ist mein Code: < /p>

Code: Select all

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);
}
}
Und dies ist das Ergebnis (Zoom 400%):
< /p>
Wie Sie sehen, wird SVGPath korrekt gerendert, das Symbol in der Taste (mit demselben SVG) ist jedoch verschwommen. Könnte jemand sagen, wie man es behebt?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post