我正在尝试使用FXML在JavaFX中创建Java程序.但是我在布局管理方面遇到了麻烦.我想在Panes之间切换,就像我习惯使用CardLayout一样,但我似乎无法得到它.
我用Google搜索,没有找到任何答案.
JavaFX中是否有任何CardLayout等效项?如果是的话,你能给我一个例子吗?这对我的晚会很有帮助!
这是我的FXML代码
<AnchorPane id="anchorPane" prefHeight="324.0" prefWidth="530.0" xmlns:fx="http://javafx.com/fxml" fx:controller="javafxapplication2.SampleController">
<children>
<Pane fx:id="mainScreen" layoutX="6.0" prefHeight="324.0" prefWidth="518.0">
<children>
<Button layoutX="254.0" layoutY="37.0" mnemonicParsing="false" text="Button" />
</children>
</Pane>
<Pane fx:id="loginScreen" prefHeight="324.0" prefWidth="530.0">
<children>
<TextField id="password" fx:id="username" layoutX="142.0" layoutY="106.0" prefWidth="200.0" />
<TextField fx:id="password" layoutX="142.0" layoutY="140.0" prefWidth="200.0" />
<Label fx:id="label" layoutX="126.0" layoutY="120.0" minHeight="16.0" minWidth="69.0" />
<Button fx:id="button" layoutX="213.0" layoutY="196.0" onAction="#handleButtonAction" onKeyPressed="#handleButtonAction" text="Login" />
</children>
</Pane>
</children>
</AnchorPane>
Run Code Online (Sandbox Code Playgroud) 我有一个contains()方法的问题,即使ArrayList包含给定的方法返回false Object.我的代码如下:
String [] transaction = dbConnection.getPendingTransaction(username);
if (!onlineConnection.getSentTransactionRequests().contains(transaction)) {
onlineConnection.getSentTransactionRequests().add(transaction);
String packet = "RTR" + "_" + transaction[0] + "_" + transaction[2] +
"_" + transaction[3] + "_" + transaction[4];
onlineConnection.send(packet);
}
Run Code Online (Sandbox Code Playgroud)
我Thread.sleep()在迭代之间尝试过,所以ArrayList没有成功就没有加载.
java ×2
arraylist ×1
arrays ×1
contains ×1
evaluation ×1
javafx ×1
netbeans ×1
scenebuilder ×1
swing ×1