GUI

Hello,

i have designd a small test-gui with the formdesigner. It goes quickly
and simple. But how can i generate the source, or how can i run the
form?

--
Greetings from Germany
Roland Kruggel

5 comments
Comment actions Permalink

To run it, it should have a main that looks kind of like this:

public static void main(String[] stringArr) { GUITest guitest = new GUITest(); JFrame jframe = new JFrame("Testing IntelliJ UI Designer..."); jframe.getContentPane().add(guitest); jframe.pack(); jframe.show(); return ; } ]]>

Compile the class and run it and you will see your screen. You can also use the preview button in the UI editor tool bar to see what the screen will look like.

As for source, in project properties there is a control panel for tye UI Designer that tells it to produce source code instead of doing byte code instrumentation. The code that it produces functions, but it is ugly and completely uncharacteristic of what i have come to expect out of the JetBrains crowd.

Fortunately Idea and the UI Designer are open enough that I was able to write a plugin that generates source code from the .form file that is readable. Im' getting ready to release a newer version (0.6) of it that has the option to produce code that uses Swings GridBagLayout instead of Ideas home grown GridLayoutManager. There is nothing wrong with Idea's Layout manager but using it requires that you distribute form_rt.jar, selecting the "Use Swing GridBagLayout" option removes that restriction.

If you want to check it out, you can grab it from http://www.intellij.org/twiki/bin/view/Main/IntelliJPluginsHome. I haven't tried installing it using the Plugin Manager yet, so I don't know if that works (i.e I don't know if the plugin is set packaged properly for the plugin manager to do it's thing).

0
Comment actions Permalink

Hello,

i like the idea of generating code containing only standard components. I tried with a test form written by myself and the example from Intellij - both definitions producing the following message:
"Form element must contain one grid element." Both forms are running fine when using the preview function, except having a problem with resource bundles.

Regards

Reto Badertscher

0
Comment actions Permalink

The message means tha you have not set a layout manager for one of the JPanel's. Look at the .form file and see if it looks like this:

Note the first child of the form element, the xy element. This is how a JPanel is represeted in the .form file before a laout manager has been applied to it. You apply a laout manager by selecting the JPanel in the tree view and pushing the third, fourth, or fift btton from the left on the UI Editor Menu bar. This will cause the xy element to change to a grid element. If that doesn't fix the problem please post the .form file. BTW, a JPanel that has had a layout manager applied to it looks like the following:

]]>


If you feel that the edits on the .form file are wrong, you can disable them in the project properties, but doing so might case the plugin to throw an exception.

0
Comment actions Permalink

On Fri, 02 Jan 2004 16:19:26 +0000, Ralph Saunders wrote:

Fortunately Idea and the UI Designer are open enough that I was able to
write a plugin that generates source code from the .form file that is
readable.


What would be good is to make the code-gen pluggable, so you're plugin
could add an option to the UI Designer options page saying "use this
code-gen".

0
Comment actions Permalink

I'd be happy to support that if JetBrains was also willing to support it.

0

Please sign in to leave a comment.