This chapter presented the Browser project, a powerful custom browser that uses the Standard Widget Toolkit's Browser widget to display a browser from Java code. This project relies on the SWT, IBM's proposed successor to the Java AWT and Java Swing. The SWT has a great deal of support written in native code for various platforms, which makes it fast and lets it take advantage of native resources such as built-in controls. To use the SWT, you have to make sure Java can reach that native support, so running programs that use the SWT take an extra stepyou have to point Java at the right native-code library. The Browser project presents the user with a toolbar full of buttons, a Text widget, and a browser window. The browser window in this case displays Internet Explorer and lets the user see the fully formatted text and images of web pages. The user can also navigate to a new URL simply by entering that URL into the Text widget and clicking the Go button, or just by pressing Enter. He can navigate forward and backward in the browser's history with the Back and Forward buttons. The user can refresh the browser's display with the Refresh button, just as in a standard browser, and he can stop the browser's current operation with the Stop button. All in all, an impressive and fun addition to any program. Want to direct the user to a location on the Internet? Don't just give him a URL and expect him to do the resttake him there yourself with the Browser project. |