Wenn ich build und run durchführe erhalte ich diese Schlußmeöldungant -f C:\\Users\\Juergen\\Documents\\NetBeansProjects\\JavaFXApplication5 jfxsa-run
init:
Deleting: C:\Users\Juergen\Documents\NetBeansProjects\JavaFXApplication5\build\built-jar.properties
deps-jar:
Updating property file: C:\Users\Juergen\Documents\NetBeansProjects\JavaFXApplication5\build\built-jar.properties
compile:
Detected JavaFX Ant API version 1.3
jfx-deployment:
jar:
Copying 12 files to C:\Users\Juergen\Documents\NetBeansProjects\JavaFXApplication5\dist\run1554432730
jfx-project-run:
Executing C:\Users\Juergen\Documents\NetBeansProjects\JavaFXApplication5\dist\run1554432730\JavaFXApplication5.jar using platform C:\Program Files\Java\jdk1.8.0_131\jre/bin/java
Ein projekt mit FXMLDokument angefangen mit Anchor unten steht Running wie bei den einfachen Projekten mit Stackpane (wo die fenster Problemlos angezeigt werden) nur bei diesen Listings nicht.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javafxapplication5;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
/**
*
* @author bo4
*/
public class JavaFXApplication5 extends Application {
private Stage primaryStage;
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
mainWindow();
}
public void mainWindow(){
try{
FXMLLoader loader = new FXMLLoader(JavaFXApplication5.class.getResource("MainFXMLDocument.fmxl"));
AnchorPane pane =loader.load();
primaryStage.setMinHeight(250.00);
primaryStage.setMinWidth(250.00);
MainFXMLDocumentController mainFXMLDocumentController = loader.getController();
mainFXMLDocumentController.setMain(this);
Scene scene=new Scene(pane);
primaryStage.setScene(scene);
primaryStage.show();
} catch(Exception e) {
}
}}
---------------------------------------------
*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javafxapplication5;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
/**
*
* @author bo4
*/
public class MainFXMLDocumentController {
@FXML
private Label label;
@FXML private Button button;
public JavaFXApplication5 main;
public void setMain(JavaFXApplication5 main){
this.main = main;
}
@FXML
private void handleButtonAction(ActionEvent event) {
System.out.println("You clicked me!");
label.setText("Hello World!");
}
public static void main(String[] args) {
}
}
--------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.util.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="250.0" prefWidth="250.0" xmlns:fx="
http://javafx.com/fxml/1" xmlns="
http://javafx.com/javafx/8" fx:controller="javafxapplication5.FXMLDocumentController">
<children>
<Button fx:id="button" layoutX="126" layoutY="90" onAction="#handleButtonAction" text="Click Me!" />
<Label fx:id="label" layoutX="126" layoutY="120" minHeight="16" minWidth="69" />
</children>
</AnchorPane>