문제

Q: Help me identify what's causing the error, and hopefully getting the toolbar to work.

I'm trying to take the FXML-version from this page: Difference in my java-class from link1:

  1. It's not a main-class.
  2. It does not extend Application but HBox or anything if it would work.
  3. Error message: "javafx.fxml.LoadException: javafx.fxml.JavaFXBuilder$ObjectBuilder does not have a default property."
  4. Well, here the class is:

    public class MainWindow implements Initializable { private ResourceBundle rb;

    final static boolean RIGHT_TO_LEFT = false;
    
       //FXML ATTRIBUTES
        @FXML
        private OverviewTab owContent;
        @FXML
        private StatisticsTab statisticsContent;
        @FXML
        private SettingsTab settingsContent;
        @FXML
        private Polygon dock_bottom;
        @FXML
        private TabPane tabpane; 
        @FXML
        private Tab owTab;
        @FXML
        private Tab statisticsTab;
        @FXML
        private Tab settingsTab;
        @FXML
        private Button helpButton;
        @FXML
        private Button updateButton;
        @FXML private Button task;
    
    
    /**
     * Create the application.
     */
     @Override
        public void initialize(URL url, ResourceBundle rb) {
         this.rb = rb;
            // Adding Swing style of custom Listener
            tabpane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
                @Override public void changed(ObservableValue<? extends Tab> observableValue, Tab oldTab, Tab newTab) {
                    if(newTab.equals(owTab)){
    
                    }
                }
              });
         //statisticsContent.addListener(this);
        owTab.setText(rb.getString("overviewTab_headline"));
        statisticsTab.setText(rb.getString("statisticsTab_headline"));
        settingsTab.setText(rb.getString("settingsTab_headline"));
     }
    

    }

도움이 되었습니까?

해결책

The author of the tutorial you are referencing, mentions the error and provides solution to it in his next post/tutorial. See ToolBar in FXML No Longer Requires tag. I think you are facing the same problem.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top