Javabean 101 6

zhaozj2021-02-11  190

Create bean

At the beginning, we selected Juggler beans from Toolbox and put it in an empty beanbox window.

1. Click Jugger Bean in Toolbox to select it. It is noted that the cursor changes to a cross shape at this time. 2. Stay the cursor somewhere in the Beanbox window, then click the mouse. In this way, a Juggler bean is inserted in Beanbox. The boxes of Juggler highlight the display indicate that Juggler is the bean currently selected. Next, we will join the button to control Juggler. This button bean is an instance of an OurButton Bean class. 3. Click OurButton Bean in Toolbox, then put an instance of the button in Beanbox. This button is selected in Beanbox so that the attribute of the button is displayed in the attribute table. 4. Edit the tag domain of the button in the attribute table of the button so that the tag of the button is "start". Note: In Beanbox, the text on the button has changed from "Press" to "start" from "PRESS". 5. In the Edit menu of Beanbox, select a action event sent by the start button. Be sure to select the start button before selecting the event action. Note that once you choose the ActionPerformed menu item, Beanbox has entered the next new state: At this time, a red straight line is generated from the start button and moves as your mouse moves. This indicates that the button is a source bean that sends events. The next action should click on the mouse on the target bean, and the corresponding event processing method is defined on the target bean. In this example, the target bean is Juggler Bean. 6. Drag the straight line to the Juggler bean, and release the mouse button, there will be a dialog box that lists the various event processing methods defined by the Juggler bean. 7. Select the startjugling method, then click OK. Now, once you click the Start button, Duke starts to throw coffee beans like a professional acrobatic performer. In Juggler's Property Table Editor, you can manually set the property value of the label called AnimationRate, so you can control the speed of Duke to abandon the coffee beans. In order to ensure that the properties table editor corresponding to the bean, in the Beanbox framework, the currently selected bean must be Juggler.

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

New Post(0)