Menu

#17 bad generated code when setting layout of frame to BoxLayout

open
nobody
None
5
2004-07-29
2004-07-29
No

Operating mode:
1. Creates a new v4all file
2. Add a JFrame in the GUI editor
3. In the properties pane, in the category Container,
in the field Layout, select BoxLayout from the combobox
4. Add a JPanel in the JFrame
5. Click on the button "Generate code for Swing and run"

Expected result:
the frame is displayed in the center of the screen

Obtained result:
There is an error: "java.awt.AWTError: BoxLayout can't
be shared..." and the code is not executed.

Explanation:
In the class Gui_1, in the method
getFrame100ContentPane, there is the following line:
ivjFrame100ContentPane.setLayout(new
javax.swing.BoxLayout(this, javax.swing.BoxLayout.X_AXIS));

This line is incorrect. v4all should generate the
following line:
ivjFrame100ContentPane.setLayout(new
javax.swing.BoxLayout(ivjFrame100ContentPane,
javax.swing.BoxLayout.X_AXIS));

As it is an automatically generated part of the code,
it can not be changed by the developper of the GUI
without being overwritten by v4all at the next code
generation.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB