elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  Java
| | | |-+  Error de Java FX con NeatBeans
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Error de Java FX con NeatBeans  (Leído 1,984 veces)
killtrols

Desconectado Desconectado

Mensajes: 12


Ver Perfil
Error de Java FX con NeatBeans
« en: 3 Noviembre 2017, 02:17 am »

Hola buenas, he estado haciendo pruebas con NeatBeans y Java FX para probar su interfaz pero me da un error que ni siguiendo las pautas de un PDF desaparece, ya no se si es por culpa de mi NeatBeans o no, no lo se.

intuyo que el erro esta aqui:
Código:
Caused by: java.lang.NullPointerException
at flightsfx.FXMLMainViewController.initialize(FXMLMainViewController.java:81)
pero no veo nada en esa fila, lo veo todo bien

Os dejo el codigo espero que me podais ayudar. Muchas gracias y un saludo!


Código:
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: javafx.fxml.LoadException:
file:/C:/Users/killtrols/Documents/NetBeansProjects/FlightsFX%20-%20copia/dist/FlightsFX.jar!/flightsfx/FXMLMainView.fxml

at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2579)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at flightsfx.FlightsFX.start(FlightsFX.java:22)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
... 1 more
Caused by: java.lang.NullPointerException
at flightsfx.FXMLMainViewController.initialize(FXMLMainViewController.java:81)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2548)
... 17 more
Exception running application flightsfx.FlightsFX
C:\Users\killtrols\Documents\NetBeansProjects\FlightsFX - copia\nbproject\build-impl.xml:1052: The following error occurred while executing this line:
C:\Users\killtrols\Documents\NetBeansProjects\FlightsFX - copia\nbproject\build-impl.xml:806: Java returned: 1
BUILD FAILED (total time: 2 seconds)


Código:
public class FXMLMainViewController implements Initializable {
   
    @FXML
    private TableView<Flight> TV;
    @FXML
    private TableColumn<Flight,String> TVFlightNumber;
    @FXML
    private TableColumn<Flight,String> TVDestination;
    @FXML
    private TableColumn<Flight,LocalDateTime> TVDeparture;
     @FXML
    private TableColumn<Flight,LocalTime> TVDuration;
     
     @FXML
     private TextField TextFlightNumber;
     @FXML
     private TextField TextDestination;
     @FXML
     private TextField TextDeparture;
     @FXML
     private TextField TextDuration;
     
     
     @FXML
     private ChoiceBox<String> filterChoice;
     
     @FXML
     private Button ButtonDelete;
     @FXML
     private Button ButtonAdd;
     
     
    private List<Flight> flights;
    private ObservableList<Flight> currentFlight;
   
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        DateTimeFormatter dtfDate = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm");
        DateTimeFormatter dtfHour = DateTimeFormatter.ofPattern("H:mm");
       
        try {
            TV.setPlaceholder(new Label("No items to show..."));
            TVFlightNumber.setCellFactory(new PropertyValueFactory("flightNumber"));
            TVDestination.setCellFactory(new PropertyValueFactory("destination"));
            TVDeparture.setCellFactory(new PropertyValueFactory("time"));
            TVDuration.setCellFactory(new PropertyValueFactory("duration"));
           
            flights = FileUtils.loadFlights();
           
            ObservableList<Flight> data = FXCollections.observableArrayList(new Flight("054ASp","ASPE",LocalDateTime.parse("30/10/2017 01:06",dtfDate),LocalTime.parse("0:30",dtfHour)));
            TV.setItems(data);
        } catch (IOException ex) {
            Logger.getLogger(FXMLMainViewController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
   
}


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Error al Compilar en Java
Java
NaNo N´RoSeS 5 3,834 Último mensaje 8 Junio 2005, 11:28 am
por pepel
Error en Java
Java
Blitzkrieg' 8 6,476 Último mensaje 10 Septiembre 2009, 04:10 am
por Blitzkrieg'
Error Java
Java
mapers 6 4,015 Último mensaje 27 Junio 2012, 14:22 pm
por ollo
0 day java error
Bugs y Exploits
tukuyu 2 4,045 Último mensaje 5 Abril 2013, 17:01 pm
por WHK
error en java
Java
Robocop8 1 2,432 Último mensaje 17 Octubre 2017, 23:37 pm
por srWhiteSkull
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines