我需要在 imegView 中获取显示图像的宽度/高度,并将其与 imageView.getImage().getWidth()/getHeight() 中的原始图像大小进行比较,并在用户从应用程序 GUI 中调整其大小时监听更改。
我从imageView.fitWidthProperty()高度上得到了这个大小,但我得到了 imageView 的大小而不是其中的图像:

我得到的是 imageView 的蓝色大小,但我需要显示图像的大小(绿色)。当用户调整窗口应用程序大小时,如何将其作为属性进行侦听(绿色也会更改大小,但它似乎具有最大和最小大小,因此在最大或最小时停止使用 imageView 调整大小)。
我使用这个属性来计算蓝色矩形右下角原始图像大小的百分比。
是否可以?
E:以下是此选项卡的 fxml:
<BorderPane fx:id="root" fx:controller="..."
xmlns:fx="..." xmlns="..." stylesheets="@...css">
<center>
<StackPane>
<ImageView fx:id="..."/>
<fx:include source="...fxml" fx:id="..."/>
</StackPane>
</center>
<bottom>
<VBox fx:id="..." minHeight="110" styleClass="small-padding" spacing="5">
<HBox alignment="CENTER_RIGHT" spacing="5">
<fx:include source="...fxml" resources="..."
fx:id="..."/>
</HBox>
<TextArea fx:id="..." promptText="%..." styleClass="-fx-description-text-area"/>
</VBox>
</bottom>
Run Code Online (Sandbox Code Playgroud)