Netbeans module development-add Google toolbar for netbeans

Source: Internet
Author: User
Tags netbeans
Original article: http://platform.netbeans.org/tutorials/nbm-google.html
Source code: http://www.netbeans.org/files/documents/4/570/GoogleToolbar.zip
The operation is basically the same as that in the previous article.
1. See the previous article to create a project. Here, I will only put it on the toolbar.
2. on the "Gui registration" Panel, select "Global toolbar button ". Set the value.
3. On the "name, icon, and location" Panel, type "Class Name" in Google Action, And then type the Google Toolbar in "display name. In the "icon", find a 16x16 pixel Google icon in the file system.
4. create a googlepanel-like gui. Use the GUI designer to drag a jlabel and jtextfield to the Panel to change the size and layout and implement the keytyped event of jtextfield. The event processing is as follows: private void txtgooglekeytyped (Java. AWT. event. keyevent EVT )... {
// Todo add your handling code here:
Int I = EVT. getkeychar ();
If (I = 10)... {// The enter key
// We display the Google URL.
Try ...{
Urldisplayer. getdefault (). showurl
(New URL ("http://www.google.com/search? Hl = en & Q = "+ txtgoogle. gettext () +" & btng = Google + search "); // noi18n
} Catch (exception EEE )...{
Return; // nothing much to do
}
}
}

Press the Enter key and use the default browser to open the Google website to query the content you entered. The urldisplayer class is used. Add the jar package and import the corresponding classes. Please refer to the previous article.
5. Open googleaction. Java, implementation method gettoolbarpresenter returns the realistic component after the toolbar is set out: Public java. AWT. Component gettoolbarpresenter ()...{
Return retvalue;
}

Is googleaction. Java adds the attribute retvalue, googlepanel retvalue = new googlepanel ();
6. view the results. In the "project" window, right-click the project and select "Install/reload on the Target Platform ".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.