1. When you want to add your own code to a form, do you just add it to the form class file (ie this is for my own functions which
are not related to the code that you enter into framework-generated events etc).
2. Where do you actually put the code to display the initial values in text fields etc (ie is there some particular event exit). I
am actually using panels in a tabbed form.
>1. When you want to add your own code to a form, do you just add it to the form class file (ie this is for my own functions which
>are not related to the code that you enter into framework-generated events etc).
There is no Form class file I am aware of. You build JPanels and
arrange them into JFrames. The JPanels have various JComponents
arrayed on them with a layout mananger. Perhaps you are confusing
Swing with HTML forms.
There are quite different ways of operationg. HTML Forms are a
primitive data input method available in browsers. Swing is a
technique used with Applets, Java Webstart or stand alone Java apps.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
It's my terminology that's confusing.
What I mean is eg a javax.swing.JDialog source file created when you create a Matisse form in say eclipse.
What I want to know is how do you know when all the fields have been created so that you can then use them.
>
>What I mean is eg a javax.swing.JDialog source file created when you create a Matisse form in say eclipse.
>
>What I want to know is how do you know when all the fields have been created so that you can then use them.
I have never used Matisse, so I don't know what sort of code it
generates. I presume you can look at it.
I would expect all the Components to be created and hooked up with
listeners in the constructor, so all should be ready to go. They might
use the addnotify mechanism.
See http://mindprod.com/jgloss/addnotify.html
see http://mindprod.com/jgloss/jdialog.html
for some background.
Yes, those links seem to be about the trouble I was having (not that I fully understand them).
I moved things around in my program and now they seem to work. Previously, I had a null parent on the dialog, now I have a hidden
JFrame which I think is the answer.
Thanks for your help.
I recommend to read Fowler's "Organizing Presentation Logic".
It describes the basic approaches for where to put what.
I provide a presentation at www.jgoodies.com/articles/
"Desktop Patterns & Data Binding" that adds some Java/Swing
related diagrams to Fowler's text.
You may also consider studying some of the tutorial sources
from my open source JGoodies Binding. There you can see how
a (stupid) view class is associated with a presentation logic
class that contains all the meat. The "EditorCopyingExample"
does not really use an automatic data binding, and so is the
simplest example, which may be good for a starting point. See
http://www.jgoodies.com/downloads/libraries.html
Get the Binding, extract it, look at "src/tutorial".
-Karsten