Top Questions about UI Designer

I've shown the UI Designer to a few people around the shop and while they think its interesting, they have quite a few questions. I have compiled those questions into a post so that someone (hopefully IntelliJ) can answer. I'm sure my folks aren't the only ones with these questions.


1) What role is the UI Designer supposed to have. When I build the form, what am I supposed to be able to do with it as it doesn't seem to do anything by itself (I've expressed this concern myself that the feature just doesn't stand well by itself).

2) What is the path for materializing these forms in an application? Are these forms a JPanel? If so should the class they're bound to extend JPanel or something similar? If so, why doesn't the UI Designer complain about that. If not, how do you make them appear?

3) (this one is mine) Since there doesn't seem to be a path for associating events with components as is the case with other IDEs - HOW does the UI designer get events from the form it creates to events that I may create. For example if I create a JButton on a Form and also in my class then add event listeners to that JButton in my class, what mechanism is being used to intercept events on the form and deliver them to my event listener?

4) How far is the UI Designer expected to go? It seems only logical that one do the Visual Basic route and put up a code window which contains a list of all of the events that a component (like a JButton) can have and then put that code in the bind class because there really is no separation between the UI and the code since sooner or later my events need to be called and this forced disconnect is confusing.

5) How can one determine the performance of the forms since one cannot get at the code? If they are slow to load or perform in some way, then what?

6) Is the UI Designer only restricted to Swing? If we're licensing GUI components from other sources, how do we plug them into the UI designer (and this one is incredibly important).

7) If we use the UI designer, aren't we vendor bound to IntelliJ since nothing else seems to use these .forms and there is no generated source for them?

8) Where is the sample code or tutorials that explain how this stuff is to be used? Hard to test the feature if I can't figure out what its supposed to do.

9) Is it stable enough to be used for a real test as it is? I can't preview or find help on it to use it.

10) How is this approach supposed to compare to other approaches? Seems to be clean with respect to data-hiding of the GUI, but you seem to lose control. Its nice that you can layout a competent UI with the given tools - that works really well. It just seems to fall apart when you need more components that aren't apart of the given Swing set. We've written a wide variety of components and several of our applications use JDesktop which doesn't seem to be well supported.

7 comments

I don't work for JetBrains, but I can answer some of your questions.

Gregory Pierce wrote:

I've shown the UI Designer to a few people around the shop and while they think its interesting, they have quite a few questions. I have compiled those questions into a post so that someone (hopefully IntelliJ) can answer. I'm sure my folks aren't the only ones with these questions.


1) What role is the UI Designer supposed to have. When I build the form, what am I supposed to be able to do with it as it doesn't seem to do anything by itself (I've expressed this concern myself that the feature just doesn't stand well by itself).


It's for doing visual layout only. It provides you with a visual interface
for arranging components in your UI and for setting up a relationship
between particular components and variables in your code. It doesn't try to
do anything more than that; it's focus is deliberately quite narrow at this
stage.

2) What is the path for materializing these forms in an application? Are these forms a JPanel? If so should the class they're bound to extend JPanel or something similar? If so, why doesn't the UI Designer complain about that. If not, how do you make them appear?


You bind a form to a property of some class. The property is automatically
populated during the constructor invocation with a Swing component which
contains your form. You may then manipulate the form by doing any operations
you desire on that property. In particular, you'll probably want to add it
to a container of some sort.

3) (this one is mine) Since there doesn't seem to be a path for associating events with components as is the case with other IDEs - HOW does the UI designer get events from the form it creates to events that I may create. For example if I create a JButton on a Form and also in my class then add event listeners to that JButton in my class, what mechanism is being used to intercept events on the form and deliver them to my event listener?


You create the association in your own code. For each component in the form
that you have a binding for, the corresponding property of the class will be
automatically initialised with a reference to that component. In your
constructor you can then call the appropriate addXxxListener methods on
those components. There is no way to do this through the UIDesigner at
present (as mentioned above, the designer is for layout only), so it must be
done in your code.

4) How far is the UI Designer expected to go? It seems only logical that one do the Visual Basic route and put up a code window which contains a list of all of the events that a component (like a JButton) can have and then put that code in the bind class because there really is no separation between the UI and the code since sooner or later my events need to be called and this forced disconnect is confusing.


I disagree that the route you suggest is the only logical one. I especially
disagree with your contention that there is no separation between the UI and
the code. In a well designed application there is a very definite separation
between the two, IMO.

You seem to be suggesting that event handler methods get created
automatically, as is done in VB. This is not optimal for most Swing
applications, where you would rather reuse instances of action classes and
so on. By leaving this up to your source code, the UI designer gives you a
great deal more flexibility. IMO that's preferable to the dubious benefit of
having it create skeleton methods for you.

5) How can one determine the performance of the forms since one cannot get at the code? If they are slow to load or perform in some way, then what?


Two points here:
1) The UI designer does actually give you the option to see the source code.
There is an option under Project Settings which tells it whether to generate
source code or simply modify the class file directly (this applies to
whichever is the bound class for a form).
2) The UI designer only generates code for the construction of the form. If
that is slow - which is unlikely - you can look at the generated source code
to see where the problem is occurring. Any other performance is going to be
down to either your own code, or the components that you have chosen to use
in the form. That can be dealt with in the usual way.

