Quote:
Originally Posted by paulsm4
I have no idea if you're looking for "GUI-building tools for Java", GUI-based tools that use "Java reflection" (perhaps analogous to .Net Reflector?), an IDE for Java (of which, frankly, I like NetBeans. But perhaps you might prefer Eclipse?) or something else entirely.
|
None of those is quite what I'm looking for, sorry if I wasn't clear! What I'm looking for is a Java method which takes an object as a parameter and, provided the object's class definition follows appropriate naming conventions etc, returns a GUI component which can be used to edit the object.
I'm thinking, for example, that for any pair of getXXX / setXXX methods in the object's class definition, the returned component would have a subcomponent for editing the corresponding field: a checkbox for boolean fields, perhaps a slider or spinner for numbers within a fixed range, a textfield for field types which can easily be represented as text (numbers, dates, file paths, etc). The subcomponent would have an event listener which called the corresponding setXXX method.
Probably it's only possible to build a fairly simple GUI this way, but I'm not too concerned about it looking super-pretty. The programs I write at home tend to be small and I don't want to spend lots of time writing GUI boilerplate. I find even writing a small panel with only a few components takes more time and code than it should for something so simple, and it puts me off writing GUIs entirely. Sometimes it's nice to have one though!
At work we have a somewhat similar system to what I just described, but what it actually does is to generate source code for both the object to be edited and the GUI component, so you end up with a separate class for each GUI component instead of just creating the component dynamically. This seems fairly inefficient when you can perfectly well examine an object's methods at runtime.
As for IDEs, I'm a fan of Eclipse, having just started using it a few months ago. But I certainly don't want to insult any NetBeans users! I've never actually seen it, I've just heard vague complaints about it from a few other people, and some screenshots I saw of it looked a little dry. Sun's own JavaBeans tutorial mentions NetBeans fairly early on, so I thought the two were related (well, that and the name pointed to that conclusion).
It does seem as though some JavaBeans concepts are pretty close to the dynamic gui-creation I described above, but it's still not clear to me whether there is any way to take a Jave "Bean" and dynamically create a GUI editor component for it, independent of the NetBeans GUI builder and without generating source code.
Hope that makes things a bit clearer!
OS