- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
编码新手,更不用说java和javaFX了。我不确定从主窗口移动到任何其他窗口时我在哪里搞砸了,需要一些帮助来解决这个问题。
主窗口打开正常,但当尝试移动到任何其他屏幕时,例如 AddPart,它会在页面底部显示错误日志。它对每个页面都执行此操作,因此我假设这与我尝试加载页面的方式有关。
HomeWindow Controller :
package ViewController;
import Model.Inventory;
import static Model.Inventory.getPartInventory;
import static Model.Inventory.getProductInventory;
import static Model.Inventory.removePart;
import static Model.Inventory.removeProduct;
import static Model.Inventory.validatePartDelete;
import Model.Part;
import Model.Product;
import Software1C482.InventorySystem;
import java.io.IOException;
import java.net.URL;
import java.util.Optional;
import java.util.ResourceBundle;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.stage.Modality;
import javafx.stage.Stage;
/**
* FXML Controller class
*
* @author Andrew
*/
//It's the home window.
public class HomeWindowController implements Initializable {
//Declaring the FXML parts.
@FXML
private TableView<Product> TableProduct;
@FXML
private TableColumn<Product, Integer> ProductID, ProductInventoryLevel;
@FXML
private TableColumn<Product, String> ProductName;
@FXML
private TableColumn<Product, Double> ProductPPU;
@FXML
private Button ButtonProductAdd;
@FXML
private Button ButtonProductModify;
@FXML
private Button ButtonProductDelete;
@FXML
private Button ButtonPartSearch;
@FXML
private TableView<Part> TablePart;
@FXML
private TableColumn<Part, Integer> PartID, PartInventoryLevel;
@FXML
private TableColumn<Part, String> PartName;
@FXML
private TableColumn<Part, Double> PartPPU;
@FXML
private TextField SearchFieldPart;
@FXML
private TextField SearchFieldProduct;
private static Part modifyPart;
private static int modifyPartIndex;
private static Product modifyProduct;
private static int modifyProductIndex;
public static int partToModifyIndex() {
return modifyPartIndex;
}
public static int productToModifyIndex() {
return modifyProductIndex;
}
public HomeWindowController() {
}
@FXML
void HomeExitClick(ActionEvent event) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.initModality(Modality.NONE);
alert.setTitle("Confirmation");
alert.setHeaderText("Confirm Exit");
alert.setContentText("Are you sure you want to exit?");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
System.exit(0);
} else {
System.out.println("Please resume completing form.");
}
}
@FXML
void HomeAddPartClick(ActionEvent event) throws IOException {
Parent addPart = FXMLLoader.load(getClass().getResource("AddPart.fxml"));
Scene scene = new Scene(addPart);
Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
window.setScene(scene);
window.show();
}
@FXML
void HomeAddProductClick(ActionEvent event) throws IOException {
Parent addProducts = FXMLLoader.load(getClass().getResource("AddProduct.fxml"));
Scene scene = new Scene(addProducts);
Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
window.setScene(scene);
window.show();
}
@FXML
void HomeModifyPartClick(ActionEvent event) throws IOException {
modifyPart = TablePart.getSelectionModel().getSelectedItem();
modifyPartIndex = getPartInventory().indexOf(modifyPart);
Parent modifyParts = FXMLLoader.load(getClass().getResource("ModifyPart.fxml"));
Scene scene = new Scene(modifyParts);
Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
window.setScene(scene);
window.show();
}
@FXML
void HomeModifyProductClick(ActionEvent event) throws IOException {
modifyProduct = TableProduct.getSelectionModel().getSelectedItem();
modifyProductIndex = getProductInventory().indexOf(modifyProduct);
Parent modifyProducts = FXMLLoader.load(getClass().getResource("ModifyProduct.fxml"));
Scene scene = new Scene(modifyProducts);
Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
window.setScene(scene);
window.show();
}
@FXML
void HomeSearchProductsBtn(ActionEvent event) throws IOException {
String searchProd = SearchFieldProduct.getText();
int prodIndex = -1;
if (Inventory.lookupProduct(searchProd) == -1) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Search Error");
alert.setHeaderText("Product not found.");
alert.setContentText("The text entered does not match any Product.");
alert.showAndWait();
} else {
prodIndex = Inventory.lookupProduct(searchProd);
Product tempProd = Inventory.getProductInventory().get(prodIndex);
ObservableList<Product> tempProdList = FXCollections.observableArrayList();
tempProdList.add(tempProd);
TableProduct.setItems(tempProdList);
}
}
@FXML
void HomeDeleteProductBtn(ActionEvent event) throws IOException {
Product product = TableProduct.getSelectionModel().getSelectedItem();
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.initModality(Modality.NONE);
alert.setTitle("Confirm Delete");
alert.setHeaderText("Confirm?");
alert.setContentText("Are you sure you want to delete " + product.getProductName() + "?");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
removeProduct(product);
updateProductTableView();
System.out.println("Product " + product.getProductName() + " was removed.");
} else {
System.out.println("Product " + product.getProductName() + " was not removed.");
}
}
@FXML
void PartSearchOnAction(ActionEvent event) throws IOException {
String searchPart = SearchFieldPart.getText();
int partIndex = -1;
if (Inventory.lookupPart(searchPart) == -1) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Search Error");
alert.setHeaderText("Part not found.");
alert.setContentText("The text entered does not match any Part.");
alert.showAndWait();
} else {
partIndex = Inventory.lookupPart(searchPart);
Part tempPart = Inventory.getPartInventory().get(partIndex);
ObservableList<Part> tempProdList = FXCollections.observableArrayList();
tempProdList.add(tempPart);
TablePart.setItems(tempProdList);
}
}
@FXML
void HomeDeletePartOnAction(ActionEvent event) throws IOException {
Part part = TablePart.getSelectionModel().getSelectedItem();
if (validatePartDelete(part)) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Part Delete Error.");
alert.setHeaderText("Part cannot be removed.");
alert.setContentText("This part is used in a product.");
alert.showAndWait();
} else {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.initModality(Modality.NONE);
alert.setTitle("Product Delete");
alert.setHeaderText("Confirm?");
alert.setContentText("Are you sure you want to delete " + part.getPartName() + "?");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
removePart(part);
updatePartTableView();
System.out.println("Part " + part.getPartName() + " was removed.");
} else {
System.out.println("Part " + part.getPartName() + " was not removed.");
}
}
}
@Override
public void initialize(URL url, ResourceBundle rb) {
PartID.setCellValueFactory(cellData -> cellData.getValue().partIDProperty().asObject());
PartName.setCellValueFactory(cellData -> cellData.getValue().partNameProperty());
PartInventoryLevel.setCellValueFactory(cellData -> cellData.getValue().partInvProperty().asObject());
PartPPU.setCellValueFactory(cellData -> cellData.getValue().partPriceProperty().asObject());
ProductID.setCellValueFactory(cellData -> cellData.getValue().productIDProperty().asObject());
ProductName.setCellValueFactory(cellData -> cellData.getValue().productNameProperty());
ProductInventoryLevel.setCellValueFactory(cellData -> cellData.getValue().productInvProperty().asObject());
ProductPPU.setCellValueFactory(cellData -> cellData.getValue().productPriceProperty().asObject());
updatePartTableView();
updateProductTableView();
}
public void updatePartTableView() {
TablePart.setItems(getPartInventory());
}
public void updateProductTableView() {
TableProduct.setItems(getProductInventory());
}
public void setMainApp(InventorySystem mainApp) {
updatePartTableView();
updateProductTableView();
}
}
添加部件 Controller :
package ViewController;
import Model.InhousePart;
import Model.Inventory;
import Model.OutsourcedPart;
import Model.Part;
import javafx.scene.control.Label;
import java.io.IOException;
import java.net.URL;
import java.util.Optional;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.stage.Modality;
import javafx.stage.Stage;
/**
* FXML Controller class
*
* @author Andrew
*/
public class AddPartController implements Initializable {
@FXML
private RadioButton APRadialInhouse;
@FXML
private RadioButton APRadialOutsourced;
@FXML
private TextField IDField;
@FXML
private TextField NameField;
@FXML
private TextField InvField;
@FXML
private TextField PPUField;
@FXML
private TextField SwapField;
@FXML
private TextField MinField;
@FXML
private TextField MaxField;
@FXML
private Button APSave;
@FXML
private Button APButtonCancel;
@FXML
private Label APSwapLabel;
private boolean isOutsourced;
private String exceptionMessage = new String();
private int partID;
/**
* Initializes the controller class.
*/
//Initialize Controller
@Override
public void initialize(URL url, ResourceBundle rb) {
partID = Inventory.getPartIDCount();
IDField.setText("AUTO GEN: " + partID);
}
//Inhouse Radial
@FXML
private void AddPartsInHouseRadio(ActionEvent event) {
isOutsourced = false;
APSwapLabel.setText("Machine ID");
}
//Outsourced Radial
@FXML
private void APOutsourcedOnAction(ActionEvent event) {
isOutsourced = true;
APSwapLabel.setText("Company Name");
}
//Save Button
@FXML
private void APSaveOnAction(ActionEvent event) throws IOException {
String partName = NameField.getText();
String partInv = InvField.getText();
String partPrice = PPUField.getText();
String partMin = MinField.getText();
String partMax = MaxField.getText();
String partDyn = SwapField.getText();
try {
exceptionMessage = Part.isPartValid(partName, Integer.parseInt(partMin), Integer.parseInt(partMax), Integer.parseInt(partInv), Double.parseDouble(partPrice), exceptionMessage);
if (exceptionMessage.length() > 0) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Error Adding Part");
alert.setHeaderText("Error");
alert.setContentText(exceptionMessage);
alert.showAndWait();
exceptionMessage = "";
} else {
if (isOutsourced == false) {
InhousePart iPart = new InhousePart();
iPart.setPartID(partID);
iPart.setPartName(partName);
iPart.setPartPrice(Double.parseDouble(partPrice));
iPart.setPartInStock(Integer.parseInt(partInv));
iPart.setPartMin(Integer.parseInt(partMin));
iPart.setPartMax(Integer.parseInt(partMax));
iPart.setPartMachineID(Integer.parseInt(partDyn));
Inventory.addPart(iPart);
} else {
OutsourcedPart oPart = new OutsourcedPart();
oPart.setPartID(partID);
oPart.setPartName(partName);
oPart.setPartPrice(Double.parseDouble(partPrice));
oPart.setPartInStock(Integer.parseInt(partInv));
oPart.setPartMin(Integer.parseInt(partMin));
oPart.setPartMax(Integer.parseInt(partMax));
oPart.setPartCompanyName(partDyn);
Inventory.addPart(oPart);
}
Parent partsSave = FXMLLoader.load(getClass().getResource("HomeWindow.fxml"));
Scene scene = new Scene(partsSave);
Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
window.setScene(scene);
window.show();
}
} catch (NumberFormatException e) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Error Adding Part");
alert.setHeaderText("Error");
alert.setContentText("Form contains blank fields.");
alert.showAndWait();
}
}
//Cancel Button
@FXML
private void APButtonCancelOnAction(ActionEvent event) throws IOException {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.initModality(Modality.NONE);
alert.setTitle("Confirmation");
alert.setHeaderText("Confirm Delete");
alert.setContentText("Are you sure you want to delete part " + NameField.getText() + "?");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
Parent partsCancel = FXMLLoader.load(getClass().getResource("HomeWindow.fxml"));
Scene scene = new Scene(partsCancel);
Stage window = (Stage) ((Node) event.getSource()).getScene().getWindow();
window.setScene(scene);
window.show();
} else {
System.out.println("Cancel has been clicked.");
}
}
}
AddPart.FXML:
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.Scene?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<Scene xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ViewController.AddPartController">
<AnchorPane prefHeight="473.0" prefWidth="513.0">
<children>
<Label layoutX="24.0" layoutY="24.0" text="Add Part">
<font>
<Font size="18.0" />
</font>
</Label>
<RadioButton fx:id="APRadialInhouse" layoutX="163.0" layoutY="29.0" mnemonicParsing="false" onAction="#AddPartsInHouseRadio" text="In-House">
</RadioButton>
<RadioButton fx:id="APRadialOutsourced" layoutX="283.0" layoutY="29.0" mnemonicParsing="false" onAction="#APOutsourcedOnAction" text="Outsourced" />
<Label layoutX="80.0" layoutY="204.0" text="Inv" />
<Label layoutX="80.0" layoutY="109.0" text="ID" />
<Label layoutX="80.0" layoutY="158.0" text="Name" />
<Label layoutX="80.0" layoutY="302.0" text="Max" />
<Label layoutX="80.0" layoutY="251.0" text="Price/Cost" />
<Label layoutX="253.0" layoutY="302.0" text="Min" />
<Label fx:id="APSwapLabel" layoutX="82.0" layoutY="344.0" text="Machine ID" />
<TextField fx:id="IDField" disable="true" editable="false" layoutX="179.0" layoutY="105.0" promptText="ID" />
<TextField fx:id="NameField" layoutX="179.0" layoutY="154.0" promptText="Part Name" />
<TextField fx:id="InvField" layoutX="179.0" layoutY="200.0" promptText="Inventory" />
<TextField fx:id="PPUField" layoutX="179.0" layoutY="247.0" promptText="Price/Cost" />
<TextField fx:id="SwapField" layoutX="182.0" layoutY="340.0" prefHeight="25.0" prefWidth="106.0" promptText="Company Name" />
<TextField fx:id="MinField" layoutX="292.0" layoutY="298.0" prefHeight="22.0" prefWidth="62.0" promptText="Min" />
<TextField fx:id="MaxField" layoutX="179.0" layoutY="298.0" prefHeight="22.0" prefWidth="62.0" promptText="Max" />
<Button fx:id="APSave" layoutX="301.0" layoutY="407.0" mnemonicParsing="false" onAction="#APSaveOnAction" prefHeight="40.0" prefWidth="82.0" text="Save" />
<Button fx:id="APButtonCancel" layoutX="399.0" layoutY="407.0" mnemonicParsing="false" onAction="#APButtonCancelOnAction" prefHeight="40.0" prefWidth="82.0" text="Cancel" />
</children></AnchorPane>
</Scene>
错误代码:
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1787)
at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Node.fireEvent(Node.java:8879)
at javafx.controls/javafx.scene.control.Button.fire(Button.java:200)
at javafx.controls/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:206)
at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3851)
at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:390)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:830)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76)
at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:273)
at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83)
at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1782)
... 47 more
Caused by: java.lang.ClassCastException: class javafx.scene.Scene cannot be cast to class javafx.scene.Parent (javafx.scene.Scene and javafx.scene.Parent are in module javafx.graphics of loader 'app')
at InventorySystem/ViewController.HomeWindowController.HomeAddPartClick(HomeWindowController.java:115)
... 58 more
最佳答案
这里的问题是将 Parent
转换为 Scene
。
Node
:例如你的 fxml 就这样开始
<AnchorPane prefHeight="473.0" prefWidth="513.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ViewController.AddPartController">
<children>
<Label layoutX="24.0" layoutY="24.0" text="Add Part">
...
而不是
<Scene xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ViewController.AddPartController">
<AnchorPane prefHeight="473.0" prefWidth="513.0">
<children>
<Label layoutX="24.0" layoutY="24.0" text="Add Part">
...
场景
的方式: //REMOVE THE PARENT
//Parent addPart = FXMLLoader.load(getClass().getResource("AddPart.fxml"));
Scene scene = FXMLLoader.load(getClass().getResource("AddPart.fxml"));
希望对你有帮助
关于java - 从一个窗口移动到另一个窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60607349/
只是想知道 Jquery Mobile 是否足够稳定以用于实时生产企业移动应用程序。 有很多 HTML5 框架,因为我们的团队使用 JQuery 已经有一段时间了,我们更愿意使用 Jquery 移动框
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 3 年前。 Improve t
所以我尝试在 JavaScript 中对元素进行拖放。我使用的视频教程在这里; https://www.youtube.com/watch?v=KTlZ4Hs5h80 。我已经按照它的说明进行了编码,
无法在移动 iOS(safari 和 chrome)上自动播放以前缓存的 mp3 音频 我正在 Angular 8 中开发一个应用程序,在该应用程序的一部分中,我试图在对象数组中缓存几个传入的音频 m
Git 基于内容而不是文件,所以我目前理解以下行为,但我想知道是否有特殊选项或 hack 来检测此类事情: git init mkdir -p foo/bar echo "test" foo/a.tx
我正在寻找语义 ui 正确的类来隐藏例如移动 View 中的 DIV。在 Bootstrap 中,我们有“visible-xs”和“hidden-xs”。 但是在语义ui上我只找到了“仅移动网格” 最
我正在使用 ubuntu 和 想要移动或复制大文件。 但是当我与其他人一起使用服务器时,我不想拥有所有内存并使其他进程几乎停止。 那么有没有办法在内存使用受限的情况下移动或复制文件? 最佳答案 如果你
这些指令有什么区别?以 ARM9 处理器为例,它不应该是: ASM: mov r0, 0 C: r0 = 0; ASM: ld r0, 0 C: r0 = 0; ? 我不知道为什么要使用一个或另一个:
我有一个文件夹,其中包含一些随机命名的文件,其中包含我需要的数据。 为了使用数据,我必须将文件移动到另一个文件夹并将文件命名为“file1.xml” 每次移动和重命名文件时,它都会替换目标文件夹中以前
我经常在 IB/Storyboard 中堆叠对象,几乎不可能拖动其他对象后面的对象而不移动前面的对象。无论如何我可以移动已经选择但位于其他对象后面的对象吗?当我尝试移动它时,它总是选择顶部的对象,还是
几个月前,我看到 Safari 7 允许推送通知,它似乎是一个非常有用的工具,除了我看到的每个示例都专注于桌面浏览,而不是移动设备。 Safari 推送通知是否可以在移动设备上运行,如果没有,是否有计
我有一个简单的 View 模型,其中包含修改后的 ObservableCollection使用 SynchronizationContext.Current.Send在 UI 线程上执行对集合的更改。
关于cassandra创建的数据文件和系统文件的位置,我需要移动在“cassandra.yaml”配置文件中设置的“commitlog_directory”、“data_file_directorie
我有这个代码 $(function() { var message = 'Dont forget us'; var original; var txt1 = ' - '; $(wind
我的客户报告说他的网站有一个奇怪的问题。该网站的 URL 是 your-montenegro.me 在 基于 Android 的浏览器 上加载时,页面底部会出现一个奇怪的空白区域。以下是屏幕截图: 华
我有这个 HTML 标记: Express 300 bsf Sign Up 我需要将元素从 DOM 上的一个
我有一个可重新排序的 TableView (UITableView 实例)。尽管我已经实现了 UITableViewDataSource 方法: tableView:moveRowAtIndexPat
我的客户报告说他的网站有一个奇怪的问题。该网站的 URL 是 your-montenegro.me 在 基于 Android 的浏览器 上加载时,页面底部会出现一个奇怪的空白区域。以下是屏幕截图: 华
我需要在拖放或复制/剪切和粘贴(复制与移动)期间获取操作类型。它是一个 Swing 应用程序,并且实现了 TransferHandle。我在操作结束时需要此信息,在 importData 方法中。 对
我编写了一个具有 add 和 get 方法的 SortedIntList 类。 我调用以下四个方法: SortedIntList mySortedIntList = new SortedIntList
我是一名优秀的程序员,十分优秀!