Connection wizard can help to set events between two components within a form without having to write code manually.
Work on the exercise in last post "HelloNetBeans: Create Java Desktop Application using NetBeans IDE".
- Add a Button on Design Pane
- Right click on Button, Edit Text and enter "Click Me" as the text on the button.
![Add a Button Add a Button](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp9GxUvYC-FOSkbG2TJ8lhtQppYhWNWhbyowoT80vc7DgRVphSLnHr9GoFoZfVcD38XKpS2mHX8Vv8xKQomuDmKIGJ_ZnYR4uoq6fs9I4zacGObxKUFznOM2yM2j3c4JrP7dd4wtoUfcOr/s400/Connection+Wizard_01.png)
- Switch Connection Mode.
![Switch Connection Mode Switch Connection Mode](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJA_z1v1iVrt1ndS9jvSq9hiyPdzbvAUyJmQzoA_O4ET_1sCZI0b0bvcVzi88GuMtGJxOD7HlhpeUiUDsBR0RQGyntZnnO_TP1MA1bmuepHHGnNZA9LMgUqLGH1Ukj2KdymLEdjW_r23cY/s400/Connection+Wizard_02.png)
- Select the component (JButton1) that will fire the event, the selected component is highlighted in red when selected.
- Select the component (JLabel1) whose state you want to affect with the event.
- NetBeans will open Connection Wizard.
- Accept jButton1 as Source Component.
- Expand and select mouse -> mouseClicked as the source Events, with jButton1MouseClicked as Method Name in Event Handler Method.
- Click Next.
![Select Source Event Select Source Event](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7LClUqJz3aoUTCAJzWnc2VuTbEHbO-Pg3nSeZwzseLrlOFRe14Z47WSmjjFaGW2rv4UgkllqlNc5SkIZV3FBx-ezYtps2GV3eKD_dRB5RvCUF4nrhYKXYLacUQ44jXV4PZmUxXNJNdtTC/s400/Connection+Wizard_03.png)
- Accept jLabel1 as Target Component.
- Select Set Property.
- Select text. and click Next.
![Specify Target Operation Specify Target Operation](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1pBtUrfaH-Lgg2ZXreIfzQKq0vJyhpfiJisURkt8xXu6NiPOvPKs4CQiyaENd-M5g7NpDKmplNdlpp93AlgB_GOlofj7sWDgmNavyxmlR-r5t_AQbqdSTmpHgS021K_bC4-FYfwf1-Tb2/s400/Connection+Wizard_04.png)
- Select and Enter Value of any text you want, and click Finish.
![Enter Parameters Enter Parameters](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvnYSiHCNuxyMI04Xs-gd6T0vsdHPNXk1bTXVFKuoRtTvy3qTYynjYs-SJt3aait3pwZpJFoF2VIiKcFC0wtc-rG19R6Ce1Srg4vaad-zSkh_M6qRzBmS064FbZqOPDpfmmQRaPtrpJe1e/s400/Connection+Wizard_05.png)
- NetBeans will generate the code for you.
![Code generated by Connection Wizard Code generated by Connection Wizard](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipO5jkXnpJ8zusvT-jNXBqKqTyaiUG1aCyehGn4s_ZK2qjdiVxSAS7Vu3M7jOIANJTO_hsXiU11N86o0K_qVVnd0CRWhQX8keM5FdkHNBXuqh90rCtNtisKbE8n3nryn9ZiR5RPYwk7UqU/s400/Connection+Wizard_06.png)
- Save and Run it again.
![Application Run Application Run](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbuWDm0BAH4Mrz0HHbWFUjhV87hVwf4rA7BLo7FSxhABXD2NKx6FJDlHEAmcR2nByMVRPMV4B2Faadw7zUCX1UQOwtsysDcesxyiM09ekGnrJs4FiPRR3y5y99U00BswwKrqKTX6nGJ3Gh/s400/Connection+Wizard_07.png)
Work on the exercise in last post "HelloNetBeans: Create Java Desktop Application using NetBeans IDE".
- Add a Button on Design Pane
- Right click on Button, Edit Text and enter "Click Me" as the text on the button.
![Add a Button Add a Button](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgp9GxUvYC-FOSkbG2TJ8lhtQppYhWNWhbyowoT80vc7DgRVphSLnHr9GoFoZfVcD38XKpS2mHX8Vv8xKQomuDmKIGJ_ZnYR4uoq6fs9I4zacGObxKUFznOM2yM2j3c4JrP7dd4wtoUfcOr/s400/Connection+Wizard_01.png)
- Switch Connection Mode.
![Switch Connection Mode Switch Connection Mode](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJA_z1v1iVrt1ndS9jvSq9hiyPdzbvAUyJmQzoA_O4ET_1sCZI0b0bvcVzi88GuMtGJxOD7HlhpeUiUDsBR0RQGyntZnnO_TP1MA1bmuepHHGnNZA9LMgUqLGH1Ukj2KdymLEdjW_r23cY/s400/Connection+Wizard_02.png)
- Select the component (JButton1) that will fire the event, the selected component is highlighted in red when selected.
- Select the component (JLabel1) whose state you want to affect with the event.
- NetBeans will open Connection Wizard.
- Accept jButton1 as Source Component.
- Expand and select mouse -> mouseClicked as the source Events, with jButton1MouseClicked as Method Name in Event Handler Method.
- Click Next.
![Select Source Event Select Source Event](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7LClUqJz3aoUTCAJzWnc2VuTbEHbO-Pg3nSeZwzseLrlOFRe14Z47WSmjjFaGW2rv4UgkllqlNc5SkIZV3FBx-ezYtps2GV3eKD_dRB5RvCUF4nrhYKXYLacUQ44jXV4PZmUxXNJNdtTC/s400/Connection+Wizard_03.png)
- Accept jLabel1 as Target Component.
- Select Set Property.
- Select text. and click Next.
![Specify Target Operation Specify Target Operation](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1pBtUrfaH-Lgg2ZXreIfzQKq0vJyhpfiJisURkt8xXu6NiPOvPKs4CQiyaENd-M5g7NpDKmplNdlpp93AlgB_GOlofj7sWDgmNavyxmlR-r5t_AQbqdSTmpHgS021K_bC4-FYfwf1-Tb2/s400/Connection+Wizard_04.png)
- Select and Enter Value of any text you want, and click Finish.
![Enter Parameters Enter Parameters](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvnYSiHCNuxyMI04Xs-gd6T0vsdHPNXk1bTXVFKuoRtTvy3qTYynjYs-SJt3aait3pwZpJFoF2VIiKcFC0wtc-rG19R6Ce1Srg4vaad-zSkh_M6qRzBmS064FbZqOPDpfmmQRaPtrpJe1e/s400/Connection+Wizard_05.png)
- NetBeans will generate the code for you.
![Code generated by Connection Wizard Code generated by Connection Wizard](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipO5jkXnpJ8zusvT-jNXBqKqTyaiUG1aCyehGn4s_ZK2qjdiVxSAS7Vu3M7jOIANJTO_hsXiU11N86o0K_qVVnd0CRWhQX8keM5FdkHNBXuqh90rCtNtisKbE8n3nryn9ZiR5RPYwk7UqU/s400/Connection+Wizard_06.png)
- Save and Run it again.
![Application Run Application Run](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbuWDm0BAH4Mrz0HHbWFUjhV87hVwf4rA7BLo7FSxhABXD2NKx6FJDlHEAmcR2nByMVRPMV4B2Faadw7zUCX1UQOwtsysDcesxyiM09ekGnrJs4FiPRR3y5y99U00BswwKrqKTX6nGJ3Gh/s400/Connection+Wizard_07.png)
No comments:
Post a Comment