2 Replies Latest reply: Dec 12, 2012 3:22 AM by 936814 RSS

    Why abstract classes can not be used as FXML controller?

    936814
      Hi,
      using an abstract class as FXML controller generates an error:
      java.lang.InstantiationException
      at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:738)
      at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:777)
      at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:182)
      at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:565)
      at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2314)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2131)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2028)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2742)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2721)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2707)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2694)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2683)

      Simply removing abstract modifier from class makes all works properly.

      Why abstract classes can not be used?