For highlights on groups and shadows, generated code, and events, see A Groups and Shadows Quick Start Guide.
Here is an example of how to set the label on an AWT component, such as a button:
Button myButtonBody=(Button)gui.myButton.getBody(); myButtonBody.setLabel("New Button Label"); String theLabel=myButtonBody.getLabel();Here is an example of how to call a method on a bean. In this example the bean is called Pinto.
Pinto myPintoBody=(Pinto)gui.myPinto.getBody(); myPintoBody.createBurrito("Hot sauce");
public class Button extends Group implements ActionListener { ... private Button myButtonBody; public void createGroup() { myButtonBody=(Button)gui.myButton.getBody(); myButtonBody.addActionListener(this); } public void actionPerformed(ActionEvent e) { if (e.target == myButtonBody) { // code to handle the event here } } }
As soon as you register a listener on a component, the operations you defined for the same component using the Operations dialog box will not operate. The reason is because the code generated for the operations are in the JDK 1.0 style events.
The Message filters in the Filter dialog box does not translate well to the JDK 1.1 event style. You should use the JDK's event listener mechanism to implement the equivalent functionality.
For an example of how to create and use beans in the JDE, see Tutorial Eight: Creating the Clock Project.