> Java > tutorials > FontViewerSource
> Java > tutorials > FontViewerSource
by ZweiBieren Explore FontViewer FontViewer Logo
FontViewer screen shot at 67%
FontViewer is an application for viewing and choosing among the available fonts. Its window is shown to the right. The main table has columns for a category name, the font name, a checkmark, and a sample text shown as it appears in the named font. Atop the window are controls for the sample: its size, its style, and the sample text.  You can run FonViewer as an applet, or download it.

Written in Java, FontViewer's code illustrates many of the Java classes for interactive applications. As I wrote the code, I identified the feature that each line implements; you can view the code with or without each feature. Click here:

In the source viewer window, control buttons occupy the upper left:

"COPY" button Ordinary copy or control-C copies both the hidden and unhidden lines. To copy what is currently visible, you must use the COPY button. Click it and then paste normally into another window.
"Select All" button You can select in the text with the normal tools, including shift-click to extend the selection. This "Select ALL" button is a shortcut for selecting all the selected/viewable text.
"Grab URL" button To save or send the current view click this button and paste the resulting URL string. When your correspondent visits the URL, he or she will see then what you saw now.
"Headers" button When you  are viewing the code for only a small fragment of FontViewer, it may be unclear where it fits in the whole. This button reveals headers that demarcate the code sections.
"Help" button A link to this file.
"Runnable" button A feature is not usually an executable program. To see a program that includes all the code necessary to run the currently visible features, click this button.

The full tutorial window looks like this

FontViewer Tutorial screen image with labels

Subset Select

The buttons in this column select a subset to view. The subset and all smaller subsets are made visible; larger susbsets are hidden. Click the button again and the features of this subset are each colored in a differen color. A third click hides this subset, leaving as current the next smaller.

Roughly speaking each subset adds a feature to the fontviewer window: columns in the table or widgets at the top. The last subset is all the code; it adds code to read and restore the categories data for the first category. Each subset also includes new features which expand the capibilities of features introduced with smaller subsets.

Feature Select

Clicking a feature button cyckes the view of that feature between visible, colored, and hidden. Features can be exposed even in subsets that are larger than the current selected subset.

Jot Stripe

The jot stripe is an analog to the entire extent of the source code. Each two pixel high jot relates to 5 or six lines of the code. The visible portion of the text is represented by a blue rectangle behind the feature jots.

When a feature is colored, it may not be among the lines currently visible. Jots in the jot stripe are colored to show where the feature pieces lie. A mouse click on a jot--colored or not--will scroll the text to show the correspnding lines.

Feature on This Line

This column shows what feature this line implements. A small number of lines are needed for more than one feature, so lines may appear for features that are not selected.

Line Numbers

The lines are numbered for reference. A break in the sequence shows where lines are hidden, including headers. (There are headers that end sections, these lines are never made visible. You can check the html source if you really want to see them.)

Copyright © 2012 ZweiBieren, All rights reserved. Feb 4, 2012 16:56 GMT Page maintained by ZweiBieren