![]() ![]() ![]() |
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 aJCComponent
, 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, likeJCFontChooser
, 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
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.
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.
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.
A frame that responds to window-closing events either by exiting or by becoming invisible.
JCFontChooser
is the abstract base class forJCFontChooserBar
andJCFontChooserPane
. 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.
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 threeJCHTMLPane
s 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.
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
matches the API forJList
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.
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.
Use
JCSpinNumberBox
for incrementing and decrementing objects of typejava.lang.Number
. You can select numbers of typeByte
,Short
,Integer
,Long
, orFloat
, and you can set maximum and minimum values for the spin operation.
A subclass of
JTable
that internally wraps anyTableModel
it is given with aJCRowSortTableModel
and provides aComparator
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 sortDate
s,Object
s that implementComparable
, and wrapped primitive types. For more information, see Features of JCSortableTable, in Chapter 9, for a description and examples.
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.
A subclass of
JTable
that handles listeners, rendering, editing, and painting of a component that combines tree-like and table-like properties.
JCPopupCalendar
is a component that allows you to edit the date and time using a dropdown calendar.
Swing's
JTree
andJTable
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
andJCSplitWizard
let you create and manage a Wizard-style group of dialogs by supplying informative events and special page components with standard buttons. You add aJCWizardListener
to yourJCWizardPage
s to invoke the actions that each page needs to perform.The layout managers are
JCAlignLayout
,JCColumnLayout
,JCElasticLayout
,JCGridLayout
, andJCRowLayout
.JCBorder
,JCBox
,JCBrace
, andJCSpring
are the associated components. Use them as enhancements to the AWT layout managers.Use
JCAlignLayout
to vertically arrange components with their associated labels, andJCRowLayout
to arrange components in a single row.
JCGridLayout
improves AWT'sGridLayout
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.
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.
![]() ![]() ![]() |