NetBeans MVC support?

C

Consty

I'm curious how one deals with large GUI based Swing applications
using NetBeans? Typically from my understanding you use a model-view-
controller technique to separate it all to easily have Frames talk to
other Frames and etc. From messing around in NetBeans it doesn't seem
like you can do that. You can't change generated code either. The
only way I could really seem to do it was to declare a reference to
the other Frame I wanted and pass that into a constructor or just
allocate it within the current frame and call setVisible(). This
isn't the right way I believe and I'm sure there is a way around this
or something I'm not seeing. I'm only interested in figuring out how
to do it with NetBeans and not manually without NetBeans. I know you
can write the code yourself without it. Thanks in advance!
 
E

Eric Sosman

Consty said:
I'm curious how one deals with large GUI based Swing applications
using NetBeans? Typically from my understanding you use a model-view-
controller technique to separate it all to easily have Frames talk to
other Frames and etc. From messing around in NetBeans it doesn't seem
like you can do that. You can't change generated code either. The
only way I could really seem to do it was to declare a reference to
the other Frame I wanted and pass that into a constructor or just
allocate it within the current frame and call setVisible(). This
isn't the right way I believe and I'm sure there is a way around this
or something I'm not seeing. I'm only interested in figuring out how
to do it with NetBeans and not manually without NetBeans. I know you
can write the code yourself without it. Thanks in advance!

Write your model class, and then specify an instance of it
in the "model" field of the property sheet of the JWhatever.

Two JFrames (or in Jeneral, two JWhats) usually shouldn't
talk to each other anyhow. Instead, they should talk to the
same model instance: frame F1 updates some value in the model,
and F2 learns about it because it's listening for model changes.
F2 never knows (nor should it need to know) that the change was
caused by something F1 did; as far as F2 is concerned, the model
might have decided to make the change on its own initiative,
after a timer expired or something.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top