Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » When a component is dropped in VE
When a component is dropped in VE [message #615097] Fri, 02 March 2007 11:36
shobana is currently offline shobanaFriend
Messages: 13
Registered: July 2009
Junior Member
Hi All,
I need help regarding the code generation of graphic objects such as Label
etc when they are dragged and dropped from the component palette to the
The initialization code for such object are written in to the container
‘getXXX() ‘method rather then a separate method by itself.
For Example in Visual Editor, when a Label is dragged and dropped from the
component palette on to a Panel, the default code generated for that
component is:

* This method initializes jPanel
* @return javax.swing.JPanel
private JPanel getJPanel() {
if (jPanel == null) {

jLabel = new JLabel();
jPanel = new JPanel();
jPanel.setLayout(new GridBagLayout());
jPanel.setSize(new Dimension(372, 264));
jPanel.add(jLabel, gridBagConstraints);
return jPanel;

I want to generate code in a separate method for this label component not
inside the container. Like

Private JLabel getJLabel()
If(jLabel ==null)
jLabel = new JLabel();

return jLabel;

Please help me generate the get method for the component like the label on
drag and drop action.
Also I want to add a few properties as default properties of the component
when the code is generated on the drop of the component. Is there a way
where I can get hold of the event, which adds the component to the
container. I would like to pop-up a dialog to accept the basic required
properties and generate the code accordingly.

Any help or pointer in this regard will be greatly appreciated.

Thanks You and Best Regards,
Previous Topic:When a component is dropped in VE
Next Topic:EclipseCon
Goto Forum:

Current Time: Mon Jun 18 04:17:05 GMT 2018

Powered by FUDForum. Page generated in 0.01358 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top