# Samples: Shortcuts to key JBuilder samples

> Most of the samples which make use of tables in a database use JDataStore as the default SQL server. JDataStore is included with the Professional and Enterprise editions of JBuilder.

JBuilder includes many sample projects which demonstrate use of its rich component library as well as use of Java base classes. The samples below are grouped by area. A brief description of each is included. Click on the sample name to load the project file into an AppBrowser window.

JBuilder samples are listed under the following areas:

- DataExpress
- dbSwing
- Distributed
- Enterprise Java Beans (EJB)
- JDataStore
- Online Store
- OpenTools API
- SQL
- Swing
- Tutorials
- WebApps
- Welcome Project
- Additional samples

The samples that use JDataStore databases assume that you have entered your licensing information into the JDataStore License Manager. For more information, see "Using JDataStore for the first time" in the JDataStore Developer's Guide.

### Note for JBuilder users on SolarisTM and Linux

If you install JBuilder as 'root', but run JBuilder under your normal user account, you will not be able to run any of the samples directly from the JBuilder samples directory. Attempting to do so will result in a compile-time error, `Error #: 914: unable to write to output directory`. In order to run a sample project, you must have read/write access to all files and directories created or used by the sample.

A shell script named 'chmod_samples' is provided in the samples directory which enables the user who installed JBuilder to control access to the samples. It should be run from within the samples directory. For example:

    % cd /usr/local/jbuilder/samples
    % chmod_samples
    Usage: chmod_samples [-verbose] full
                to allow all users to compile, run, and modify sample files
       or  chmod_samples [-verbose] run
                to allow all users to compile, run, but not modify sample files
       or  chmod_samples [-verbose] readonly
                to allow all users to read but not run or modify sample files

Alternatively, if you were not the user who installed JBuilder and you only have read-only access to the JBuilder samples subdirectory, you can copy the samples into a directory in which you do have read/write access to run the samples. Because some samples require files (e.g., databases) in other subdirectories of the samples directory, it is recommended that you make your own copy of the entire samples tree, if possible. Samples which try to access files in other samples directories write a message indicating the directory in which they expect to find a file. The message includes the name of the class trying to locate the required file. If necessary, you can edit that class to point to another location, rebuild, and re-run the project.

A simple way to copy the entire samples tree is to use the `cp -R` command. For example, to copy the JBuilder samples tree (assumed to be in /usr/local/jbuilder/samples) to a 'mysamples' subdirectory of your home directory, do the following:

    % mkdir $HOME/mysamples
    % cp -R /usr/local/jbuilder/samples/. $HOME/mysamples

## Welcome Project

The Welcome Project introduces you to the JBuilder user interface and provides quick access to the Release Notes, and shortcuts to key topics in the documentation, tutorials, and samples.

## Swing

These samples run with all JBuilder editions.

Title | Description
--- | ---
CardLayout | Demonstrates two different ways to control a CardLayout panel, using JRadioButtons and a JComboBox.
CheckBoxControl | Uses JCheckBox and JCheckBoxMenuItem components to toggle a True/False state in a JTable column.
Password | Shows how to use a JPasswordField component.
Primes | Generates prime numbers and displays them in a scrolling JList.
SimpleTextEditor | The Swing version of a simple text editor that is capable of reading, writing, and editing text files.
TabbedPane | Shows how to use a JTabbedPane component.
TreeControl | Shows how to use a JTree control.

## Tutorials

Title | Description
--- | ---
DebugTutorial | A tutorial on compiling, running and debugging. This tutorial contains introduced errors. To work through the tutorial and find and fix errors, expand the Tutorials book in the online help and choose "Compiling, running, and debugging tutorial." This sample runs with all JBuilder editions.
FirstApplet | A tutorial on creating an AWT applet. To create this applet by following the tutorial, expand the Quick Start book in the online help and choose "Tutorial: Building an applet." This sample runs with all JBuilder editions.
SimpleTextEditor | The Swing version of a simple text editor that is capable of reading, writing, and editing text files. To create this application by following the tutorial, expand the Tutorials book in the online help and choose "Building a Java tutorial." This sample runs with all JBuilder editions.
TextEdit | A text editor application that is capable of reading, writing, and editing text files. Includes creation of a simple UI design and hooking up of events to buttons and menus. To create this application by following the tutorial, expand the Tutorials book in the online help and choose "Building a Java tutorial." This sample requires JBuilder Professional or Enterprise.
Presentation | An XML tutorial on creating an XML document from a DTD, validating and transforming the document using stylesheets. To use this sample, expand the XML Application Developer's book in the online help and choose "Tutorial: Validating and transforming XML documents." This sample requires JBuilder Professional or Enterprise.
SAXParser | An XML tutorial on creating a SAX parser with JBuilder's SAX Handler wizard. To use this sample, expand the XML Application Developer's book in the online help and choose "Tutorial: Creating a SAX Handler for parsing XML documents." This sample requires JBuilder Enterprise.
BorlandXML | An XML tutorial on databinding using BorlandXML and a DTD to generate Java classes. To use this sample, expand the XML Application Developer's book in the online help and choose "Tutorial: DTD datbinding with BorlandXML." This sample requires JBuilder Enterprise.
Castor | An XML tutorial on databinding using Castor and a schema file to generate Java classes. To use this sample, expand the XML Application Developer's book in the online help and choose "Tutorial: Schema datbinding with Castor." This sample requires JBuilder Enterprise.
XMLDBMSBeans | An XML tutorial on XML-DBMS model-based database components. To use this sample, expand the XML Application Developer's book in the online help and choose "Tutorial: Transferring data with the model-based XML database components." This sample requires JBuilder Enterprise.
XBeans | An XML tutorial on template-based XML database components. To use this sample, expand the XML Application Developer's book in the online help and choose "Tutorial: Transferring data with the template-based XML database components." This sample requires JBuilder Enterprise.

