Javabean 101 7

zhaozj2021-02-11  224

Complete your program

To complete the example, add a stop button. Simply follow the above steps, repeat:

1. In the Toolbox menu, select OurButton from the existing bean, then put it below the start button in Beanbox.

Once the new button becomes the currently selected bean, the corresponding attribute editor will appear.

2. Edit the Label (label) domain in the properties table so that its text is "STOP".

3. Set the event corresponding to the STOP button to the Stopjugging method of Juggler. Note that make sure the STOP button is the current selected bean.

4. Select ActionPerformed events from the Edit / Events menu.

5. Drag the STOP button to the event line corresponding to the source bean on the target bean jugger. Click and release the mouse button to connect the two beans to the two beans line.

6. Juggler bean displays a dialog box that can be employed, select the stopjugging event, and click OK.

Now you can start or stop Juggler (juggling) by clicking the appropriate button.

to sum up

Now, you have learned how to choose a variety of beans from Toolbox and put them in Beanbox. Once placed in Beanbox, you can use the bean's property table and the property editor to change its appearance. You can also use the options in the Beanbox menu to associate a bean's event is an additional bean to initialize and control the action of Bean.

Remember, Beanbox is not an application constructor, its main purpose is to test beans and verify that the self-test and event processing work is normal. You don't use BeanBox to construct and run an application.

Instead, you can use Beanbox as a reference constructor, if your bean can run normally in Beanbox, and the results indicate that the bean generates and responds to the right event, you can be confident: this bean is other support bean Treatment tool will also work properly.

转载请注明原文地址:https://www.9cbs.com/read-4765.html

New Post(0)