I've downloaded a free SVG and converted it to fxml with this converter . But when I load the fxml and try to resize it, it keeps its original size. Why ?
This is the fxml I got once converted (just modified translate coordinates as it gave two values instead of one for both x/y parameters) :
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.*?>
<?import javafx.scene.shape.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.transform.*?>
<Group id='_root' xmlns:fx="http://javafx.com/fxml" xmlns:fxsvg="http://efxclipse.org/fxml-svg">
<children>
<Group
opacity="1.0"
id="layer1"
>
<children>
<SVGPath
content="m62.695 460.2l-14.737-14.77 3.271-3.09c9.747-9.22 28.802-20.06 44.382-25.24 18.679-6.21 21.399-6.5 62.389-6.62 35.2-0.11 37.99-0.25 45.5-2.29 11.23-3.05 21.43-8.48 29.01-15.42 7.7-7.06 8.17-8.77 2.37-8.77-5.98 0-27.91-4.62-38.38-8.08-12.14-4.02-33.5-14.51-33.5-16.46 0-0.83 3.15-14.09 7-29.46s6.99-28.3 6.97-28.72c-0.01-0.43-3.21-2.8-7.11-5.28-30.93-19.63-42.46-61.82-26.4-96.62 9.66-20.92 23.9-34.9 64.14-62.96 19.59-13.66 36.66-26.79 41.23-31.71l2.33-2.51-4.11-0.69c-5.8-0.98-12.96-6.154-16.52-11.932-2.68-4.354-3.03-5.804-3.03-12.578s0.35-8.224 3.03-12.578c10.05-16.328 32.89-16.328 42.94 0 2.68 4.354 3.03 5.804 3.03 12.578s-0.35 8.224-3.03 12.578c-3.56 5.778-10.72 10.952-16.52 11.932l-4.11 0.69 2.33 2.51c4.57 4.92 21.64 18.05 41.23 31.71 40.24 28.06 54.48 42.04 64.14 62.96 16.06 34.8 4.53 76.99-26.4 96.62-3.9 2.48-7.1 4.85-7.11 5.28-0.02 0.42 3.12 13.35 6.97 28.72s7 28.63 7 29.46c0 1.95-21.36 12.44-33.5 16.46-10.47 3.46-32.4 8.08-38.38 8.08-5.8 0-5.33 1.71 2.37 8.77 7.58 6.94 17.78 12.37 29.01 15.42 7.51 2.04 10.3 2.18 45.5 2.29 31.98 0.09 38.68 0.37 45.5 1.89 19.49 4.33 39.19 13.05 53.38 23.63 12.97 9.68 13.32 7.33-3.68 24.3l-14.73 14.71-5.94-4.44c-15.12-11.32-34.38-19.22-53.53-21.98-5.78-0.83-21.97-1.97-36-2.53-14.02-0.56-29.52-1.72-34.43-2.58-12.87-2.24-26.59-7.08-35.84-12.64-4.43-2.66-8.36-4.84-8.73-4.84s-4.3 2.18-8.73 4.84c-9.25 5.56-22.97 10.4-35.84 12.64-4.91 0.86-20.4 2.02-34.43 2.58-36.43 1.45-51.08 4.01-68.75 11.99-5.298 2.39-17.312 9.86-24.784 15.4-1.933 1.43-2.767 0.77-16.771-13.25z"
opacity="1"
id="path2496"
>
<fill>
<Color>
<red>0.0</red>
<green>0.0</green>
<blue>0.0</blue>
</Color>
</fill>
<transforms>
<Translate
x="644.53"
y="535.4"
>
</Translate>
</transforms>
</SVGPath>
<SVGPath
content="m260 226.5v-12.5h12 12v-7.5-7.5h-12-12v-12.5-12.5h-7.5-7.5v12.5 12.5h-12.5-12.5v7.5 7.5h12.5 12.5v12.5 12.5h7.5 7.5v-12.5z"
opacity="1"
id="path2395"
>
<fill>
<Color>
<red>1.0</red>
<green>1.0</green>
<blue>1.0</blue>
</Color>
</fill>
<transforms>
<Translate
x="644.53"
y="535.4"
>
</Translate>
</transforms>
</SVGPath>
<SVGPath
content="m205.27 302.48c4.82-1.98 13.15-4.77 18.5-6.2 8.81-2.35 11.48-2.6 28.23-2.6s19.42 0.25 28.23 2.6c7.76 2.07 21.01 6.89 28.28 10.28 0.86 0.4 7.49-10.15 7.49-11.92 0-1.03-9.08-5.26-18.12-8.45-16.43-5.8-27.56-7.65-45.88-7.65s-29.45 1.85-45.88 7.65c-9.04 3.19-18.12 7.42-18.12 8.45 0 1.77 6.63 12.32 7.49 11.92 0.56-0.26 4.96-2.1 9.78-4.08z"
opacity="1"
id="path2393"
>
<fill>
<Color>
<red>1.0</red>
<green>1.0</green>
<blue>1.0</blue>
</Color>
</fill>
<transforms>
<Translate
x="644.53"
y="535.4"
>
</Translate>
</transforms>
</SVGPath>
<SVGPath
content="m185.32 363.13c17.65-12.11 44.18-20.12 66.68-20.12s49.03 8.01 66.68 20.12c2.3 1.58 4.38 2.87 4.63 2.87 0.51 0 8.69-10.68 8.69-11.34 0-1.08-13.52-9.04-23-13.55-23.92-11.38-50.02-15.37-75.68-11.56-14.21 2.11-25.83 5.61-38.32 11.56-9.48 4.51-23 12.47-23 13.55 0 0.66 8.18 11.34 8.69 11.34 0.25 0 2.33-1.29 4.63-2.87z"
opacity="1"
id="path2391"
>
<fill>
<Color>
<red>1.0</red>
<green>1.0</green>
<blue>1.0</blue>
</Color>
</fill>
<transforms>
<Translate
x="644.53"
y="535.4"
>
</Translate>
</transforms>
</SVGPath>
</children>
<transforms>
<Translate
x="-644.53"
y="-535.4"
>
</Translate>
</transforms>
</Group>
<!-- Unhandled type 'SvgMetadataElement' -->
</children>
</Group>
This is an excerpt of the code where I load it :
try {
Node pieceImage = FXMLLoader.load(getClass().getClassLoader().getResource("chess_bd.fxml"));
pieceImage.resize(20, 20); // does not work, whatever values are given
In order to be more complete, I can also say that it is part of a Gluon Mobile project, but I am not sure that this is the "bug" point.
A Group
just wraps the children and uses their bounds to determine it's size. It's not resizeable.
A
Group
will take on the collective bounds of its children and is not directly resizable.
Furthermore this won't work with other layouts either, since SVGPath
is not resizeable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.