سؤال

I created custom pane

MyStackPane extends StackPane

When I use it in FXML

<?xml version="1.0" encoding="UTF-8"?>

<?import application.MyStackPane?>

<MyStackPane xmlns:fx="http://javafx.com/fxml>
    <!-- TODO Add Nodes -->
</MyStackPane >

ClassNotFoundException throws. How can i use it in FXML?

هل كانت مفيدة؟

المحلول

There is nothing obviously wrong with the FXML you present.

Oracle have a tutorial for creating a custom control and FXML. The tutorial links a project with source code. Read the tutorial, download the sample source and study it, then apply what you learned to your situation. The sample is really a small amount of code, but I don't want post it here because its Oracle's.

Note, you can use your custom pane from FXML in SceneBuilder, see the SceneBuilder documentation.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top