Aha, ok, thanks very much. That's really helpful.
Thanks a lot (for all) the suggestions, and then to Antonio for pointing
out the Beans.isDesignTime() method, I'll do it this way.
Much appreciated
/Jonathan

On Mon, Sep 9, 2024 at 9:00 PM Antonio <anto...@vieiro.net.invalid> wrote:

> Hi Jonathan,
>
> Java Beans in GUI editors can check if they're being used in a
> "construction environment" (sic) by using the static method
> "Beans.isDesignTime()" [1].
>
> Of course, NetBeans honors the "Beans.isDesignTime()" call, so:
>
> - Beans.isDesignTime() == true iff you're instantiating your Java Bean
> inside the Form Editor, and
>
> - Beans.isDesignTime() == false iff you're instantiatng your Java Bean
> in your application.
>
> What people usually do is to check if "Beans.isDesignTime()" in
> constructors or static initializers, and make the Bean behave
> differently in these cases. When running inside the Editor you may
> display a static image, for instance (in order to avoid loading 3D
> native libraries, for instance) in order to speed-up gui development
> without loading many classes, and when running in your app then you have
> the whole 3D libraries loaded and the full fledged bean behaviour.
>
> Hope this helps,
> Antonio
>
>
> [1]
>
> https://docs.oracle.com/javase/8/docs/api/java/beans/Beans.html#isDesignTime--
>
>
> On 7/9/24 12:20, Jonathan Bergh wrote:
> > Hi
> > I have built a reasonably large app using Netbeans and used the form
> > designer to do a lot of the heavy lifting and boiler plate which has
> > been great.
> >
> > The time has come to integrate the 3D viewer parts, which I
> > "boilerplated" as a JPanel extension and intended to include this in one
> > of the main app tabs. It turns out that, because VTK needs a bunch of
> > libraries loaded (I am using a static block), NB Form designer either
> > breaks or refuses to load the JPanel because of the exceptions thrown
> > when trying to initialise the panel. The reasons for the exceptions are
> > because the java.library.path to the VTK .so's is only set by NB (or the
> > Maven NB executor?) at runtime (ie when the run button is clicked).
> >
> > I was wondering whether there was any way around this, 1) I would really
> > like to continue using the Form designer, as its been such a powerful
> > tool so far, and 2) whether this is potentially something that could be
> > solved with a patch to the form design code - ie could it read the
> > command line args from the Properties tab when its bootstrapping the
> > previews for the forms, or something like that. I dont know the NB code
> > base well enough to make a very educated suggestion here, except to
> > highlight the problem (that the -Djava.library.path=pathToVTKInstall)
> > set in the Project Properties is only read by Netbeans when the app is
> run.
> >
> > Thanks a lot
> > Cheers
> > /Jon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@netbeans.apache.org
> For additional commands, e-mail: users-h...@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

Reply via email to