[sword-cvs] r58 - in trunk: . .settings app app/src/org/crosswire/flashcards

Apache apache at crosswire.org
Tue Sep 21 17:50:38 MST 2004


Author: 
Date: 2004-09-21 17:50:38 -0700 (Tue, 21 Sep 2004)
New Revision: 58

Added:
   trunk/.settings/
   trunk/.settings/org.eclipse.jdt.core.prefs
   trunk/app/src/org/crosswire/flashcards/FlashCardEditor.jbx
Modified:
   trunk/app/Flash.jpx
   trunk/app/Flash.jpx.local
   trunk/app/src/org/crosswire/flashcards/EditPane.java
   trunk/app/src/org/crosswire/flashcards/FlashCardEditor.java
   trunk/app/src/org/crosswire/flashcards/MainFrame.java
   trunk/app/src/org/crosswire/flashcards/MainMenu.java
   trunk/app/src/org/crosswire/flashcards/QuizPane.java
Log:
Changed Layout to better sizes. Fixed a display bug

Added: trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/.settings/org.eclipse.jdt.core.prefs	2004-09-22 00:43:16 UTC (rev 57)
+++ trunk/.settings/org.eclipse.jdt.core.prefs	2004-09-22 00:50:38 UTC (rev 58)
@@ -0,0 +1,61 @@
+#Mon Sep 20 16:46:35 EDT 2004
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.compiler.problem.unusedLocal=error
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.source=1.4
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=default
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+eclipse.preferences.version=1
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=default
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.incompleteClasspath=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled

Modified: trunk/app/Flash.jpx
===================================================================
--- trunk/app/Flash.jpx	2004-09-22 00:43:16 UTC (rev 57)
+++ trunk/app/Flash.jpx	2004-09-22 00:50:38 UTC (rev 58)
@@ -27,6 +27,8 @@
   <property category="sys" name="IncludeTestPath" value="1"/>
   <property category="sys" name="InstanceVisibility" value="2"/>
   <property category="sys" name="JDK" value="java version 1.4.2_05-b04"/>
+  <property category="sys" name="JbxEventListener0" value="org.crosswire.flashcards.FlashCardEventListener"/>
+  <property category="sys" name="JbxEventListener1" value="org.crosswire.flashcards.FlashCardEventListener"/>
   <property category="sys" name="JvmVersion" value="1.4"/>
   <property category="sys" name="LastTag" value="0"/>
   <property category="sys" name="Libraries" value=""/>

