diff options
| author | Paul Buetow <paul@buetow.org> | 2009-03-04 17:31:40 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2009-03-04 17:31:40 +0000 |
| commit | 9129838d208c0df7293e5b757661125545cd6df8 (patch) | |
| tree | cde0b095a7ad120b68450f705d8fc16d278bfff8 /libs/FLib/JWizard/doc/tutorial.html | |
| parent | e2c501ba5aaffd9d5ace6bc1706353d9f83329b7 (diff) | |
flib added
Diffstat (limited to 'libs/FLib/JWizard/doc/tutorial.html')
| -rw-r--r-- | libs/FLib/JWizard/doc/tutorial.html | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/libs/FLib/JWizard/doc/tutorial.html b/libs/FLib/JWizard/doc/tutorial.html new file mode 100644 index 0000000..3a8dc2d --- /dev/null +++ b/libs/FLib/JWizard/doc/tutorial.html @@ -0,0 +1,200 @@ +<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/JWizard.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->
+<title>JWizard - Tutorial</title>
+<!-- InstanceEndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<!-- InstanceBeginEditable name="head" -->
+<!-- InstanceEndEditable -->
+<link href="stylesheet.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+<p><img src="images/Logo.png" width="800" height="150" /></p>
+<table width="800" border="0" cellspacing="0" cellpadding="10">
+ <tr>
+ <td width="150" align="left" valign="top" id="sidebar">
+ <p><a href="index.html">Introduction</a></p>
+ <p><a href="features.html">Features</a></p>
+ <p><a href="screenshots.html">Screen<br />
+ shots</a></p>
+ <p><a href="tutorial.html">Tutorial</a></p>
+ <p><a href="examples.html">Examples</a></p>
+ <p><a href="api/index.html">API<br />
+ documentation</a></p>
+ <p><a href="https://sourceforge.net/project/showfiles.php?group_id=113939">Download</a></p>
+ <p><a href="resources.html">Other<br />
+ resources</a></p>
+ <p><a href="../../index.html">Return to<br />
+ FLib</a> </p>
+ <p><a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=113939&type=1" alt="SourceForge.net Logo" width="88" height="31" border="0" align="top" title="" /></a></p>
+ <p><a href="http://www.jars.com/"><img src="http://www.jars.com/images/r750.gif" alt="Rated JARS Top 25%" width="104" height="56" border="0" align="top" title="" /></a></p> </td>
+ <td id="content" width="614" align="left" valign="top"><!-- InstanceBeginEditable name="content" -->
+ <h1>Tutorial</h1>
+ <h2>JWizard</h2>
+ <h3>Creating the JWizardDialog</h3>
+ <p>To create a Wizard, begin by creating a storyboard, sketching each step
+ and the sequence through the steps. The sequencing may depend on the information
+ users supply as they proceed through the Wizard. Number each step, from
+ 0 to <em>n</em>, roughly following the flow from beginning to end.</p>
+ <p>Now you're ready to create your Wizard class. The basic pattern is:</p>
+ <pre>public class SampleWizard
+ extends JWizardDialog
+{
+
+
+public SampleWizard(Frame owner) {
+ super(owner, "Sample Wizard", true);
+
+ // Set the logo image
+
+ URL url = getClass().getResource("SampleWizard.gif");
+ setWizardIcon(new ImageIcon(url));
+
+ // Create each step
+
+ addWizardPanel(new Step0());
+ addWizardPanel(new Step1());
+ addWizardPanel(new Step2());
+ ...
+
+ // Make the dialog visible
+
+ pack();
+ setVisible(true);
+}
+
+}
+</pre>
+ <p>Each Wizard is a subclass of JWizardDialog. In this case, the sample
+ wizard will be the child of a Frame. This will center the Wizard over
+ the Frame. If the Frame is null, the Wizard will be centered in the middle
+ of the screen. You can turn off the centering behavior by calling <code>disableCentering()</code>
+ before calling <code>setVisible()</code>.</p>
+ <p>The dialog title will be "Sample Wizard" and the dialog will
+ be modal (which is fairly standard for Wizards). An icon is added to the
+ Wizard and will be displayed on the left side of the dialog.</p>
+ <p>Note that each Wizard step is a separate class that is instantiated and
+ added to the dialog. The class names are arbitrary, but the first step
+ will be identified as step 0, so the above naming makes it easy to associate
+ a step with its corresponding class.</p>
+ <p>The step classes can be created however you like, but my recommendation
+ is that they be inner classes of the JWizardDialog. This makes it very
+ easy for global information to be accumulated in a central place (the
+ JWizardDialog) and accessed by all steps.</p>
+ <h3>Creating the Wizard Steps</h3>
+ <p>The basic pattern for a Wizard step is as follows:</p>
+ <pre>private class Step0
+ extends JWizardPanel
+{
+
+public
+Step0()
+{
+ setStepTitle("Sample Wizard Step 0");
+
+ JPanel contentPane = getContentPane();
+ ...
+
+ // Set the previous and next steps
+
+ setBackStep(-1);
+ setNextStep(1);
+}
+
+}
+</pre>
+ <p>Each step is a subclass of JWizardPanel. You will normally start by setting
+ the title for this specific step. Then you will construct all the appropriate
+ components for the step and add them to the JPanel obtained by calling
+ <code>getContentPane()</code> (don't add them directly to the JWizardPanel).</p>
+ <p>You end each step constructor by calling <code>setBackStep()</code> and
+ <code>setNextStep()</code>. This defines the flow from this panel to the
+ previous and next panels. A previous panel of -1 means that we are on
+ the first panel; a -1 for the next panel means we are on the last panel.
+ Any other number identifies the step we will sequence back or forwards
+ to.</p>
+ <p>If you need more dynamic sequencing, you will set up the default sequence
+ in the constructor. Then you will override the <code>back()</code> or
+ <code>next()</code> methods. You would determine the correct previous
+ or next step (calling <code>setBackStep()</code> or <code>setNextStep()</code>)
+ and then call <code>super.back()</code> or <code>super.next()</code>.</p>
+ <p>This also allows you to perform error checking. You override the <code>next()</code>
+ method and perform error checking based on the user's step entries. If
+ there is an error, you can display an error dialog and return without
+ calling <code>super.next()</code>. This will leave the step unchanged.</p>
+ <p>The <code>next()</code> method is also a convenient place to read the
+ user's entries and copy them into JWizardDialog fields so that the information
+ is globally available to all steps.</p>
+ <p>If you have a complicated Wizard with many steps and lots of components,
+ it may take a while to display if you construct each panel in the JWizardPanel
+ constructor. You perform a delayed construction by overriding <code>makingVisible()</code>.
+ <code>makingVisible()</code> is called just prior to displaying the step,
+ so you'll need to make sure you construct the panel only the first time
+ its called.</p>
+ <p>This will speed up the initial appearance of the Wizard, but it will
+ make it difficult to size the dialog properly (the dialog should be large
+ enough to accommodate the largest panel). You may think you can manually
+ set the size by calling <code>setSize()</code> on the JWizardDialog. This
+ is not a good idea. There are various circumstances which may change the
+ size needed:</p>
+ <ul>
+ <li>If the application is internationalized, the translated labels may
+ be longer than expected.</li>
+ <li>If the application is designed for people with poor vision, you may
+ want to allow for larger font sizes.</li>
+ <li>You may also want larger font sizes for demo purposes (showing the
+ application to a group of people gathered around a display).</li>
+ </ul>
+ <p>JWizardDialog does make allowances for panels created in makingVisible().
+ Before each panel is displayed, it checks the preferred size against the
+ current size. If the preferred size is bigger, it will increase the dialog's
+ size to match. It will never decrease the size—this minimizes the
+ amount of size changes the dialog goes through.</p>
+ <h3>Handling Finish and Cancel</h3>
+ <p>In JWizardDialog, the <code>finish()</code> and <code>cancel()</code>
+ methods are called when the Finish and Cancel buttons are called, respectively.
+ Each of these methods calls dispose(). You may want to override them.
+ For instance, <code>finish()</code> may want to take all the user's input
+ and do something with it. In <code>cancel()</code>, you may want to query
+ the user to confirm the cancellation. Call <code>super.cancel()</code>
+ if confirmed or else just return.</p>
+ <h3>Handling Help</h3>
+ <p>You add a Help button by calling <code>addHelpButton()</code> in the
+ JWizardDialog constructor. If all Wizard panels have the same help message,
+ you would override <code>help()</code> in the JWizardDialog class. Otherwise,
+ each step should over JWizardPanel's <code>help()</code> method.</p>
+ <h3>Sequencing Options</h3>
+ <p>In general, the sequencing is handled by each step. This is usually the
+ easiest way to do it as each step usually has the information it needs
+ to decide where to go next. However, if you need more central control
+ of the sequencing algorithm, you can override <code>switchToStep()</code>
+ in the JWizardDialog. This method receives the current step value and
+ the requested next step (from the JWizardPanel). Note that the "next"
+ step is the step selected by the user pressing either the Back or Next
+ button. You can change the change the next step value based on whatever
+ criteria you want.</p>
+ <h3>Other Options</h3>
+ <p>In most Wizards, the Finish button is enabled only on the last step.
+ But some Wizards allow the user to call Finish while steps still remain.
+ The information gathered in the remaining steps is defaulted. If you have
+ this model, call <code>setEarlyFinish()</code> in the JWizardDialog.</p>
+ <p>In some Wizards, the last step is simply where all the necessary user
+ information has been gathered—pressing Finish begins processing
+ the information. In other Wizards, actions may be performed as the Wizard
+ proceeds and the last step is simply to confirm completion of the task.
+ In this latter case, call <code>disableCancelAtEnd()</code> in the JWizardDialog.
+ This disables the Cancel button on the last step.</p>
+ <h3>Summary</h3>
+ <p>The JWizard components are designed to be easy to use. In most cases
+ you will override just a few methods. The rest will normally do the
+ right
+ thing. After reading this tutorial, you should examine the <a href="examples.html">example
+ program</a> provided which exercises many of the features of JWizard.</p>
+ <!-- InstanceEndEditable --></td>
+ </tr>
+</table>
+</body>
+<!-- InstanceEnd --></html>
|
