JClass Elements

PreviousNextIndex

1

Introducing JClass Elements

How the Manual is Organized  Components and Layout Managers  Internationalization 


1.1 How the Manual is Organized

For the most part, each chapter is devoted to a single component. This makes it easy to find a component or utility, and makes it easy to review its structure and usage. In very few cases, utilities that are very closely related are covered in the same chapter.

You're reading Part I right now. You'll find JClass Elements's Graphical User Interface (GUI) components and layout managers in Part I and JClass Elements's utility classes in Part II.

This chapter contains a general description of each GUI component and layout manager in the product.


1.2 Components and Layout Managers

It's as easy to use a JClass Elements component in your program as it is to use a Swing component. Where you would reference a JComponent if it were part of Swing, you instead reference a JCComponent, after making sure that the JClass Elements packages are on your CLASSPATH.

Some of JClass Elements's components, like JCMDIFrame, augment the standard Swing components. Others, like JCFontChooser, provide a new component, one that is not part of the standard Swing package. Either way, they add functionality.

Here's a brief note on each component or layout manager:

Component Name

Description

JCCheckBoxList

This component lets you show a columnar list of items. A check box appears at the left of each item. A mode switch lets you set the selection policy between (a) only one box at a time, (b) a contiguous range, or (c) any group whatsoever. You can implement the javax.swing.event.ListSelectionListener interface to respond immediately when a user checks a box.

JCCircularGauge
JCLinearGauge

A graphical component for setting and displaying one or more quantifiable values. GUI designers may create innovative linear sliders and progress meters having a distinctive and unique flavor. JCCircularGauge makes it easy to create switches and dials for setting discrete values, as well as circular gauges for monitoring and setting a continuous range of values. JCLinearGauge vastly expands your design choices for linear interactive displays that have the same flexible functionality as the circular gauge.

JCDateChooser

This component provides a convenient way of viewing and setting calendar information. The days of the month appear as a standard monthly calendar, the year is in a spin box, and you have a choice of a spin box or a pop-down list for the month.

JCExitFrame

 

A frame that responds to window-closing events either by exiting or by becoming invisible.

JCFontChooserPane

JCFontChooser is the abstract base class for JCFontChooserBar and JCFontChooserPane. It provides common data and methods for both components. Place one of these in any application where you want to let the end user choose fonts.

JCHTMLPane and JCHelpPane

Ease of use is the key feature for these two components. Simply pass an HTML-encoded file to the pane and you have a mini browser. JCHelpPane supports up to three JCHTMLPanes and provides basic navigation buttons, allowing you to implement a simple HTML-based help system. The left pane functions as a table of contents, and the right pane shows the help pages.

JCMDIFrame and JCMDIPane

Multiple document windows are great where multiple views of some multi-faceted object may be required, or multiple forms need to be simultaneously present in a window. The JClass versions optimize space by managing the active window's main menu bar, while providing the standard window-management options.

JCMultiSelectList

JCMultiSelectList matches the API for JList except that two lists instead of one appear in the component's GUI. There are four buttons in between the list areas that move items between the lists. The left-hand list contains non-selected items and the right-hand list contains the selected items.

JCSpinBox

Swing provides checkboxes and radio buttons, but no spin boxes. The JClass spin boxes fill the need for components that let the user select a number or a String by clicking on up- or down-arrows.

JCSpinNumberBox

Use JCSpinNumberBox for incrementing and decrementing objects of type java.lang.Number. You can select numbers of type Byte, Short, Integer, Long, or Float, and you can set maximum and minimum values for the spin operation.

JCSortableTable

A subclass of JTable that internally wraps any TableModel it is given with a JCRowSortTableModel and provides a Comparator that has a adjustable list of the column indexes that it uses for sorting. Clicking on a column header invokes the sorting behavior tied to that column, clicking again reverses the sort. It can be used to sort Dates, Objects that implement Comparable, and wrapped primitive types. For more information, see Features of JCSortableTable, in Chapter 9, for a description and examples.

JCSplashScreen

A splash screen is an image that appears while an application is loading. It serves both as an indication that the program is being loaded from disk and as a place to put notices, such as copyrights, version or release numbers, and the like.

JCTreeExplorer

A subclass of JTable that handles listeners, rendering, editing, and painting of a component that combines tree-like and table-like properties.

JCPopupCalendar

JCPopupCalendar is a component that allows you to edit the date and time using a dropdown calendar.

JCTreeTable