## WebApps

These samples require JBuilder Professional or Enterprise.

Title | Description
--- | ---
guestbook | A tutorial on creating a servlet that uses InternetBeans components to query a database table and display its contents, accept user input, and save it back to the database.
GuestbookServlet | A tutorial on creating a servlet that accepts user input, connects to a database table, writes data to the database, and renders the database table in HTML.
jspinternetbeans | A tutorial on creating a JSP that uses InternetBeans components to query a database table and display its contents, accept user input, and save it back to the database.
ShoppingCart | A simple shopping cart application that uses JavaServer Pages.

## DataExpress

These samples require JBuilder Professional or Enterprise.

Title | Description
--- | ---
Aggregating | Shows how to aggregate data with calculated fields.
BasicApp | A sample database application developed using DataExpress components and the JBuilder design tools.
Buttons | Shows use of default, minimum, and maximum constraints and mapping values from a button control to a Column.
CalculatedColumn | Creates a calculated column in the designer.
CustomToolBar | Uses JdbTable and a JdbNavToolBar with customized buttons that "drill down" (show detail records for the current row) and "roll up" (return from the details to the master dataset).
FilterRows | Shows how to use a data set's RowFilterListener to view only rows that meet the filter criteria.
JDBCBenchmark | Basic test suite used to compare performance of DataExpress components against raw JDBC calls for retrieval, update, delete, and insert of data.
LocatingData | Shows how to set a particular column for the locate operation as well as using a JdbComboBox component to enable the user to select the column in which to locate the value.
Lookup | Shows how to use the lookup() method of the DataSet class in conjunction with the calculated column feature.
MasterDetail | Demonstrates how to setup two data sets where one acts as the master to the other.
ParameterizedQuery | An example of performing parameterized queries with a QueryDataSet component.
IntlDemo | The Borland Multilingual International Store, showing an internationally enabled application using dbSwing and DataExpress components.
Picklist | Shows how to provide values to a column using a picklist to enter a new value to a column.
ProviderResolver | Shows how to create your own custom provider, which can be used as a provider for a TableDataSet or any DataSet derived from a TableDataSet.
QueryProvider | Shows how to query a database using the JBuilder user interface.
QueryResolver | Explores the basic resolver functionality provided by the DataExpress package.
ResolverEvents | Demonstrates events that occur when resolving changes back to a (database) data source, and how to use these events to customize resolver event processing.
ServerSpecificProcedures | Demonstrates the use of the DataExpress ProcedureDataSet and ProcedureProvider components to utilize stored procedures on an SQL server.
SimpleStoredProcedure | Shows how to provide data to an application using JBuilder's UI designer and a ProcedureDataSet component.
StreamableDataSets | Demonstrates distributed computing using RMI and StreamableDataSets. This example also shows how to write customized Providers and Resolvers.
TextDataFile | Sample application that explores basic database concepts and JBuilder's DataExpress architecture without the need for a remote database.
TextFileImportExport | Shows how to provide data to an application using a TableDataSet component and a comma-delimited text data file.

## dbSwing

These samples require JBuilder Professional or Enterprise.

Title | Description
--- | ---
Buttons | Shows how JdbCheckBox, JdbToggleButton, JdbRadioButton, or JdbSlider can be used to display and edit the contents of a column that has only a small number of valid values.
CustomToolBar | Uses JdbTable and JdbNavToolBar to customize with buttons that "drill down" (show detail records for the current row) and "roll up" (return from the details to the master dataset).
HtmlViewer | Shows how to build a simple HTML viewer using a JdbNavTree and a JdbEditorPane. Includes a simple cell renderer. Demonstrates the use of an Object column in a dataset as a cache for HTML pages.
IntlDemo | The Borland Multilingual International Store, showing an internationally enabled application using dbSwing and DataExpress components.
PickLists | Defines a picklist according to the options you select and lets you see that picklist in action using dbSwing controls. Demonstrates custom StatusEvent handling using JdbStatusLabel and discusses exception handling alternatives.
TextPane | Uses Swing JInternalFrames to display product descriptions from the IntlDemo sample application.

