各位程序员,
我刚刚启动javafx并使用场景生成器来生成我的fxml文档,但是遇到问题。 因此,我尝试制作纸牌游戏,我的第一个视图是登录/密码视图,背景色为绿色,并且在图片的左上角放置了一张ace卡。
这是屏幕enter image description here 但是这张卡就像这样enter image description here 当我更改窗格的背景颜色时,它会影响图像, 我想让ace卡的原始图片不受影响,该怎么办。
这是我的fxml文档的代码
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="600.0" minWidth="600.0" prefHeight="600.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.121" xmlns:fx="http://javafx.com/fxml/1">
<children>
<Pane prefHeight="600.0" prefWidth="600.0" style="-fx-background-color: green;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<Text layoutX="345.0" layoutY="67.0" strokeType="OUTSIDE" strokeWidth="0.0" text="BELOTE" wrappingWidth="169.7294921875">
<font>
<Font size="29.0" />
</font>
</Text>
<TextField layoutX="344.0" layoutY="215.0" />
<Text layoutX="234.0" layoutY="233.0" strokeType="OUTSIDE" strokeWidth="0.0" text="PSEUDO" />
<TextField layoutX="344.0" layoutY="300.0" />
<Text layoutX="234.0" layoutY="318.0" strokeType="OUTSIDE" strokeWidth="0.0" text="mot de passe" />
<Button layoutX="344.0" layoutY="381.0" mnemonicParsing="false" text="connexion" />
<Button layoutX="439.0" layoutY="381.0" mnemonicParsing="false" text="inscription" />
<ImageView fitHeight="150.0" fitWidth="200.0" layoutX="56.0" layoutY="74.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@ace.png" />
</image>
</ImageView>
</children>
<opaqueInsets>
<Insets right="1.0" />
</opaqueInsets>
</Pane>
</children>
</AnchorPane>
`
谢谢