Index: lib/com/izforge/izpack/installer/InstallerFrame.java
===================================================================
--- lib/com/izforge/izpack/installer/InstallerFrame.java	(revision 2053)
+++ lib/com/izforge/izpack/installer/InstallerFrame.java	(working copy)
@@ -76,7 +76,6 @@
 import javax.swing.JPanel;
 import javax.swing.JProgressBar;
 import javax.swing.JSeparator;
-import javax.swing.JTextPane;
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
 import javax.swing.WindowConstants;
@@ -134,10 +133,11 @@
      */
     private static final String ICON_RESOURCE_EXT_VARIABLE_NAME = "installerimage.ext";
 
-
+    /**
+     * Heading icon resource name.
+     */
     private static final String HEADING_ICON_RESOURCE = "Heading.image";
 
-    // private static final int HEADINGLINES = 1;
 
     /**
      * The language pack.
@@ -235,9 +235,6 @@
     
     private Map dynamicvariables;
     private VariableSubstitutor substitutor;
-    
-    
-    private JTextPane debugtxt;
     private Debugger debugger;
 
     /**
@@ -280,6 +277,10 @@
         return this.debugger;
     }
     
+    /**
+     * Refreshes Dynamic Variables.
+     *
+     */
     private void refreshDynamicVariables() {        
         if (dynamicvariables != null) {
             Iterator iter = dynamicvariables.keySet().iterator();
@@ -304,6 +305,10 @@
         }
     }
 
+    /**
+     * Loads Dynamic Variables.
+     *
+     */
     private void loadDynamicVariables()
     {
         try {
@@ -313,7 +318,7 @@
             objIn.close();
         }
         catch (Exception e) {
-            Debug.trace("Can not find optional dynamic variables");   
+            Debug.trace("Cannot find optional dynamic variables");   
             System.out.println(e);
         }        
     }
@@ -401,7 +406,7 @@
             String praefix = "com.izforge.izpack.panels.";
             if (className.indexOf('.') > -1)
             // Full qualified class name
-                praefix = "";
+            praefix = "";
             objectClass = Class.forName(praefix + className);
             constructor = objectClass.getDeclaredConstructor(paramsClasses);
             installdata.currentPanel = p; // A hack to use meta data in IzPanel constructor
@@ -648,6 +653,16 @@
             ((GUIListener) iter.next()).guiActionPerformed(what, param);
     }
 
+    /**
+     * Loads icon for given panel.
+     * 
+     * @param resPrefix resources prefix.
+     * @param PanelNo panel id.
+     * @param tryBaseIcon should try to fallback to base icon?
+     * @return icon image
+     * @throws ResourceNotFoundException
+     * @throws IOException
+     */
     private ImageIcon loadIcon(String resPrefix, int PanelNo, boolean tryBaseIcon)
             throws ResourceNotFoundException, IOException
     {
@@ -670,6 +685,15 @@
         return (icon);
     }
 
+    /**
+     * Loads icon for given panel id.
+     * @param resPrefix resource prefix.
+     * @param panelid panel id.
+     * @param tryBaseIcon should try to load base icon?
+     * @return image icon
+     * @throws ResourceNotFoundException
+     * @throws IOException
+     */
     private ImageIcon loadIcon(String resPrefix, String panelid, boolean tryBaseIcon)
             throws ResourceNotFoundException, IOException
     {
@@ -803,6 +827,9 @@
         setVisible(true);
     }
 
+    /**
+     * Here is persisted the direction of panel traversing.
+     */
     private boolean isBack = false;
 
     /**
@@ -1262,7 +1289,10 @@
      */
     public void exit()
     {
-        if (installdata.canClose)
+        if (installdata.canClose || 
+            ((!nextButton.isVisible() || !nextButton.isEnabled())  &&
+             (!prevButton.isVisible() || !prevButton.isEnabled()))
+           )
         {
             // this does nothing if the uninstaller was not included
             writeUninstallData();
@@ -1402,7 +1432,7 @@
         }
     }
 
