java识别svg_Java SVGPath.setScaleX方法代码示例

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;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 警告:`set_matplotlib_formats`自ipython 7.23版本起已被弃用,请直接使用`matplotlib_inline.backend_inline.set_matplotlib_formats()`,并使用`display.set_matplotlib_formats('svg')`来设置SVG格式。 ### 回答2: 首先,对于Python程序员来说,我们常常会使用matplotlib这个图像库来进行数据可视化。但是,在使用过程中,可能会遇到如下的问题: deprecationwarning: `set_matplotlib_formats` is deprecated since ipython 7.23, directly use `matplotlib_inline.backend_inline.set_matplotlib_formats()` display.set_matplotlib_formats('svg')。 这个问题的意思是提示我们使用set_matplotlib_formats()这个函数时会出现警告,因为ipython的版本已经更新到了7.23,而set_matplotlib_formats()这个函数已经被弃用了。 知道了这个问题,我们怎么去解决呢? 其实,在新版本的ipython中,我们可以直接使用matplotlib_inline.backend_inline.set_matplotlib_formats()这个函数来代替set_matplotlib_formats(),并且实现的效果是一样的。 除此之外,还可以使用display.set_matplotlib_formats('svg')来设置输出格式,这个函数也能够输出图片,只不过它只支持SVG格式的输出。 这些函数的使用方式比较简单,我们只需要在代码中进行相应的修改,即可顺利运行我们的程序。当然,这个问题的解决也提示我们要随时关注我们所使用的库的版本,以确保我们的程序能够正常运行。 ### 回答3: 简单来说,这个DeprecationWarning是Python在告诉我们现在的设置方法已经过时了,应该使用新的方法来设置。具体来说,这个警告是针对在使用IPython 7.23及以上版本时调用set_matplotlib_formats()函数的用户发出的。 set_matplotlib_formats()函数是一种设置图形格式的方法,旧的IPython版本中经常用到它来为matplotlib生成的图形设置格式,比如说png或者svg格式。但在新的IPython版本中,这个函数被认为是过时的了,因此旧版本中使用的代码需要进行修改。 替代set_matplotlib_formats()函数的新方法是调用matplotlib_inline.backend_inline.set_matplotlib_formats()和display.set_matplotlib_formats('svg')。这些新方法提供了更好的API,并且更符合Python代码风格的规范。 总的来说,如果你正在使用较新版本的IPython,想修改matplotlib图形的格式,那么建议使用新的设置方法。这不仅能避免警告产生,而且能够更好地提高您Python代码编写的效率。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值