6) Is the UI Designer only restricted to Swing? If we're licensing GUI components from other sources, how do we plug them into the UI designer (and this one is incredibly important).


Yes, it's Swing only. If the components you are licensing fit in to the
Swing framework (i.e. if they extend JPanel or some other Swing class), then
you will be able to use them with the UI designer. Otherwise, you won't. On
second thoughts, you might have some degree of success with AWT components
(I haven't tried that); SWT components will almost definitely not work though.

7) If we use the UI designer, aren't we vendor bound to IntelliJ since nothing else seems to use these .forms and there is no generated source for them?


Again, you do have the option to generate source. IntelliJ have also
provided an Ant task for compiling the forms which can be used independently
of the IDE. It was created specifically to address this question and some
other related questions. So the simple answer is no, you're not tying
yourself in by using the UI designer.

8) Where is the sample code or tutorials that explain how this stuff is to be used? Hard to test the feature if I can't figure out what its supposed to do.


http://www.intellij.org/twiki/bin/view/Main/IntelliJUIDesigner

9) Is it stable enough to be used for a real test as it is? I can't preview or find help on it to use it.


Again, see http://www.intellij.org/twiki/bin/view/Main/IntelliJUIDesigner

10) How is this approach supposed to compare to other approaches? Seems to be clean with respect to data-hiding of the GUI, but you seem to lose control. Its nice that you can layout a competent UI with the given tools - that works really well. It just seems to fall apart when you need more components that aren't apart of the given Swing set. We've written a wide variety of components and several of our applications use JDesktop which doesn't seem to be well supported.


You can add your own components to the UI designer palette and place them in
a form.

I'm not sure what you mean by "lose control". The UI designer just does the
layout of your UI and all the rest is up to your code, so I would say that
you retain a very fine degree of control.

Hope that helps,
Vil.
--
Vilya Harvey
vilya.harvey@digitalsteps.com / digital steps /
(W) +44 (0)1483 469 480
(M) +44 (0)7816 678 457 http://www.digitalsteps.com/

0

Vilya Harvey wrote:

>> 7) If we use the UI designer, aren't we vendor bound to IntelliJ since
>> nothing else seems to use these .forms and there is no generated
>> source for them?


Again, you do have the option to generate source. IntelliJ have also
provided an Ant task for compiling the forms which can be used
independently of the IDE. It was created specifically to address this
question and some other related questions. So the simple answer is no,
you're not tying yourself in by using the UI designer.


I've fiddled a bit with the UI Designer and used it to create a dialog
as part of a small app. I must say that I'm not particularly happy about
its use of a custom layout manager instead of the standard Swing layout
managers like GridBagLayout or BorderLayout.

Could JetBrains explain why they're using a custom layout manager?

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://java.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: 416-643-4846 | Fax: 416-594-1919

0

Much appreciated answers. I'll pass those off to my teammates.

Since its only a visual layout tool (which is cool for me), I don't think the rest of the folks around here will use it as their level of understanding of Swing isn't that strong. They understand what they want the UI to do, but not many of the nuances of Swing - so it looks like I may be on GUI detail a lot longer :) Many of the guys I've talked to about the tool keep saying "I just wish someone would build a Visual Basic for Java UIs." I can't say I disagree as I understand their frustration - but at least with your answers I can move forward.

0

Note, if these answers are even close to official answers, they belong in a FAQ somewhere as I'm sure my team isn't the only one confused by what to do with the UI Designer :)

0

Gregory Pierce wrote:

Note, if these answers are even close to official answers, they belong in a FAQ somewhere as I'm sure my team isn't the only one confused by what to do with the UI Designer :)


Good point. I'll add them to the IntelliJ.org TWiki when I get a moment.

Cheerio,
Vil.
--
Vilya Harvey
vilya.harvey@digitalsteps.com / digital steps /
(W) +44 (0)1483 469 480
(M) +44 (0)7816 678 457 http://www.digitalsteps.com/

0

Gregory Pierce wrote:

Much appreciated answers. I'll pass those off to my teammates.

Since its only a visual layout tool (which is cool for me), I don't think the rest of the folks around here will use it as their level of understanding of Swing isn't that strong. They understand what they want the UI to do, but not many of the nuances of Swing - so it looks like I may be on GUI detail a lot longer :) Many of the guys I've talked to about the tool keep saying "I just wish someone would build a Visual Basic for Java UIs." I can't say I disagree as I understand their frustration - but at least with your answers I can move forward.


This "VB for Java" idea is what Sun are touting Project Rave as being. I
haven't seen it, but I think there's a tech preview available somewhere.
Don't have a URL handy though - sorry. Personally I can't see it convincing
me to switch from IDEA... ;)

Glad to have helped, anyway.

Vil.
--
Vilya Harvey
vilya.harvey@digitalsteps.com / digital steps /
(W) +44 (0)1483 469 480
(M) +44 (0)7816 678 457 http://www.digitalsteps.com/

0


"Vilya Harvey" <vilya.harvey@digitalsteps.com> wrote in message
news:bpg87f$9p9$1@is.intellij.net...

This "VB for Java" idea is what Sun are touting Project Rave as being.


Poor Borland, they were only one year late, and now even an office assistant knows about VB. Ask her about Delphi ;-( ]]>


0

Please sign in to leave a comment.