![]() |
steveclaflin.comkeyFinder.jsA JavaScript tool that helps navigate the Java API documentation.Developed and Copyright © 2002 - 2007 by Steve Claflin |
---|
keyFinder enables fast searching of the class list in the lower left frame. It also provides for fast method searching, and hot-keys to jump to Fields, Constructors, Inner/Nested Classes, and Methods in the current class page.
Currently freeware licensed freely for use on your own system, but not for distribution to others.
It works with the Sun JDK 1.3, 1.4, and 1.5 docs in IE5/6/7, Firefox, Netscape 4.7/8, and Mozilla 1.1 on most Windows versions Win98 and later, and I believe in Linux as well.
Jump to downloads.
keyFinder will now work with the JDK 1.5 docs. There are several issues that you need to address, though:
onLoad
event handlers to the frameset tags, which both fire off the
same JavaScript function. The installation instructions reflect this issue.Later versions do not necessarily support Netscape 4.7 – I now test only in IE6/7 and Firefox. I haven't tested other all combinations of JDK versions, earlier browser versions, operating systems, and other browsers such as Opera.
After installing the script, you can:
Type a class name or the first few letters and the lower left pane (the class hyperlink listing) will scroll to that item and highlight it. (In general, it will jump to whatever class it has identified as first match or, failing a match, the first one after the string you typed.) Use only lowercase letters; the Shift key is used in hot-key combinations listed below.
There is no text box you just start pressing keys (or you can use the form-based approach, which provides a text box to type a name into).
If you type enough characters that you have reached the class you want, you can hit Enter and the right frame will change to that class page. If you got close, you can use the Up and Down arow keys to navigate up and down the list as well.
If you hit Shift-F, the right page will jump to the fields section, Shift-C will jump to constructors, Shift-M will jump to methods, and Shift-I or Shift-N will jump to inner (nested) classes.
Pressing the asterisk (*) key will switch to find methods mode, where your typing brings you to the methods list and scrolls to a method whose name matches what you typed. Pressing the asterisk again will return to find classes mode. There is no provision for finding overloaded versions of the same method name.
Pressing the asterisk again returns to normal mode. (Version 2.08 will make it clearer that you are in find methods mode by highlighting the selected method, and also enable UP and DOWN movement in the methods list.)
In IE, if you want to copy text from the page, you may need to pause the timer by pressing Shift-P. To resume normal operation, press Shift-P again. (Or, you can select text using the mouse, then use Ctrl-C wthout releasing the mouse button. That should achieve the copy and you can then release the mouse.)
Note that the script works on a timer if you stop typing for
a second it will reset (i.e., after a second it will start a new search rather
than continue the current one). The time delay can be customized by changing
the line that reads var keyTimeout = 1000;
to use a different number (the number is in milliseconds, so 1000 = 1 second).
Also, sometimes you may have to wait a second or two and try again there is additional code on a timer that refreshes the script so that the code works after switching class pages.
If you hit an incorrect character, hitting the Escape key will clear the finding process so you can start again (or you can wait for the automatic clearing based on
keyTimeout
).You may also need to click on a blank spot within a page to initiate keyfinding, especially if you switched to a different application window and then returned. At one time I had the timer reset focus to the page, but that had annoying side effects.
To work with a package listing, select the package from the links in the upper left window. Then refresh the entire browser window. This should reinitialize keyFinder, but leave you on the package page.
Zip files contain the JavaScript file, a modified version of this page, the optional form page, and several examples of how it can be installed into the index page. To work with JDK 1.5, you may need the FixJavadocHtml.java file to repair the doc files.
Current Version: 2005-08-26 keyFinder 2.062 Now works in JDK 1.5.
Companion file: FixJavadocHtml
Also fixed a bug that made it not work correctly in unsorted mode.
Note: from this point on, all versions will include the version information as part of the file name. Although that makes the instructions below dependent on the version you are using, it makes my life a lot easier since I don't have to worry about which version I actually included in the zip file.
Will not work correctly unless the class listing is sorted (even though JDK 1.5 reverted to the case-insensitive sort order).
Not recommended: 2.04 beta: download keyFinder 2.04 beta.
2.03 beta: download keyFinder 2.03 beta.
The 2.02 beta version is still available: download keyFinder 2.02 beta.
The 2.01 beta version is still available: download keyFinder 2.01 beta.
The 2.0 beta version is also still available: download keyFinder 2.0 beta.
<
and >
keys for up and
down).The original version is also still available: download keyFinder 1.01.
Unzip the keyfinder.zip file into the docs\api
directory under your jdk directory. (You need the keyFinder.js
file, and, if you wish to use the form based approach, keyFinderForm.html
as well, in that location. The other html files are a copy of this file
and examples of how to set up the form-based approach.)
Then edit the index.html file in that directory by adding
the following line in the <HEAD>
section, under the </TITLE>
line (note that the file name depends on the version prior to 2.062 it was just keyFinder.js).:
<script src="keyFinder2062.js"></script>
Make the following edits, depending on whether you want a control frame or not:
For the standard approach, without an extra control frame, change the
first two <FRAMESET>
tags to read (note the removal of the second
onLoad
attribute from the second one):
<FRAMESET cols="20%,80%" title="" onLoad="top.loadFrames();init();">
<FRAMESET rows="30%,70%" title="">
For the frames approach, you can add a tag to create a new frame anywhere in the frameset structure; I would recommend one of the following three ways (add the bolded code in the context shown):
</HEAD>
<FRAMESET rows="50,*" onLoad="init();">
<FRAME src="keyFinderForm.html" name="keyFinderFrame" scrolling="no">
<FRAMESET cols="20%,80%" title="" onLoad="top.loadFrames()">
skip to the bottom, then:
</FRAMESET>
</FRAMESET>
<NOFRAMES>
</HEAD>
<FRAMESET rows="*,50" onLoad="init();">
<FRAMESET cols="20%,80%" title="" onLoad="top.loadFrames()">
skip to the bottom, then:
</FRAMESET>
<FRAME src="keyFinderForm.html" name="keyFinderFrame" scrolling="no">
</FRAMESET>
<NOFRAMES>
</HEAD>
<FRAMESET cols="20%,80%" title="" onLoad="top.loadFrames();onLoad="init();">
skip to the bottom, then:
</FRAMESET>
<FRAMESET rows="50,*">
<FRAME src="keyFinderForm.html" name="keyFinderFrame" scrolling="no">
<FRAME src="overview-summary.html" name="classFrame">
</FRAMESET>
</FRAMESET>
<NOFRAMES>
Then you should be able to pull up the API index page and use the script to navigate through the class pages.
Give it a try I'd be interested in any feedback or suggestions you might have.
Queued for development/enhancement:
JavaScript Training and Java Training
Return to home page.