Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 9875 - JTabbedPane code generation incorrect.
JTabbedPane code generation incorrect.
Product: guibuilder
Classification: Unclassified
Component: Code
PC Linux
: P1 (vote)
Assigned To: Tomas Pavek
Depends on:
  Show dependency treegraph
Reported: 2001-02-27 19:51 UTC by Neal Sanche
Modified: 2003-06-30 18:28 UTC (History)
0 users

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description Neal Sanche 2001-02-27 19:51:46 UTC
When adding panels to the JTabbedPane the code generation incorrectly adds a
setLayout(new BorderLayout()) to the code after the panels have been created,
causing the panels to appear empty when the code is compiled.

Some example generated code is as follows:

        searchPanel.setLayout(new java.awt.BorderLayout());
        tabbedPane.addTab("Search", searchPanel);
        downloadPanel.setLayout(new java.awt.BorderLayout());
        tabbedPane.addTab("Download", downloadPanel);
        uploadPanel.setLayout(new java.awt.BorderLayout());
        tabbedPane.addTab("Upload", uploadPanel);
        sharingPanel.setLayout(new java.awt.BorderLayout());
        tabbedPane.addTab("Sharing", sharingPanel);

This appeared in recent development builds, somewhere before dev-133.
Comment 1 Tomas Pavek 2001-02-28 18:36:12 UTC
Those searchPanel, downloadPanel, etc. - I suppose they are of some separate 
classes (not JPanels designed in the same form)? If so, then they should be in 
ComponentPalette, so you can set their "isContainer" properties to false (as 
they have its own content, you don't want use them as container for further 
components). Does this workaround work?
Comment 2 Neal Sanche 2001-03-01 14:08:29 UTC
The panels are separate beans, and I've not been using the component palette.
What I do is do a 'copy' on the object, and paste it into the tabbed panel. I
will try your workaround, and let you know.
Comment 3 Neal Sanche 2001-03-01 14:26:55 UTC
Okay, I added the panels to the Component Palette, went into Options|Component
Palette, changed the isContainer property to 'false' for all of the beans, and
dropped them into the JTabbedPane, and everything worked great. I was even able
to see the underlying GUI, great job on the new designer.

Would it make sense to allow the user to change the 'isContainer' property from
the Component Inspector? Perhaps under 'Code Generation'? Then my cut and paste
would work, as long as I knew to set the isContainer property to false in Code
Generation for that component. Just a thought. The current workaround, although
cumbersome for me (I rarely use the component palette for this kind of work),
will keep me happy for now.

Comment 4 Tomas Pavek 2001-03-01 18:24:24 UTC
I've also fixed the redundant setLayout(...) code generation (if layout is not 
changed). I've added the suggestion to set "isContainer" property from 
Component Inspector to bug 6756, which is our "reference" bug for 
the "container beans problem".
Comment 5 Tomas Pavek 2001-03-01 18:24:36 UTC
So this bug can be marked fixed.
Comment 6 Marian Mirilovic 2001-03-07 15:37:59 UTC
verified in[nb-dev](137), [pilsen](010306)
Comment 7 Quality Engineering 2003-06-30 18:28:22 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo