Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Custom Component
Custom Component [message #615106] Wed, 07 March 2007 11:20
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
container.
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();
jLabel.setText("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();
jLabel.setText("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 and Best Regards,
Shobana
Previous Topic:Custom Component
Next Topic:RWP support
Goto Forum:
  


Current Time: Fri Apr 19 13:42:57 GMT 2024

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

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

Back to the top