Swing's JTree and JTable are the two components that do more than merely display data; they attempt to manage the data as well. This becomes important when you need to organize large amounts of data and provide a view that displays a portion of it along with an indication of its relationship to the rest. Information that has a hierarchical structure, like a file system, can be displayed as tree data, while other types of data nicely fit a tabular format. There are a large number of data structures that combine tree-like and a table-like properties. A file system has a hierarchical organization that begs to be represented as a tree, yet the individual directories and files have properties, such as name, size, type, and date modified, that fit nicely in a row-column organization. Obviously there is a need for a component that lets you combine the look and functionality of both a tree and a table.

JCWizard and JCSplitWizard

JCWizard and JCSplitWizard let you create and manage a Wizard-style group of dialogs by supplying informative events and special page components with standard buttons. You add a JCWizardListener to your JCWizardPages to invoke the actions that each page needs to perform.

Layout Managers

The layout managers are JCAlignLayout, JCColumnLayout, JCElasticLayout, JCGridLayout, and JCRowLayout. JCBorder, JCBox, JCBrace, and JCSpring are the associated components. Use them as enhancements to the AWT layout managers.

Use JCAlignLayout to vertically arrange components with their associated labels, and JCRowLayout to arrange components in a single row.

JCGridLayout improves AWT's GridLayout by sizing cells more intelligently.

JCBorder lets you place your borders anywhere, not just around components.

The following table lists some JClass Elements objects, with their nearest Swing relatives. The accompanying description informs you about the advantages you gain by using the JClass Elements component.

Swing

JClass Elements

Description

No Swing equivalent

JCCircularGauge
JCLinearGauge

Highly configurable circular and linear dials and gauges.

JEditorPane

JCHTMLPane

Its constructor takes either an HTML String or a URL, making it easy to add HTML pages to a pane. Follows hyperlinks without having to add listeners explicitly.

JPane

JCMDIPane

A pane that can hold multiple document interface (MDI) frames.

JInternalFrame

JCMDIFrame

Supports the multiple document interface paradigm with the automatic addition of a "Windows" menu to the parent menubar.

JFrame

JCExitFrame

Automatically responds to window closing events.

JTree
JTable

JCTreeTable
JCTreeExplorer

Components that combine tree and table views of hierarchically ordered data.

No Swing equivalent.

JCFontChooser
JCFontChooserBar
JCFontChooserPane

Choose fonts from a menu or a dialog.

(AWT) GridLayout

JCAlignLayout

An easy way to lay out a two-column grid.

No Swing equivalent.

JCElasticLayout

For laying out components in a single row or a single column. Any leftover space in the component is divided among the components in the way you specify.

JSpinner

JCSpinBox
JCSpinNumberBox

These spin boxes are the top half of a combo box. They are useful when you don't need a drop-down list, and they don't subclass from JComboBox. Instead, they inherit from Swing's AbstractSpinBox.

No Swing equivalent.

JCDateChooser

JCDateChooser is a component that displays a calendar in one of four variant forms. Each one displays the days of the month in the familiar form of a calendar, but varies the ways that the month and year are displayed.

No Swing equivalent.

JCWordWrap

Wraps lines, given a length and a newline delimiter.

JProgressBar

JCProgressHelper

A thread-safe class that reports via a dialog just how far along some time-consuming operation is.


1.3 Internationalization

Internationalization is the process of making software that is ready for adaptation to various languages and regions without engineering changes. JClass products have been internationalized.

Localization is the process of making internationalized software run appropriately in a particular environment. All Strings used by JClass that need to be localized (that is, Strings that will be seen by a typical user) have been internationalized and are ready for localization. Thus, while localization stubs are in place for JClass, this step must be implemented by the developer of the localized software. These Strings are in resource bundles in every package that requires them. Therefore, the developer of the localized software who has purchased source code should augment all .java files within the /resources/ directory with the .java file specific for the relevant region; for example, for France, LocaleInfo.java becomes LocaleInfo_fr.java, and needs to contain the translated French versions of the Strings in the source LocaleInfo.java file. (Usually the file is called LocaleInfo.java, but can also have another name, such as LocaleBeanInfo.java or BeanLocaleInfo.java.)

Essentially, developers of the localized software create their own resource bundles for their own locale. Developers should check every package for a /resources/ directory; if one is found, then the .java files in it will need to be localized.

For more information on internationalization, go to: http://java.sun.com/j2se/1.4.2/docs/guide/intl/index.html.


PreviousNextIndex