## JDataStore

These samples require JBuilder Professional or Enterprise.

> Note: The samples that use JDataStore databases assume that you have entered your licensing information into the JDataStore License Manager. For more information, see "Using JDataStore for the first time" in the JDataStore Developer's Guide.

Title | Description
--- | ---
BasicJDataStore | Demonstrates basic usage of JDataStore database using the JDatastore JDBC driver and the DataExpress Java bean components.
dsbasic | Code and data created for with tutorials in the JDataStore Programmer's Guide.
HelloJDBC | Demonstrates how to create a JDataStore file and connect to it using the JDataStore JDBC driver.
OfflineEditing | Uses a local JDataStore component to enable offline editing of data from a remote database.
WebBench | Creates a set of large sample tables in a JDatastore, runs transactions on multiple concurrent connections, and reports on throughput.

## Enterprise JavaBeans (EJB)

These samples require JBuilder Enterprise.

Title | Description
--- | ---
EJB 1.1 - EJB DX | An example using 1.1 EJB's and DataExpress running on Borland Enterprise Server.
EJB 1.1 - EJB DX WebLogic | Same as the EJB DX example, except it runs on WebLogic.
EJB 1.1 - ESite | A simple shopping cart example that use 1.1 EJB's, DataExpress, JSP's and servlets.
EJB 2.0 - ESite Weblogic | A simple shopping cart example that use 2.0 EJB's, DataExpress, JSP's and servlets.

## Online Store

These samples require JBuilder Enterprise.

Title | Description
--- | ---
CreditCardApprovalApplet | An example of a credit approval/credit card issuing system for a fictitious company selling outdoor adventure gear.
OrderEntry | An example of an order entry system for a fictitious company selling outdoor adventure gear.
OrderTracker | A simple illustration of a database-aware applet/application that allows data entry of an order tracking number for an order created through the order entry application and retrieval of status information for the order.

## SQL

These samples require JBuilder Professional or Enterprise.

Title | Description
--- | ---
AppletToServlet | An applet built with DataExpress components and a servlet based on DataExpress components that communicate with each other.
jsql | Samples to use with the jsql command line tools.
XMLServlet | A servlet for running queries using a JDBC database driver and generating XML or plain text output.

## Distributed

These samples require JBuilder Professional or Enterprise.

Title | Description
--- | ---
StreamableDataSets | Demonstrates distributed computing using RMI and StreamableDataSets. This example also shows how to write customized Providers and Resolvers.
SimpleRMI | A simple RMI application.
Chess | Contains a client and server for the samples.chess.client.ChessViewer sample. This an actual chess game that supports play between players on different machines.

## OpenTools API

Title | Description
--- | ---
Actions | Demonstrates an action to display a simple greeting in a modal dialog.
CommandLine | Demonstrates how to register a JBuilder command-line option.
CurlyBraceKeyBinding | Shows how to add a keybinding to complete curly braces.
Designer | Examples for writing Designers in JBuilder.
File Differences Viewer | How to implement a viewer that shows differences between two files.
EditorStats | Adds a tools menu item and hooks it up to a dialog with editor statistics.
PackageTree | Builds a hierarchical tree based on the package of a .java node selected in the project.
ReadingSource | Reads a JOT source file.
WritingSource | Writes a JOT source file.
LayoutAssistant | Sample Assistant for wiring a layout manager in the UI designer.
LineCommentHandler | Show how to change a keybinding and make it talk to the editor.
DynamicClassLoader | IDE extension that tests an OpenTools program.
ModifyCaret | How to change the shape of the caret.
ModifyKeyBinding | How to change keybindings in all the editor emulations.
NodeDemo | Shows how to use nodes.
PropertyEditor | An example property editor that has special knowledge of the Design environment.
BRIEF Editor Key Bindings | An example that shows how to make a Brief emulation.
Emacs Editor Key Bindings | An example that shows how to make an Emacs emulation.
CUA Editor Key Bindings | An example that shows how to make an CUA emulation.
Version Control System | Shows how to configure an external version control system.
Delphi | An example TextFileNode viewer using custom syntax highlighting and generating structure pane content.
ImageViewer | An example non-text FileNode viewer.
Doclet | An example of a doclet which customizes the Javadoc wizard.
Find String | An example of a wizard using the MessageView.
Gallery | An example of an object gallery wizard using a PropertyGroup.
Package Wizard | Adds an Add Packages wizard to the Project Pane popup menu.
Simple Wizard | An example of a simple wizard.

## Additional samples

These samples require JBuilder Professional or Enterprise.

Title | Description
--- | ---
BeanCustomizer | A simple sample Bean that demonstrates the use of default editors, new enumerationValues item in JavaBeans, a simple customizer, bean reloading, property hiding, property "renaming" and more.