-    /*
+    /**
      * FocusTraversalPolicy objects to handle keybord blocking; the declaration os Object allows to
      * use a pre version 1.4 VM.
      */
@@ -1494,18 +1524,21 @@
         {
             if (isBack)
             {
-                installdata.curPanelNumber--;
-                switchPanel(installdata.curPanelNumber + 1);
+                navigatePrevious(installdata.curPanelNumber);
             }
             else
             {
-                installdata.curPanelNumber++;
-                switchPanel(installdata.curPanelNumber - 1);
+                navigateNext(installdata.curPanelNumber, false);
             }
-
         }
     }
 
+    /**
+     * Method checks whether conditions are met to show the given panel.
+     * 
+     * @param panelnumber the panel number to check
+     * @return true or false
+     */
     public boolean canShow(int panelnumber)
     {
         IzPanel panel = (IzPanel) installdata.panels.get(panelnumber);
@@ -1543,14 +1576,22 @@
         this.navigateNext(installdata.curPanelNumber);
     }
 
-    public void navigateNext(int last)
+    /**
+     * This function searches for the next available panel, the search
+     * begins from given panel+1. 
+     * @param startPanel the starting panel number 
+     */
+    public void navigateNext(int startPanel) {
+        this.navigateNext(startPanel, true);        
+    }
+    
+    public void navigateNext(int startPanel, boolean doValidation)
     {
         if ((installdata.curPanelNumber < installdata.panels.size() - 1))
         {
             // We must trasfer all fields into the variables before
             // panelconditions try to resolve the rules based on unassigned vars.
-            boolean isValid = 
-              ((IzPanel) installdata.panels.get(last)).isValidated();
+            boolean isValid = doValidation ? ((IzPanel) installdata.panels.get(startPanel)).isValidated() : true;
           
             // if this is not here, validation will
             // occur mutilple times while skipping panels through the recursion
@@ -1559,21 +1600,16 @@
             installdata.curPanelNumber++;
             if (!canShow(installdata.curPanelNumber))
             {
-                this.navigateNext(last);
+                this.navigateNext(startPanel, false);
             }
             else
             {
-                if (isValid)
-                {
-                    switchPanel(last);
-                }
-                else {
-                    installdata.curPanelNumber--;
-                }
+                switchPanel(startPanel);
             }
+            
         }
     }
-
+    
     /**
      * This function moves to the previous panel
      */
@@ -1585,18 +1621,23 @@
         this.navigatePrevious(installdata.curPanelNumber);
     }
 
-    public void navigatePrevious(int last)
+    /**
+     * This function switches to available panel that is just before given one.
+     * 
+     * @param endingPanel the panel is searched backwards, beginning from this.
+     */
+    public void navigatePrevious(int endingPanel)
     {
         if ((installdata.curPanelNumber > 0))
         {
             installdata.curPanelNumber--;
             if (!canShow(installdata.curPanelNumber))
             {
-                this.navigatePrevious(last);
+                this.navigatePrevious(endingPanel);
             }
             else
             {
-                switchPanel(last);
+                switchPanel(endingPanel);
             }
         }
     }
@@ -1834,6 +1875,10 @@
 
     }
 
+    /**
+     * Creates a Heading in given Panel.
+     * @param navPanel a panel  
+     */
     private void createHeading(JPanel navPanel)
     {
         headingPanel = null;
Index: lib/com/izforge/izpack/installer/IzPanel.java
===================================================================
--- lib/com/izforge/izpack/installer/IzPanel.java	(revision 2053)
+++ lib/com/izforge/izpack/installer/IzPanel.java	(working copy)
@@ -328,7 +328,7 @@
      * further through the installation process until the panel is validated. Default behaviour is
      * to return <code>true</code>.
      * 
-     * @return A boolean stating wether the panel has been validated or not.
+     * @return A boolean stating whether the panel has been validated or not.
      */
     public boolean isValidated()
     {

