本文整理汇总了Java中javafx.scene.shape.SVGPath.setScaleX方法的典型用法代码示例。如果您正苦于以下问题:Java SVGPath.setScaleX方法的具体用法?Java SVGPath.setScaleX怎么用?Java SVGPath.setScaleX使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.shape.SVGPath
的用法示例。
在下文中一共展示了SVGPath.setScaleX方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showSvgs
import javafx.scene.shape.SVGPath; //导入方法依赖的package包/类
private void showSvgs(int index) {
int x = 0, y = 0;
for (String j :
svgData.get(index).getValue().getData().values()) {
SVGPath path = new SVGPath();
path.setContent(j);
Bounds bounds = path.boundsInLocalProperty().getValue();
double scale = Math.max(bounds.getHeight(),bounds.getWidth());
path.setScaleX(30 / scale);
path.setScaleY(30 / scale);
Button button = new Button();
button.setGraphic(path);
button.getStylesheets().add("css/svgbutton_style.css");
button.setOnMouseClicked(event -> {
SVGPath svgPath = (SVGPath) button.getGraphic();
controller.drawSvg(svgPath.getContent());
(button.getScene().getWindow()).hide();
});
button.setManaged(false);
button.resizeRelocate(x , y, 50, 50);
x+=55;
if (x > 399) {
x = 0;
y += 55;
}
iconsPane.getChildren().add(button);
}
}
示例2: createCloseButton
import javafx.scene.shape.SVGPath; //导入方法依赖的package包/类
private HBox createCloseButton() {
SVGPath closeButton = new SVGPath();
closeButton.setContent("M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z");
closeButton.setFill(Color.WHITE);
Group closeButtonBackground = new Group();
closeButtonBackground.getChildren().add(closeButton);
closeButton.setScaleX(closeButtonBackground.getScaleX() * .4);
closeButton.setScaleY(closeButtonBackground.getScaleY() * .4);
HBox closeContainer = new HBox(3);
String closeContainerStyle = "-fx-background-color: rgba(0,0,0,.70); "
+ "-fx-background-radius: 1.0;"
+ "-fx-border-color: rgba(255,255,255,.70);"
+ "-fx-background-insets: 1;"
+ //"-fx-border-insets: 3;" +
"-fx-border-width: 1;"
+ "-fx-border-radius: 1;"
+ "";
closeContainer.setStyle(closeContainerStyle);
closeContainer.setMinWidth(20);
closeContainer.setMaxWidth(20);
closeContainer.setAlignment(Pos.CENTER);
closeContainer.getChildren().add(closeButtonBackground);
closeContainer.setOnMousePressed(mouseEvent -> {
close();
});
return closeContainer;
}
示例3: createConfigButton
import javafx.scene.shape.SVGPath; //导入方法依赖的package包/类
private HBox createConfigButton() {
SVGPath configButton = new SVGPath();
configButton.setContent("M31.229,17.736c0.064-0.571,0.104-1.148,0.104-1.736s-0.04-1.166-0.104-1.737l-4.377-1.557c-0.218-0.716-0.504-1.401-0.851-2.05l1.993-4.192c-0.725-0.91-1.549-1.734-2.458-2.459l-4.193,1.994c-0.647-0.347-1.334-0.632-2.049-0.849l-1.558-4.378C17.165,0.708,16.588,0.667,16,0.667s-1.166,0.041-1.737,0.105L12.707,5.15c-0.716,0.217-1.401,0.502-2.05,0.849L6.464,4.005C5.554,4.73,4.73,5.554,4.005,6.464l1.994,4.192c-0.347,0.648-0.632,1.334-0.849,2.05l-4.378,1.557C0.708,14.834,0.667,15.412,0.667,16s0.041,1.165,0.105,1.736l4.378,1.558c0.217,0.715,0.502,1.401,0.849,2.049l-1.994,4.193c0.725,0.909,1.549,1.733,2.459,2.458l4.192-1.993c0.648,0.347,1.334,0.633,2.05,0.851l1.557,4.377c0.571,0.064,1.148,0.104,1.737,0.104c0.588,0,1.165-0.04,1.736-0.104l1.558-4.377c0.715-0.218,1.399-0.504,2.049-0.851l4.193,1.993c0.909-0.725,1.733-1.549,2.458-2.458l-1.993-4.193c0.347-0.647,0.633-1.334,0.851-2.049L31.229,17.736zM16,20.871c-2.69,0-4.872-2.182-4.872-4.871c0-2.69,2.182-4.872,4.872-4.872c2.689,0,4.871,2.182,4.871,4.872C20.871,18.689,18.689,20.871,16,20.871z");
configButton.setFill(Color.WHITE);
Group closeButtonBackground = new Group();
closeButtonBackground.getChildren().add(configButton);
configButton.setScaleX(closeButtonBackground.getScaleX() * .4);
configButton.setScaleY(closeButtonBackground.getScaleY() * .4);
HBox container = new HBox(3);
String closeContainerStyle = "-fx-background-color: rgba(0,0,0,.70); "
+ "-fx-background-radius: 1.0;"
+ "-fx-border-color: rgba(255,255,255,.70);"
+ "-fx-background-insets: 1;"
+ //"-fx-border-insets: 3;" +
"-fx-border-width: 1;"
+ "-fx-border-radius: 1;"
+ "";
container.setStyle(closeContainerStyle);
container.setMinWidth(20);
container.setMaxWidth(20);
container.setAlignment(Pos.CENTER);
container.getChildren().add(closeButtonBackground);
container.setOnMousePressed(mouseEvent -> {
});
return container;
}
示例4: resize
import javafx.scene.shape.SVGPath; //导入方法依赖的package包/类
private void resize(SVGPath svg, double width, double height) {
double originalWidth = svg.prefWidth(-1);
double originalHeight = svg.prefHeight(originalWidth);
double scaleX = width / originalWidth;
double scaleY = height / originalHeight;
System.out.println("Scale X " + scaleX);
System.out.println("Scale Y " + scaleY);
svg.setScaleX(scaleX);
svg.setScaleY(scaleY);
}
示例5: resize
import javafx.scene.shape.SVGPath; //导入方法依赖的package包/类
private void resize(SVGPath svg, double width, double height) {
double originalWidth = svg.prefWidth(-1);
double originalHeight = svg.prefHeight(originalWidth);
double scaleX = width / originalWidth;
double scaleY = height / originalHeight;
svg.setScaleX(scaleX);
svg.setScaleY(scaleY);
}