Accessing and Using the Javadocs
One of the primary sources of documentation for the WPILibJ code is the Javadoc documentation generated from specially formatted comments embedded throughout the code. This document will explain what it contained in these documents, how to access them and how to connect them to NetBeans when developing code.
Overview of Javadoc
Javadoc is a tool used to generate HTML documentation from Java source code. This documentation contains summaries of classes and methods, descriptions of parameters and return values, information about deprecated classes and/or methods and details about hiearchy of classes.
Finding the Javadoc
The Javadoc documentation for WPILibJ is installed with the FRC plugins. To locate the Javadoc, browse to your User folder (on Windows 7 this is C:\Users\*Username*), then browse to sunspotfrcsdk/doc/javadoc. Double click on the index.html file to open it in your default webbrowser.
Navigating the Javadoc
The Javadoc HTML pages have 4 main components:
- Package Browser - This pane is visible on all pages and allows for browsing to the page for any of the packages in the API
- Class Browser - This pane is visible on all pages and allows for browsing to the page for any class in the API
- Nav Bar - This bar is visible at the top of every page and allows for browsing to a few main overview pages
- Main Display - This is the portion of the page that changes to display the appropriate information for each level of the Javadoc
Linking the Javadoc to the Library in Netbeans
It is also possible to access the Javadoc for a particular package, class or method from Netbeans. To do this, first the Javadoc must be linked to the library:
- Click Window
- Hover over Other to expand the menu
- Select Javadoc to display the Javadoc window in the bottom pane
- Highlight a class, method or package from WPILib
- In the bottom pane, click the Attach Javadoc... link
- In the dialog that appears, click Browse
- Browse to the Javadoc folder *USER*\sunspotfrcsdk\doc\javadoc then click Add ZIP/Folder
- Click OK.
Accessing the Javadoc from Netbeans
There are a few ways to use the Javadoc from within Netbeans:
- Select the desired package, class or method name, right-click and select Show Javadoc. This will launch your default web browser and navigate to the Javadoc for the selected item.
- Highlight the desired package, class or method name and click on the Javadoc tab in the bottom pane (if this tab is not present you can re-add it as shown in the step above)
- When using code completetion, hover over an item in the list and the Javadoc will be shown.