Changing project type is not straightforward. I suggest you migrate an old
project's source and test files to construct a new project (of different
type) the best way you can.

My experience follows.

A year or two ago I tried to change a console program into JFX 11 + JDK 11
program within Netbeans. I was updating from JDK 9 + Ant build.  I was
going to JDK 11 + Ant build, modules, separate library for JFX11 and
finishing off with building with jlink.

There were a few knowledge hurdles to jump, changing the project type was
the first one I had to clear.

I was unable work out a way to change project type that didn't create
anomalies. It would look ok at first, then I would subsequently discover
problems I didn't really understand. I need to trust the build and test
functions when jumping the other hurdles.

I wasted lots of time on this. Too much.

Netbeans does a range of things under the hood when you select a project
type for a new program. For example, the Ant build scripts or the way they
are configured changes.  I also discovered differences in the project
definition files adding and removing specific configuration settings
related to the project type; I might be describing the same thing but I'm
not sure.

In the end, I created a new JavaFX project in a new project folder, created
packages and a simple module structure (for jlink to work on). I then
copied the sources across renaming the console program's source files into
the new structure as necessary (e.g.  main to main1) . It was laborious and
a bit messy but not too bad as it was a small project and much quicker than
the time wasted so far. I then edited the source files. I deleted the main1
source file once I had copied the lines I needed across.

Emma



On Mon, 22 Mar 2021, 18:11 HRH, <hrh...@yahoo.com.invalid> wrote:

> I haven't been creating JavaFx for a few months but I didn't have any
> problems (using Maven and NB 12.0) creating FX projects. IDE created the
> FXML file and the SceneBuilder would automatically start if I clicked on a
> given FXML. Check your setup and make sure the SceneBuilder is configured
> properly.
>
>
>
> On Monday, March 22, 2021, 10:14:30 PM GMT+4:30, Will Hartung <
> willhart...@gmail.com> wrote:
>
>
> What does it take to convince NB that a project is a JavaFX project?
>
> If you create one from the Wizard, then the IDE knows about FXML files. It
> has options to create them, if you double click on one it launches
> SceneBuilder, etc.
>
> If you create a plain Java Maven project, it doesn't know about any of
> those things. For example, you can not create an FXML file with the New
> menu.
>
> Adding java fx dependencies doesn't do anything to the IDE.
>
> Now, I've "uplifted" a normal project a little bit.
>
> Part of a FXML project is a custom nbactions.xml file. This, most notably,
> leverages the maven javafx:run goal instead of generic main class method.
>
> I think when I added this nbactions.xml file, the IDE now became more
> aware of JavaFX. Now, many of the JavaFX specific things show up in the New
> menu and wizards.
>
> But I still can not double click on an FXML file and launch SceneBuilder.
> So, I'm missing some other link.
>
> Any idea how I can make that final connection? And where is it manifest? I
> don't see any hidden files, or any files I can not explain differing from
> one project to another. Is there another place project specific information
> is stored besides within the project directory itself?
>
> Thanks.
>
> Regards,
>
> WIll Hartung
>
>

Reply via email to