GUI Designer does not generate code for layout???

I tried the GUI designer yesterday, somehow it didnt generate the code for swing layout??? I found that it only created the private fields for the swing components added to the jpanel? the tutorial in the context help isnt helpful and not comprehensive enough...

I tried with the ui structure like this:
- JPanel
-- JTextField
-- JTextField
-- JButton
-- JButton

And the the following code generated, but where are the code for layout, something is missing???

Thanks for your help, i appreciate any help given here...

import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class class1 extends JPanel{
private JTextField text1;
private JTextField text2;
private JButton button1;
private JButton button2;

public class1() {


public void setData(testBean data) {

public void getData(testBean data) {

public boolean isModified(testBean data) {
if (text2.getText() != null ? !text2.getText().equals(data.getT3()) : data.getT3() != null) return true;
if (text1.getText() != null ? !text1.getText().equals(data.getT1()) : data.getT1() != null) return true;
return false;

1 comment
Comment actions Permalink

That's how it works.

Theere is a .form file which contains the layout information . During the compilation idea compiles the layout into the class file.

Therefore if you want to compile your project with Ant you have to use the javac2 task from IDEA to generate the right class. You have to have javac2.jar from the IDEA redist/ directory in your path to use it. Then the following lines will do the compilation in Ant:
If you feel uneasy about this magic class enhancement, you can change this behaviour and make IDEA generate the code into the bound class (Click on the "Java source code" radiobutton in File->Settings->]]>GUI-Designer ).


Please sign in to leave a comment.