Modified: trunk/app/Flash.jpx.local
===================================================================
--- trunk/app/Flash.jpx.local	2004-09-22 00:43:16 UTC (rev 57)
+++ trunk/app/Flash.jpx.local	2004-09-22 00:50:38 UTC (rev 58)
@@ -1,77 +1,89 @@
-build.menu.1[0]=com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make
-build.menu.2[0]=com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;rebuild
-classFilter.unittest.1[0]=junit.framework.*
-classFilter.unittest.2[0]=java.lang.reflect.Method
-classFilter.unittest.3[0]=com.borland.jbuilder.unittest.JBTestRunner
-classFilter.unittest.4[0]=sun.reflect.NativeMethodAccessorImpl
-classFilter.unittest.5[0]=sun.reflect.DelegatingMethodAccessorImpl
-content.layout.xml.[0]=<?xml version="1.0" encoding="UTF-8"?>`n<project-layout>`n  <tab_container selected_index="1">`n    <tab node_name="src/org/crosswire/flashcards/MainFrame.java"/>`n    <tab node_name="src/org/crosswire/flashcards/QuizPane.java"/>`n  </tab_container>`n</project-layout>`n
-debug.NoTracingClasses.1[0]=16 java.lang.Object1  1 -1
-debug.NoTracingClasses.2[0]=21 java.lang.ClassLoader1  1 -1
-debug.NoTracingClasses.3[0]=16 java.lang.String1  1 -1
-debug.SplitThreadsAndDataView[0]=0
-history.files.active[0]=src/org/crosswire/flashcards/QuizPane.java
-history.files.open.1[0]=src/org/crosswire/flashcards/MainFrame.java,F;1,0
-history.files.open.2[0]=src/org/crosswire/flashcards/QuizPane.java,F;1,0
-import.optimize.legacyPropertiesRead[0]=1
-java.classdefaults.1[0]=java.util.Enumeration
-java.classdefaults.2[0]=javax.swing.filechooser.FileFilter
-java.classdefaults.3[0]=java.util.Properties
-java.classdefaults.4[0]=java.util.Hashtable
-java.classdefaults.5[0]=java.util.Set
-packagebrowser.lastClassName[0]=org.crosswire.flashcards.Editor
-sys.Author[0]=
-sys.DefaultPackage[0]=flash
-sys.ReopenHistory.1[0]=E%|/Eclipse/JSword/flashcards/target/jar/flashcards.jar
-sys.ReopenHistory.10[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter12vocab.flash
-sys.ReopenHistory.11[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter11vocab.flash
-sys.ReopenHistory.12[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter10vocab.flash
-sys.ReopenHistory.13[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter09vocab.flash
-sys.ReopenHistory.14[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter08vocab.flash
-sys.ReopenHistory.15[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter07vocab.flash
-sys.ReopenHistory.16[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter06vocab.flash
-sys.ReopenHistory.17[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter05vocab.flash
-sys.ReopenHistory.18[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter04vocab.flash
-sys.ReopenHistory.19[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter03vocab.flash
-sys.ReopenHistory.2[0]=E%|/Eclipse/JSword/flashcards/lessons/black/eimi_pi.flash
-sys.ReopenHistory.20[0]=Flash.jar
-sys.ReopenHistory.21[0]=src/org/crosswire/modedit/UniTextEdit.java
-sys.ReopenHistory.22[0]=src/org/crosswire/modedit/SWInputMethod.java
-sys.ReopenHistory.23[0]=src/org/crosswire/modedit/NullIM.java
-sys.ReopenHistory.24[0]=src/org/crosswire/flashcards/MainFrame_AboutBox.java
-sys.ReopenHistory.25[0]=src/org/crosswire/flashcards/EditorFrame_AboutBox.java
-sys.ReopenHistory.26[0]=src/org/crosswire/flashcards/EditorFrame.java
-sys.ReopenHistory.27[0]=src/flash/Quiz.java
-sys.ReopenHistory.28[0]=src/flash/openFile.png
-sys.ReopenHistory.29[0]=src/flash/OpenFile.java
-sys.ReopenHistory.3[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter21vocab.flash
-sys.ReopenHistory.30[0]=src/flash/MainFrame_AboutBox.java
-sys.ReopenHistory.31[0]=src/flash/MainFrame.java
-sys.ReopenHistory.32[0]=src/flash/help.png
-sys.ReopenHistory.33[0]=Flash.html
-sys.ReopenHistory.34[0]=src/flash/EditorFrame_AboutBox.java
-sys.ReopenHistory.35[0]=src/flash/EditorFrame.java
-sys.ReopenHistory.36[0]=src/flash/Editor.java
-sys.ReopenHistory.37[0]=src/flash/closeFile.png
-sys.ReopenHistory.38[0]=src/flash/about.png
-sys.ReopenHistory.39[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/java/awt/Font.java
-sys.ReopenHistory.4[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter19vocab.flash
-sys.ReopenHistory.40[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/javax/swing/JFileChooser.java
-sys.ReopenHistory.41[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/javax/swing/text/JTextComponent.java
-sys.ReopenHistory.42[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/java/util/Properties.java
-sys.ReopenHistory.5[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter18vocab.flash
-sys.ReopenHistory.6[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter17vocab.flash
-sys.ReopenHistory.7[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter15vocab.flash
-sys.ReopenHistory.8[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter14vocab.flash
-sys.ReopenHistory.9[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter13vocab.flash
-wizard.package.package_history.1[0]=flash
-wizards.classes.class_type_history.1[0]=boolean
-wizards.classes.class_type_history.10[0]=java.lang.String
-wizards.classes.class_type_history.2[0]=byte
-wizards.classes.class_type_history.3[0]=char
-wizards.classes.class_type_history.4[0]=short
-wizards.classes.class_type_history.5[0]=int
-wizards.classes.class_type_history.6[0]=long
-wizards.classes.class_type_history.7[0]=float
-wizards.classes.class_type_history.8[0]=double
-wizards.classes.class_type_history.9[0]=java.lang.Object
+build.menu.1[0]=com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;make
+build.menu.2[0]=com.borland.jbuilder.build.ProjectBuilder$ProjectBuildAction;rebuild
+classFilter.unittest.1[0]=junit.framework.*
+classFilter.unittest.2[0]=java.lang.reflect.Method
+classFilter.unittest.3[0]=com.borland.jbuilder.unittest.JBTestRunner
+classFilter.unittest.4[0]=sun.reflect.NativeMethodAccessorImpl
+classFilter.unittest.5[0]=sun.reflect.DelegatingMethodAccessorImpl
+content.layout.xml.[0]=<?xml version="1.0" encoding="UTF-8"?>`r`n<project-layout>`r`n  <tab_container selected_index="1">`r`n    <tab node_name="src/org/crosswire/flashcards/EditPane.java"/>`r`n    <tab node_name="src/org/crosswire/flashcards/FlashCardEditor.java"/>`r`n    <tab node_name="src/org/crosswire/flashcards/QuizPane.java"/>`r`n    <tab node_name="src/org/crosswire/modedit/UniTextEdit.java"/>`r`n  </tab_container>`r`n</project-layout>`r`n
+debug.NoTracingClasses.1[0]=16 java.lang.Object1  1 -1
+debug.NoTracingClasses.2[0]=21 java.lang.ClassLoader1  1 -1
+debug.NoTracingClasses.3[0]=16 java.lang.String1  1 -1
+debug.SplitThreadsAndDataView[0]=0
+history.files.active[0]=src/org/crosswire/flashcards/FlashCardEditor.java
+history.files.open.1[0]=src/org/crosswire/flashcards/EditPane.java,F;165,6731
+history.files.open.2[0]=src/org/crosswire/flashcards/FlashCardEditor.java,F;76,2656
+history.files.open.3[0]=src/org/crosswire/flashcards/QuizPane.java,F;135,4381
+history.files.open.4[0]=src/org/crosswire/modedit/UniTextEdit.java,F;1,0
+import.optimize.legacyPropertiesRead[0]=1
+java.classdefaults.1[0]=java.util.Enumeration
+java.classdefaults.2[0]=javax.swing.filechooser.FileFilter
+java.classdefaults.3[0]=java.util.Properties
+java.classdefaults.4[0]=java.util.Hashtable
+java.classdefaults.5[0]=java.util.Set
+java.classdefaults.6[0]=org.crosswire.flashcards.Debug
+packagebrowser.lastClassName[0]=org.crosswire.flashcards.Editor
+sys.Author[0]=
+sys.DefaultPackage[0]=flash
+sys.ReopenHistory.1[0]=src/org/crosswire/flashcards/migrate/ImportLesson.java
+sys.ReopenHistory.10[0]=src/org/crosswire/modedit/GreekKeymanIM.java
+sys.ReopenHistory.11[0]=src/org/crosswire/flashcards/FlashCardColumns.java
+sys.ReopenHistory.12[0]=src/org/crosswire/modedit/CGreekIM.java
+sys.ReopenHistory.13[0]=E%|/Eclipse/JSword/flashcards/target/jar/flashcards.jar
+sys.ReopenHistory.14[0]=E%|/Eclipse/JSword/flashcards/lessons/black/eimi_pi.flash
+sys.ReopenHistory.15[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter21vocab.flash
+sys.ReopenHistory.16[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter19vocab.flash
+sys.ReopenHistory.17[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter18vocab.flash
+sys.ReopenHistory.18[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter17vocab.flash
+sys.ReopenHistory.19[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter15vocab.flash
+sys.ReopenHistory.2[0]=src/org/crosswire/modedit/SWInputMethod.java
+sys.ReopenHistory.20[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter14vocab.flash
+sys.ReopenHistory.21[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter13vocab.flash
+sys.ReopenHistory.22[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter12vocab.flash
+sys.ReopenHistory.23[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter11vocab.flash
+sys.ReopenHistory.24[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter10vocab.flash
+sys.ReopenHistory.25[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter09vocab.flash
+sys.ReopenHistory.26[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter08vocab.flash
+sys.ReopenHistory.27[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter07vocab.flash
+sys.ReopenHistory.28[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter06vocab.flash
+sys.ReopenHistory.29[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter05vocab.flash
+sys.ReopenHistory.3[0]=src/org/crosswire/flashcards/SetupPane.java
+sys.ReopenHistory.30[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter04vocab.flash
+sys.ReopenHistory.31[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter03vocab.flash
+sys.ReopenHistory.32[0]=Flash.jar
+sys.ReopenHistory.33[0]=src/org/crosswire/flashcards/MainFrame_AboutBox.java
+sys.ReopenHistory.34[0]=src/org/crosswire/flashcards/EditorFrame_AboutBox.java
+sys.ReopenHistory.35[0]=src/org/crosswire/flashcards/EditorFrame.java
+sys.ReopenHistory.36[0]=src/flash/Quiz.java
+sys.ReopenHistory.37[0]=src/flash/openFile.png
+sys.ReopenHistory.38[0]=src/flash/OpenFile.java
+sys.ReopenHistory.39[0]=src/flash/MainFrame_AboutBox.java
+sys.ReopenHistory.4[0]=src/org/crosswire/modedit/NullIM.java
+sys.ReopenHistory.40[0]=src/flash/MainFrame.java
+sys.ReopenHistory.41[0]=src/flash/help.png
+sys.ReopenHistory.42[0]=Flash.html
+sys.ReopenHistory.43[0]=src/flash/EditorFrame_AboutBox.java
+sys.ReopenHistory.44[0]=src/flash/EditorFrame.java
+sys.ReopenHistory.45[0]=src/flash/Editor.java
+sys.ReopenHistory.46[0]=src/flash/closeFile.png
+sys.ReopenHistory.47[0]=src/flash/about.png
+sys.ReopenHistory.48[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/java/awt/Font.java
+sys.ReopenHistory.49[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/javax/swing/JFileChooser.java
+sys.ReopenHistory.5[0]=src/org/crosswire/flashcards/MainFrame.java
+sys.ReopenHistory.50[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/javax/swing/text/JTextComponent.java
+sys.ReopenHistory.51[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/java/util/Properties.java
+sys.ReopenHistory.6[0]=src/org/crosswire/modedit/Ibycus4IM.java
+sys.ReopenHistory.7[0]=src/org/crosswire/modedit/HebrewMCIM.java
+sys.ReopenHistory.8[0]=src/org/crosswire/modedit/HebrewDurusauIM.java
+sys.ReopenHistory.9[0]=src/org/crosswire/modedit/Gtk2ClassicalGreekIM.java
+wizard.package.package_history.1[0]=flash
+wizards.classes.class_type_history.1[0]=boolean
+wizards.classes.class_type_history.10[0]=java.lang.String
+wizards.classes.class_type_history.2[0]=byte
+wizards.classes.class_type_history.3[0]=char
+wizards.classes.class_type_history.4[0]=short
+wizards.classes.class_type_history.5[0]=int
+wizards.classes.class_type_history.6[0]=long
+wizards.classes.class_type_history.7[0]=float
+wizards.classes.class_type_history.8[0]=double
+wizards.classes.class_type_history.9[0]=java.lang.Object

Modified: trunk/app/src/org/crosswire/flashcards/EditPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/EditPane.java	2004-09-22 00:43:16 UTC (rev 57)
+++ trunk/app/src/org/crosswire/flashcards/EditPane.java	2004-09-22 00:50:38 UTC (rev 58)
@@ -38,7 +38,7 @@
 
 /**
  * An EditPane consists of Lesson Sets, Lessons, Flash Cards and a Flash Card editor.
- * 
+ *
  * @author DM Smith [dmsmith555 at yahoo dot com]
  */
 public class EditPane extends JPanel
@@ -67,7 +67,7 @@
         final FlashCardPane flashCardPanel = new FlashCardPane(true);
         final FlashCardEditor flashCardEditor = new FlashCardEditor();
         final JButton saveButton = new JButton("Save");
-        
+
         saveButton.addActionListener(new ActionListener()
         {
             public void actionPerformed(ActionEvent e)
@@ -75,7 +75,7 @@
                 LessonManager.instance().store();
             }
         });
-        
+
         LessonChangeEventListener changeListener = new LessonChangeEventListener()
         {
             public void lessonChanged(LessonChangeEvent event)
@@ -83,7 +83,7 @@
                 boolean modified = LessonManager.instance().isModified();
                 saveButton.setEnabled(modified);
             }
-            
+
         };
 
         boolean modified = LessonManager.instance().isModified();
@@ -94,7 +94,7 @@
         lessonSetPanel.addLessonChangeEventListener(changeListener);
         lessonPanel.addLessonChangeEventListener(changeListener);
         flashCardPanel.addLessonChangeEventListener(changeListener);
-        
+
         // When flash cards are edited the FlashCard panel is updated
         flashCardEditor.addFlashCardEventListener(flashCardPanel);
 
@@ -131,7 +131,7 @@
                 flashCardPanel.loadFlashCards((Lesson) list.getSelectedValue());
             }
         });
-        
+
         // When a lesson is selected then FlashCards can be edited
         lessonPanel.addListSelectionListener(new ListSelectionListener()
         {
@@ -180,12 +180,12 @@
         flashCardSplitPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "Flash Cards: "));
 
         JSplitPane verticalSplitPane = new FixedSplitPane(JSplitPane.VERTICAL_SPLIT);
-        verticalSplitPane.setDividerLocation(0.4D);
-        verticalSplitPane.setResizeWeight(0.4D);
+        verticalSplitPane.setDividerLocation(0.35D);
+        verticalSplitPane.setResizeWeight(0.35D);
         verticalSplitPane.setTopComponent(lessonSplitPane);
         verticalSplitPane.setBottomComponent(flashCardSplitPane);
         add(verticalSplitPane, BorderLayout.CENTER);
-        
+
         JPanel buttonPane = new JPanel();
         buttonPane.add(saveButton);
         add(buttonPane, BorderLayout.SOUTH);

Modified: trunk/app/src/org/crosswire/flashcards/FlashCardEditor.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/FlashCardEditor.java	2004-09-22 00:43:16 UTC (rev 57)
+++ trunk/app/src/org/crosswire/flashcards/FlashCardEditor.java	2004-09-22 00:50:38 UTC (rev 58)
@@ -6,7 +6,7 @@
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * 
+ *
  * See the GNU General Public License for more details.
  * The License is available on the internet at:
  *     http://www.gnu.org/copyleft/gpl.html,
@@ -14,32 +14,28 @@
  *     Free Software Foundation, Inc.
  *     59 Temple Place - Suite 330
  *     Boston, MA 02111-1307, USA
- * 
+ *
  * The copyright to this program is held by it's authors
  * Copyright: 2004
  */
 package org.crosswire.flashcards;
 
-import java.awt.BorderLayout;
-import java.awt.ComponentOrientation;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
 import javax.swing.BorderFactory;
 import javax.swing.JButton;
 import javax.swing.JDialog;
-import javax.swing.JList;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
 import javax.swing.event.EventListenerList;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
 
 import org.crosswire.modedit.UniTextEdit;
+import java.awt.*;
 
 /**
  * Editor for lessons used by Quiz (part of FlashCards).
- * 
+ *
  * @author Troy A. Griffitts [scribe at crosswire dot org]
  * @author DM Smith [dmsmith555 at yahoo dot com]
  */
@@ -58,6 +54,7 @@
     private JButton btnAdd = new JButton("Add");
     private JButton btnModify = new JButton("Modify");
     private JButton btnDelete = new JButton("Delete");
+    private GridBagLayout gridBagLayout1 = new GridBagLayout();
 
     //
     // Methods
@@ -80,7 +77,7 @@
     //Component initialization
     private void jbInit() throws Exception
     {
-        setLayout(new BorderLayout());
+        setLayout(gridBagLayout1);
         setBorder(BorderFactory.createEtchedBorder());
 
         wordText.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Front"));
@@ -88,21 +85,23 @@
         wordText.showIMSelect(true);
         wordText.setComponentOrientation(ComponentOrientation.UNKNOWN);
         wordText.setFontSize(30);
-        add(wordText, BorderLayout.NORTH);
+        add(wordText,  new GridBagConstraints(0, 0, 1, 1, 0.7, 1.0
+            ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
 
         answers.setSelectionStart(0);
         answers.setText("");
         answerPanel.setLayout(new BorderLayout());
         answerPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Back"));
         answerPanel.add(answers);
-        add(answerPanel, BorderLayout.CENTER);
+        add(answerPanel,  new GridBagConstraints(0, 1, 1, 1, 0.3, 0.0
+            ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 5));
         btnAdd.addActionListener(new ActionListener()
         {
             public void actionPerformed(ActionEvent e)
             {
                 createFlashCard();
             }
-            
+
         });
 
         btnModify.addActionListener(new ActionListener()
@@ -126,11 +125,12 @@
         pnlButtons.add(btnAdd);
         pnlButtons.add(btnModify);
         pnlButtons.add(btnDelete);
-        add(pnlButtons, BorderLayout.SOUTH);
+        add(pnlButtons,  new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
+            ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
 
         setActive(false);
     }
-    
+
     public void setFlashCard(FlashCard newFlashCard)
     {
         boolean selected = newFlashCard != null;
@@ -155,7 +155,7 @@
         btnDelete.setEnabled(selected);
         btnModify.setEnabled(selected);
     }
-    
+
     public void setActive(boolean state)
     {
         btnAdd.setEnabled(state);

Added: trunk/app/src/org/crosswire/flashcards/FlashCardEditor.jbx
===================================================================
--- trunk/app/src/org/crosswire/flashcards/FlashCardEditor.jbx	2004-09-22 00:43:16 UTC (rev 57)
+++ trunk/app/src/org/crosswire/flashcards/FlashCardEditor.jbx	2004-09-22 00:50:38 UTC (rev 58)
@@ -0,0 +1,16 @@
+[PropertyInfo]
+active,boolean,false,false, , ,true,<default>
+answerPanel,JPanel,false,false, , ,false,<default>
+answers,JTextField,false,false, , ,false,<default>
+btnAdd,JButton,false,false, , ,false,<default>
+btnDelete,JButton,false,false, , ,false,<default>
+btnModify,JButton,false,false, , ,false,<default>
+dlgMain,JDialog,false,false, , ,false,<default>
+flashCard,FlashCard,false,false, , ,true,<default>
+gridBagLayout1,GridBagLayout,false,false, , ,false,<default>
+wordText,UniTextEdit,false,false, , ,false,<default>
+[IconNames]
+
+
+
+

Modified: trunk/app/src/org/crosswire/flashcards/MainFrame.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/MainFrame.java	2004-09-22 00:43:16 UTC (rev 57)
+++ trunk/app/src/org/crosswire/flashcards/MainFrame.java	2004-09-22 00:50:38 UTC (rev 58)
@@ -68,7 +68,7 @@
     {
         JPanel contentPane = (JPanel) this.getContentPane();
         contentPane.setLayout(new BorderLayout());
-        this.setSize(new Dimension(640, 480));
+        this.setSize(new Dimension(600, 480));
         this.setTitle("FlashCards  - (c) 2004 CrossWire Bible Society http://crosswire.org");
 
         JTabbedPane tabs = new JTabbedPane();

Modified: trunk/app/src/org/crosswire/flashcards/MainMenu.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/MainMenu.java	2004-09-22 00:43:16 UTC (rev 57)
+++ trunk/app/src/org/crosswire/flashcards/MainMenu.java	2004-09-22 00:50:38 UTC (rev 58)
@@ -66,12 +66,8 @@
 
         // Application Menu -> Editor
 
-        item = new JMenuItem( "Edit" );
-        item.addActionListener( new EditAction( ) );
-        menu1.add( item );
+         // Application Menu -> Debugging
 
-        // Application Menu -> Debugging
-
         if( Debug.getEnabled( ) ) {
 
             menu2 = new JMenu( "Debugging" );
@@ -124,21 +120,6 @@
     //
 
     // ---------------
-    class EditAction extends AbstractAction {
-
-        public void actionPerformed( ActionEvent event ) {
-
-            Debug.trace( this.toString( ), "Beginning\n" );
-            JFrame lessonEditor = new EditorFrame( false );
-            lessonEditor.validate( );
-            lessonEditor.setVisible( true );
-            Debug.trace( this.toString( ), "Ending\n" );
-
-        }
-
-    }
-
-    // ---------------
     class DebugAction extends AbstractAction {
 
         public void actionPerformed( ActionEvent event ) {

Modified: trunk/app/src/org/crosswire/flashcards/QuizPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/QuizPane.java	2004-09-22 00:43:16 UTC (rev 57)
+++ trunk/app/src/org/crosswire/flashcards/QuizPane.java	2004-09-22 00:50:38 UTC (rev 58)
@@ -1,448 +1,431 @@
-/*
- * Distribution Licence:
- * FlashCard is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License,
- * version 2 as published by the Free Software Foundation.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * See the GNU General Public License for more details.
- * The License is available on the internet at:
- *     http://www.gnu.org/copyleft/gpl.html,
- * or by writing to:
- *     Free Software Foundation, Inc.
- *     59 Temple Place - Suite 330
- *     Boston, MA 02111-1307, USA
- *
- * The copyright to this program is held by it's authors
- * Copyright: 2004
- */
-package org.crosswire.flashcards;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.ComponentOrientation;
-import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.GridLayout;
-import java.awt.Insets;
-import java.awt.SystemColor;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.BorderFactory;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.SwingConstants;
-
-
-/**
- * A panel that quizzes over a selection of lessons.
- * 
- * @author Troy A. Griffitts [scribe at crosswire dot org]
- * @author DM Smith [dmsmith555 at yahoo dot com]
- */
-public class QuizPane extends JPanel
-{
-    SetupPane setupPane;
-    Vector words = new Vector();
-    Vector notLearned = new Vector();
-    WordEntry currentWord = null;
-    int wrong = 0;
-    int totalAsked = 0;
-    int totalWrong = 0;
-    boolean shownAnswer = false;
-    JButton startLessonButton = new JButton();
-    JButton showAnswerButton = new JButton();
-    JLabel wordText = new JLabel();
-    JLabel statusBar = new JLabel();
-    JLabel wCount = new JLabel();
-
-    JPanel choicesPanel = new JPanel();
-    GridLayout choicesPanelGridLayout = new GridLayout();
-    JPanel statusPanel = new JPanel();
-    BorderLayout statusPanelBorderLayout = new BorderLayout();
-
-    static class WordEntry
-    {
-        public WordEntry(FlashCard flashCard)
-        {
-            this.flashCard = flashCard;
-        }
-
-        public void incrementFailures(int failures)
-        {
-            attempts += failures;
-        }
-
-        public int getFailures()
-        {
-            return attempts;
-        }
-
-        public String getSide(boolean front)
-        {
-            return flashCard.getSide(front);
-        }
-
-        public String toString()
-        {
-            return flashCard.getFront();
-        }
-        private FlashCard flashCard;
-        private int attempts;
-    }
-
-
-    //Construct the frame
-    public QuizPane(SetupPane setupPane)
-    {
-        this.setupPane = setupPane;
-        try
-        {
-            jbInit();
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-        }
-    }
-
-    //Component initialization
-    private void jbInit() throws Exception
-    {
-        startLessonButton.setText("Start");
-        startLessonButton.addActionListener(new QuizPane_startLessonButton_actionAdapter(this));
-
-        showAnswerButton.setFocusPainted(true);
-        showAnswerButton.setMnemonic('A');
-        showAnswerButton.setText("Show Answer");
-        showAnswerButton.addActionListener(new QuizPane_showAnswerButton_actionAdapter(this));
-
-        wordText.setBackground(SystemColor.text);
-        wordText.setFont(new Font("Dialog", 0, 30));
-        wordText.setHorizontalAlignment(SwingConstants.CENTER);
-        wordText.setHorizontalTextPosition(SwingConstants.CENTER);
- 
-        statusBar.setBorder(BorderFactory.createEtchedBorder());
-        statusBar.setText(" ");
-        wCount.setBorder(BorderFactory.createEtchedBorder());
-
-        choicesPanel.setLayout(choicesPanelGridLayout);
-        choicesPanelGridLayout.setColumns(2);
-        choicesPanelGridLayout.setRows(0);
-
-        statusPanel.setLayout(statusPanelBorderLayout);
-        statusBar.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
-        statusPanel.add(statusBar, BorderLayout.CENTER);
-        statusPanel.add(wCount, BorderLayout.EAST);
-
-        setLayout(new GridBagLayout());
-        GridBagConstraints gbc = new GridBagConstraints();
-
-        gbc.gridx = 0;
-        gbc.weightx = 1.0;
-        gbc.anchor = GridBagConstraints.WEST;
-        add(startLessonButton, gbc);
-        
-        gbc.gridx = 2;
-        gbc.anchor = GridBagConstraints.EAST;
-        add(showAnswerButton, gbc);
-
-        gbc.gridwidth = 3;
-        gbc.gridx = 0;
-        gbc.anchor = GridBagConstraints.NORTH;
-        Insets standardInsets = gbc.insets;
-        gbc.insets = new Insets(30,0,70,0);
-        add(wordText, gbc);
-
-        gbc.weighty = 1.0;
-        gbc.insets = standardInsets;
-        add(choicesPanel, gbc);
-
-        gbc.weighty = 0.0;
-        gbc.fill = GridBagConstraints.HORIZONTAL;
-        gbc.ipadx = 10;
-        gbc.ipady = 10;
-        add(statusPanel, gbc);
-    }
-
-    public void deleteChildren(JComponent c)
-    {
-        while (c.getComponentCount() > 0)
-            c.remove(c.getComponent(0));
-    }
-
-    public void loadTest()
-    {
-//        boolean loadedFont = false;
-        words = new Vector();
-        Iterator lessonIter = setupPane.iterator();
-        while (lessonIter.hasNext())
-        {
-            Lesson lesson = (Lesson) lessonIter.next();
-            Iterator cardIter = lesson.iterator();
-            while (cardIter.hasNext())
-            {
-                words.add(new WordEntry((FlashCard) cardIter.next()));
-            }
-//            if (!loadedFont)
-//            {
-//                String font = lesson.getFont();
-//                if (font.length() > 1)
-//                {
-//                    try
-//                    {
-//                        loadFont(new FileInputStream(font));
-//                        loadedFont = true;
-//                    }
-//                    catch (FileNotFoundException ex)
-//                    {
-//                    }
-//                }
-//            }
-        }
-    }
-
-//    public void loadFont(InputStream is)
-//    {
-//        try
-//        {
-//            statusBar.setText("Loading font...");
-//            statusBar.paintImmediately(statusBar.getVisibleRect());
-//            Font font = Font.createFont(Font.TRUETYPE_FONT, is);
-//            Font newFont = font.deriveFont((float) 18.0);
-//            wordText.setFont(newFont);
-//            is.close();
-//            statusBar.setText("New Font Loaded.");
-//        }
-//        catch (Exception ex)
-//        {
-//            ex.printStackTrace();
-//        }
-//    }
-
-    void startLessonButton_actionPerformed(ActionEvent e)
-    {
-        loadTest();
-        notLearned = (Vector) words.clone();
-        totalAsked = 0;
-        totalWrong = 0;
-        showRandomWord(currentWord);
-    }
-
-    public void showRandomWord(WordEntry last)
-    {
-        deleteChildren(choicesPanel);
-        int numToLearn = notLearned.size();
-        if (numToLearn == 0)
-        {
-            return;
-        }
-        while (currentWord == last)
-        {
-            int wordNum = (int) (Math.random() * notLearned.size());
-            currentWord = (WordEntry) notLearned.get(wordNum);
-        }
-        showWord(currentWord);
-    }
-
-
-    public void showWord(WordEntry w)
-    {
-        currentWord = w;
-        wordText.setText(w.getSide(!setupPane.isFlipped()));
-        Vector choices = (Vector) words.clone();
-        choices.remove(w);
-        
-        // randomly pick answers
-        boolean flipped = setupPane.isFlipped();
-        List picks = new ArrayList();
-        picks.add(createAnswerEntry(w.getSide(flipped)));
-        int size = words.size();
-        while (picks.size() < Math.min(10, size))
-        {
-            int c = (int) (Math.random() * choices.size());
-            WordEntry wc = (WordEntry) choices.get(c);
-            String answer = wc.getSide(flipped);
-            
-            // some times two different word have the same answer
-            if (!picks.contains(answer))
-            {
-                picks.add(createAnswerEntry(answer));
-            	choices.remove(wc);
-            }
-        }
-        // Now randomize these answers. To do this we swap the first one
-        // with another.
-        int c = (int) (Math.random() * picks.size());
-        // If we have selected something other than ourselves.
-        if (c > 0)
-        {
-            picks.add(0, picks.remove(c));
-            picks.add(c, picks.remove(1));
-        }
-        Iterator iter = picks.iterator();
-        while (iter.hasNext())
-        {
-            choicesPanel.add((Component) iter.next());
-        }
-        wrong = 0;
-        shownAnswer = false;
-        updateStats();
-        choicesPanel.repaint();
-    }
-
-
-    Component createAnswerEntry(String answer)
-    {
-        JCheckBox ck = new JCheckBox(answer, false);
-        ck.setFont(new Font("Dialog", 0, 16));
-        ck.addItemListener(new QuizPane_answer_itemAdapter(this));
-        return ck;
-    }
-
-    void updateStats()
-    {
-        int percent = 100;
-        if (totalAsked > 0)
-        {
-            percent = (int) ((((float) (totalAsked - totalWrong)) / (float) totalAsked) * (float) 100);
-        }
-        wCount.setText(Integer.toString(notLearned.size()) + " | " + Integer.toString(totalAsked - totalWrong) + "/" + Integer.toString(totalAsked) + " ("
-                        + Integer.toString(percent) + "%)");
-    }
-
-
-    void answer_itemStateChanged(ItemEvent e)
-    {
-        JCheckBox ck = (JCheckBox) e.getItem();
-        if (ck.isSelected())
-        {
-            totalAsked++;
-            if (ck.getText().compareTo(currentWord.getSide(setupPane.isFlipped())) != 0)
-            {
-                statusBar.setText("Please try again. " + ck.getText() + " is not correct.");
-                wrong++;
-                totalWrong++;
-                ck.setSelected(false);
-            }
-            else
-            {
-                if (notLearned.size() > 1)
-                {
-                    statusBar.setText("Correct.  Try this next word");
-                    if (wrong > 0)
-                    {
-                        currentWord.incrementFailures(wrong);
-                    }
-                    else
-                        currentWord.incrementFailures(-1);
-                    if (currentWord.getFailures() < 0)
-                    {
-                        notLearned.remove(currentWord);
-                    }
-                    showRandomWord(currentWord);
-                }
-                else
-                {
-                    notLearned.remove(currentWord);
-                    deleteChildren(choicesPanel);
-                    wordText.setText("-=+* Great! *+=-");
-                    statusBar.setText("Nice Job!  You've mastered all " + words.size() + " words!");
-                }
-            }
-            updateStats();
-        }
-    }
-
-    public void showAnswer()
-    {
-        for (int i = 0; i < choicesPanel.getComponentCount(); i++)
-        {
-            JCheckBox ck = (JCheckBox) choicesPanel.getComponent(i);
-            if (ck.getText() == currentWord.getSide(setupPane.isFlipped()))
-            {
-                ck.setFont(new Font(ck.getFont().getName(), Font.BOLD | Font.ITALIC, ck.getFont().getSize()));
-                break;
-            }
-        }
-        shownAnswer = true;
-    }
-
-    void showAnswerButton_actionPerformed(ActionEvent e)
-    {
-        if (!shownAnswer)
-        {
-            showAnswer();
-            return;
-        }
-        int next = notLearned.indexOf(currentWord) + 1;
-        if (next == 0)
-        {
-            return;
-        }
-        if (next >= notLearned.size())
-            next = 0;
-        deleteChildren(choicesPanel);
-        showWord((WordEntry) notLearned.get(next));
-        showAnswer();
-    }
-
-}
-
-class QuizPane_startLessonButton_actionAdapter implements ActionListener
-{
-    QuizPane adaptee;
-
-    QuizPane_startLessonButton_actionAdapter(QuizPane adaptee)
-    {
-        this.adaptee = adaptee;
-    }
-
-    public void actionPerformed(ActionEvent e)
-    {
-        adaptee.startLessonButton_actionPerformed(e);
-    }
-}
-
-class QuizPane_answer_itemAdapter implements ItemListener
-{
-    QuizPane adaptee;
-
-    QuizPane_answer_itemAdapter(QuizPane adaptee)
-    {
-        this.adaptee = adaptee;
-    }
-
-    public void itemStateChanged(ItemEvent e)
-    {
-        adaptee.answer_itemStateChanged(e);
-    }
-}
-
-class QuizPane_showAnswerButton_actionAdapter implements ActionListener
-{
-    QuizPane adaptee;
-
-    QuizPane_showAnswerButton_actionAdapter(QuizPane adaptee)
-    {
-        this.adaptee = adaptee;
-    }
-
-    public void actionPerformed(ActionEvent e)
-    {
-        adaptee.showAnswerButton_actionPerformed(e);
-    }
-}
+/*
+ * Distribution Licence:
+ * FlashCard is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General Public License,
+ * version 2 as published by the Free Software Foundation.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU General Public License for more details.
+ * The License is available on the internet at:
+ *     http://www.gnu.org/copyleft/gpl.html,
+ * or by writing to:
+ *     Free Software Foundation, Inc.
+ *     59 Temple Place - Suite 330
+ *     Boston, MA 02111-1307, USA
+ *
+ * The copyright to this program is held by it's authors
+ * Copyright: 2004
+ */
+package org.crosswire.flashcards;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.SwingConstants;
+import java.awt.*;
+
+
+/**
+ * A panel that quizzes over a selection of lessons.
+ *
+ * @author Troy A. Griffitts [scribe at crosswire dot org]
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class QuizPane extends JPanel
+{
+    SetupPane setupPane;
+    Vector words = new Vector();
+    Vector notLearned = new Vector();
+    WordEntry currentWord = null;
+    int wrong = 0;
+    int totalAsked = 0;
+    int totalWrong = 0;
+    boolean shownAnswer = false;
+    JButton startLessonButton = new JButton();
+    JButton showAnswerButton = new JButton();
+    JLabel wordText = new JLabel();
+    JLabel statusBar = new JLabel();
+    JLabel wCount = new JLabel();
+
+    JPanel choicesPanel = new JPanel();
+    GridLayout choicesPanelGridLayout = new GridLayout();
+    JPanel statusPanel = new JPanel();
+    BorderLayout statusPanelBorderLayout = new BorderLayout();
+    GridBagLayout gridBagLayout1 = new GridBagLayout();
+
+    static class WordEntry
+    {
+        public WordEntry(FlashCard flashCard)
+        {
+            this.flashCard = flashCard;
+        }
+
+        public void incrementFailures(int failures)
+        {
+            attempts += failures;
+        }
+
+        public int getFailures()
+        {
+            return attempts;
+        }
+
+        public String getSide(boolean front)
+        {
+            return flashCard.getSide(front);
+        }
+
+        public String toString()
+        {
+            return flashCard.getFront();
+        }
+        private FlashCard flashCard;
+        private int attempts;
+    }
+
+
+    //Construct the frame
+    public QuizPane(SetupPane setupPane)
+    {
+        this.setupPane = setupPane;
+        try
+        {
+            jbInit();
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+        }
+    }
+
+    //Component initialization
+    private void jbInit() throws Exception
+    {
+        startLessonButton.setText("Start");
+        startLessonButton.addActionListener(new QuizPane_startLessonButton_actionAdapter(this));
+
+        showAnswerButton.setFocusPainted(true);
+        showAnswerButton.setMnemonic('A');
+        showAnswerButton.setText("Show Answer");
+        showAnswerButton.addActionListener(new QuizPane_showAnswerButton_actionAdapter(this));
+
+        wordText.setBackground(SystemColor.text);
+        wordText.setFont(new Font("Dialog", 0, 30));
+        wordText.setHorizontalAlignment(SwingConstants.CENTER);
+        wordText.setHorizontalTextPosition(SwingConstants.CENTER);
+
+        statusBar.setBorder(BorderFactory.createEtchedBorder());
+        statusBar.setText(" ");
+        wCount.setBorder(BorderFactory.createEtchedBorder());
+
+        choicesPanel.setLayout(choicesPanelGridLayout);
+        choicesPanelGridLayout.setColumns(1);
+        choicesPanelGridLayout.setRows(0);
+
+        statusPanel.setLayout(statusPanelBorderLayout);
+        statusBar.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        statusPanel.add(statusBar, BorderLayout.CENTER);
+        statusPanel.add(wCount, BorderLayout.EAST);
+
+        setLayout(gridBagLayout1);
+
+        add(startLessonButton,  new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0
+            ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+
+        add(showAnswerButton,  new GridBagConstraints(2, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0
+            ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+
+        add(wordText,  new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 1.0
+            ,GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+
+        add(choicesPanel,  new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 0.0, 1.0
+            ,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
+
+        add(statusPanel,  new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 0.0
+            ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 10, 10));
+    }
+
+    public void deleteChildren(JComponent c)
+    {
+        while (c.getComponentCount() > 0)
+            c.remove(c.getComponent(0));
+    }
+
+    public void loadTest()
+    {
+//        boolean loadedFont = false;
+        words = new Vector();
+        Iterator lessonIter = setupPane.iterator();
+        while (lessonIter.hasNext())
+        {
+            Lesson lesson = (Lesson) lessonIter.next();
+            Iterator cardIter = lesson.iterator();
+            while (cardIter.hasNext())
+            {
+                words.add(new WordEntry((FlashCard) cardIter.next()));
+            }
+//            if (!loadedFont)
+//            {
+//                String font = lesson.getFont();
+//                if (font.length() > 1)
+//                {
+//                    try
+//                    {
+//                        loadFont(new FileInputStream(font));
+//                        loadedFont = true;
+//                    }
+//                    catch (FileNotFoundException ex)
+//                    {
+//                    }
+//                }
+//            }
+        }
+    }
+
+//    public void loadFont(InputStream is)
+//    {
+//        try
+//        {
+//            statusBar.setText("Loading font...");
+//            statusBar.paintImmediately(statusBar.getVisibleRect());
+//            Font font = Font.createFont(Font.TRUETYPE_FONT, is);
+//            Font newFont = font.deriveFont((float) 18.0);
+//            wordText.setFont(newFont);
+//            is.close();
+//            statusBar.setText("New Font Loaded.");
+//        }
+//        catch (Exception ex)
+//        {
+//            ex.printStackTrace();
+//        }
+//    }
+
+    void startLessonButton_actionPerformed(ActionEvent e)
+    {
+        loadTest();
+        notLearned = (Vector) words.clone();
+        totalAsked = 0;
+        totalWrong = 0;
+        showRandomWord(currentWord);
+    }
+
+    public void showRandomWord(WordEntry last)
+    {
+        deleteChildren(choicesPanel);
+        int numToLearn = notLearned.size();
+        if (numToLearn == 0)
+        {
+            return;
+        }
+        while (currentWord == last)
+        {
+            int wordNum = (int) (Math.random() * notLearned.size());
+            currentWord = (WordEntry) notLearned.get(wordNum);
+        }
+        showWord(currentWord);
+    }
+
+
+    public void showWord(WordEntry w)
+    {
+        currentWord = w;
+        wordText.setText(w.getSide(!setupPane.isFlipped()));
+        Vector choices = (Vector) words.clone();
+        choices.remove(w);
+
+        // randomly pick answers
+        boolean flipped = setupPane.isFlipped();
+        List picks = new ArrayList();
+        picks.add(createAnswerEntry(w.getSide(flipped)));
+        int size = words.size();
+        while (picks.size() < Math.min(10, size))
+        {
+            int c = (int) (Math.random() * choices.size());
+            WordEntry wc = (WordEntry) choices.get(c);
+            String answer = wc.getSide(flipped);
+
+            // some times two different word have the same answer
+            if (!picks.contains(answer))
+            {
+                picks.add(createAnswerEntry(answer));
+            	choices.remove(wc);
+            }
+        }
+        // Now randomize these answers. To do this we swap the first one
+        // with another.
+        int c = (int) (Math.random() * picks.size());
+        // If we have selected something other than ourselves.
+        if (c > 0)
+        {
+            picks.add(0, picks.remove(c));
+            picks.add(c, picks.remove(1));
+        }
+        Iterator iter = picks.iterator();
+        while (iter.hasNext())
+        {
+            choicesPanel.add((Component) iter.next());
+        }
+        wrong = 0;
+        shownAnswer = false;
+        updateStats();
+        choicesPanel.invalidate();
+        choicesPanel.validate();
+        choicesPanel.repaint();
+    }
+
+
+    Component createAnswerEntry(String answer)
+    {
+        JCheckBox ck = new JCheckBox(answer, false);
+        ck.setFont(new Font("Dialog", 0, 16));
+        ck.addItemListener(new QuizPane_answer_itemAdapter(this));
+        return ck;
+    }
+
+    void updateStats()
+    {
+        int percent = 100;
+        if (totalAsked > 0)
+        {
+            percent = (int) ((((float) (totalAsked - totalWrong)) / (float) totalAsked) * (float) 100);
+        }
+        wCount.setText(Integer.toString(notLearned.size()) + " | " + Integer.toString(totalAsked - totalWrong) + "/" + Integer.toString(totalAsked) + " ("
+                        + Integer.toString(percent) + "%)");
+    }
+
+
+    void answer_itemStateChanged(ItemEvent e)
+    {
+        JCheckBox ck = (JCheckBox) e.getItem();
+        if (ck.isSelected())
+        {
+            totalAsked++;
+            if (ck.getText().compareTo(currentWord.getSide(setupPane.isFlipped())) != 0)
+            {
+                statusBar.setText("Please try again. " + ck.getText() + " is not correct.");
+                wrong++;
+                totalWrong++;
+                ck.setSelected(false);
+            }
+            else
+            {
+                if (notLearned.size() > 1)
+                {
+                    statusBar.setText("Correct.  Try this next word");
+                    if (wrong > 0)
+                    {
+                        currentWord.incrementFailures(wrong);
+                    }
+                    else
+                        currentWord.incrementFailures(-1);
+                    if (currentWord.getFailures() < 0)
+                    {
+                        notLearned.remove(currentWord);
+                    }
+                    showRandomWord(currentWord);
+                }
+                else
+                {
+                    notLearned.remove(currentWord);
+                    deleteChildren(choicesPanel);
+                    wordText.setText("-=+* Great! *+=-");
+                    statusBar.setText("Nice Job!  You've mastered all " + words.size() + " words!");
+                }
+            }
+            updateStats();
+        }
+    }
+
+    public void showAnswer()
+    {
+        for (int i = 0; i < choicesPanel.getComponentCount(); i++)
+        {
+            JCheckBox ck = (JCheckBox) choicesPanel.getComponent(i);
+            if (ck.getText() == currentWord.getSide(setupPane.isFlipped()))
+            {
+                ck.setFont(new Font(ck.getFont().getName(), Font.BOLD | Font.ITALIC, ck.getFont().getSize()));
+                break;
+            }
+        }
+        shownAnswer = true;
+    }
+
+    void showAnswerButton_actionPerformed(ActionEvent e)
+    {
+        if (!shownAnswer)
+        {
+            showAnswer();
+            return;
+        }
+        int next = notLearned.indexOf(currentWord) + 1;
+        if (next == 0)
+        {
+            return;
+        }
+        if (next >= notLearned.size())
+            next = 0;
+        deleteChildren(choicesPanel);
+        showWord((WordEntry) notLearned.get(next));
+        showAnswer();
+    }
+
+}
+
+class QuizPane_startLessonButton_actionAdapter implements ActionListener
+{
+    QuizPane adaptee;
+
+    QuizPane_startLessonButton_actionAdapter(QuizPane adaptee)
+    {
+        this.adaptee = adaptee;
+    }
+
+    public void actionPerformed(ActionEvent e)
+    {
+        adaptee.startLessonButton_actionPerformed(e);
+    }
+}
+
+class QuizPane_answer_itemAdapter implements ItemListener
+{
+    QuizPane adaptee;
+
+    QuizPane_answer_itemAdapter(QuizPane adaptee)
+    {
+        this.adaptee = adaptee;
+    }
+
+    public void itemStateChanged(ItemEvent e)
+    {
+        adaptee.answer_itemStateChanged(e);
+    }
+}
+
+class QuizPane_showAnswerButton_actionAdapter implements ActionListener
+{
+    QuizPane adaptee;
+
+    QuizPane_showAnswerButton_actionAdapter(QuizPane adaptee)
+    {
+        this.adaptee = adaptee;
+    }
+
+    public void actionPerformed(ActionEvent e)
+    {
+        adaptee.showAnswerButton_actionPerformed(e);
+    }
+}



More information about the sword-cvs mailing list