[sword-svn] r76 - in trunk: app app/src/org/crosswire/flashcards lessons/GreekParsing

Apache apache at crosswire.org
Sun Oct 31 00:20:55 MST 2004


Author: 
Date: 2004-10-31 00:20:54 -0700 (Sun, 31 Oct 2004)
New Revision: 76

Modified:
   trunk/app/Flash.jpx.local
   trunk/app/src/org/crosswire/flashcards/LessonSetPane.java
   trunk/app/src/org/crosswire/flashcards/QuizPane.java
   trunk/lessons/GreekParsing/VerbIndicImpeAct.flash
Log:
Fixed autoFilename generation
Added support for combining identical front cards


Modified: trunk/app/Flash.jpx.local
===================================================================
--- trunk/app/Flash.jpx.local	2004-10-31 03:19:03 UTC (rev 75)
+++ trunk/app/Flash.jpx.local	2004-10-31 07:20:54 UTC (rev 76)
@@ -5,7 +5,8 @@
 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]=<project-layout><tab_container selected_index="5"><tab node_name="src/org/crosswire/flashcards/EditPane.java"/><tab node_name="src/org/crosswire/flashcards/FlashCardColumns.java"/><tab node_name="src/org/crosswire/flashcards/FlashCardPane.java"/><tab node_name="[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/util/Iterator.java"/><tab node_name="src/org/crosswire/flashcards/Lesson.java"/><tab node_name="src/org/crosswire/flashcards/LessonManager.java"/><tab node_name="src/org/crosswire/flashcards/LessonSet.java"/><tab node_name="src/org/crosswire/common/swing/RowTable.java"/><tab node_name="src/org/crosswire/flashcards/SetupPane.java"/></tab_container></project-layout>
+content.layout.xml.[0]=<project-layout><tab_container selected_index="7"><tab node_name="src/org/crosswire/flashcards/EditPane.java"/><tab node_name="src/org/crosswire/flashcards/FlashCardPane.java"/><tab node_name="src/org/crosswire/flashcards/Lesson.java"/><tab node_name="src/org/crosswire/flashcards/LessonManager.java"/><tab node_name="src/org/crosswire/flashcards/LessonSet.java"/><tab node_name="src/org/crosswire/flashcards/LessonSetPane.java"/><tab node_name="src/org/crosswire/flashcards/MainFrame.java"/><tab node_name="src/org/crosswire/flashcards/QuizPane.java"/><tab node_name="src/org/crosswire/common/swing/RowTable.java"/><tab node_name="src/org/crosswire/flashcards/SetupPane.java"/></tab_container></project-layout>
+debug.Breakpoints.1[0]=1  038 org.crosswire.flashcards.LessonSetPane47 src/org/crosswire/flashcards/LessonSetPane.java3  1271  10  1  10  1  10  1  0 -1
 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
@@ -13,16 +14,17 @@
 debug.Watches.1[0]=1  110 lessonPath10 expression1  02  501  01  01  01  1 -1
 debug.Watches.2[0]=1  111 description10 expression1  02  501  01  01  01  1 -1
 debug.Watches.3[0]=1  19  entryName10 expression1  02  501  01  01  01  1 -1
-history.files.active[0]=src/org/crosswire/flashcards/LessonManager.java,F;101,2152
+history.files.active[0]=src/org/crosswire/flashcards/QuizPane.java,F;196,7367
 history.files.open.1[0]=src/org/crosswire/flashcards/EditPane.java,F;128,6541
-history.files.open.2[0]=src/org/crosswire/flashcards/FlashCardColumns.java,F;1,685
-history.files.open.3[0]=src/org/crosswire/flashcards/FlashCardPane.java,F;41,1342
-history.files.open.4[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/util/Iterator.java,F;29,1367
-history.files.open.5[0]=src/org/crosswire/flashcards/Lesson.java,F;93,2684
-history.files.open.6[0]=src/org/crosswire/flashcards/LessonManager.java,F;101,2152
-history.files.open.7[0]=src/org/crosswire/flashcards/LessonSet.java,F;244,8231
-history.files.open.8[0]=src/org/crosswire/common/swing/RowTable.java,F;227,6666
-history.files.open.9[0]=src/org/crosswire/flashcards/SetupPane.java,F;71,2273
+history.files.open.10[0]=src/org/crosswire/flashcards/SetupPane.java,F;71,2273
+history.files.open.2[0]=src/org/crosswire/flashcards/FlashCardPane.java,F;41,1342
+history.files.open.3[0]=src/org/crosswire/flashcards/Lesson.java,F;93,2684
+history.files.open.4[0]=src/org/crosswire/flashcards/LessonManager.java,F;69,3144
+history.files.open.5[0]=src/org/crosswire/flashcards/LessonSet.java,F;63,2365
+history.files.open.6[0]=src/org/crosswire/flashcards/LessonSetPane.java,F;127,3692
+history.files.open.7[0]=src/org/crosswire/flashcards/MainFrame.java,F;1,0
+history.files.open.8[0]=src/org/crosswire/flashcards/QuizPane.java,F;196,7367
+history.files.open.9[0]=src/org/crosswire/common/swing/RowTable.java,F;227,6666
 import.optimize.legacyPropertiesRead[0]=1
 java.classdefaults.1[0]=java.util.Enumeration
 java.classdefaults.2[0]=javax.swing.filechooser.FileFilter
@@ -35,70 +37,71 @@
 packagebrowser.lastClassName[0]=org.crosswire.flashcards.Editor
 sys.Author[0]=
 sys.DefaultPackage[0]=flash
-sys.ReopenHistory.1[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/util/Set.java
-sys.ReopenHistory.10[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/net/JarURLConnection.java
-sys.ReopenHistory.11[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/net/URLConnection.java
-sys.ReopenHistory.12[0]=src/org/crosswire/flashcards/migrate/ImportLesson.java
-sys.ReopenHistory.13[0]=src/org/crosswire/modedit/SWInputMethod.java
-sys.ReopenHistory.14[0]=src/org/crosswire/flashcards/SetupPane.java
-sys.ReopenHistory.15[0]=src/org/crosswire/modedit/NullIM.java
-sys.ReopenHistory.16[0]=src/org/crosswire/flashcards/MainFrame.java
-sys.ReopenHistory.17[0]=src/org/crosswire/modedit/Ibycus4IM.java
-sys.ReopenHistory.18[0]=src/org/crosswire/modedit/HebrewMCIM.java
-sys.ReopenHistory.19[0]=src/org/crosswire/modedit/HebrewDurusauIM.java
-sys.ReopenHistory.2[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/io/File.java
-sys.ReopenHistory.20[0]=src/org/crosswire/modedit/Gtk2ClassicalGreekIM.java
-sys.ReopenHistory.21[0]=src/org/crosswire/modedit/GreekKeymanIM.java
-sys.ReopenHistory.22[0]=src/org/crosswire/flashcards/FlashCardColumns.java
-sys.ReopenHistory.23[0]=src/org/crosswire/modedit/CGreekIM.java
-sys.ReopenHistory.24[0]=E%|/Eclipse/JSword/flashcards/target/jar/flashcards.jar
-sys.ReopenHistory.25[0]=E%|/Eclipse/JSword/flashcards/lessons/black/eimi_pi.flash
-sys.ReopenHistory.26[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter21vocab.flash
-sys.ReopenHistory.27[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter19vocab.flash
-sys.ReopenHistory.28[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter18vocab.flash
-sys.ReopenHistory.29[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter17vocab.flash
-sys.ReopenHistory.3[0]=[/space/opt/JBuilder2005/jdk1.4/jre/lib/rt.jar]/sun/misc/Launcher.class
-sys.ReopenHistory.30[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter15vocab.flash
-sys.ReopenHistory.31[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter14vocab.flash
-sys.ReopenHistory.32[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter13vocab.flash
-sys.ReopenHistory.33[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter12vocab.flash
-sys.ReopenHistory.34[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter11vocab.flash
-sys.ReopenHistory.35[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter10vocab.flash
-sys.ReopenHistory.36[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter09vocab.flash
-sys.ReopenHistory.37[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter08vocab.flash
-sys.ReopenHistory.38[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter07vocab.flash
-sys.ReopenHistory.39[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter06vocab.flash
-sys.ReopenHistory.4[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/net/URL.java
-sys.ReopenHistory.40[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter05vocab.flash
-sys.ReopenHistory.41[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter04vocab.flash
-sys.ReopenHistory.42[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter03vocab.flash
-sys.ReopenHistory.43[0]=Flash.jar
-sys.ReopenHistory.44[0]=src/org/crosswire/flashcards/MainFrame_AboutBox.java
-sys.ReopenHistory.45[0]=src/org/crosswire/flashcards/EditorFrame_AboutBox.java
-sys.ReopenHistory.46[0]=src/org/crosswire/flashcards/EditorFrame.java
-sys.ReopenHistory.47[0]=src/flash/Quiz.java
-sys.ReopenHistory.48[0]=src/flash/openFile.png
-sys.ReopenHistory.49[0]=src/flash/OpenFile.java
-sys.ReopenHistory.5[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/util/TreeSet.java
-sys.ReopenHistory.50[0]=src/flash/MainFrame_AboutBox.java
-sys.ReopenHistory.51[0]=src/flash/MainFrame.java
-sys.ReopenHistory.52[0]=src/flash/help.png
-sys.ReopenHistory.53[0]=Flash.html
-sys.ReopenHistory.54[0]=src/flash/EditorFrame_AboutBox.java
-sys.ReopenHistory.55[0]=src/flash/EditorFrame.java
-sys.ReopenHistory.56[0]=src/flash/Editor.java
-sys.ReopenHistory.57[0]=src/flash/closeFile.png
-sys.ReopenHistory.58[0]=src/flash/about.png
-sys.ReopenHistory.59[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/java/awt/Font.java
-sys.ReopenHistory.6[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/lang/StringBuffer.java
-sys.ReopenHistory.60[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/javax/swing/JFileChooser.java
-sys.ReopenHistory.61[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/javax/swing/text/JTextComponent.java
-sys.ReopenHistory.62[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/java/util/Properties.java
-sys.ReopenHistory.7[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/lang/System.java
-sys.ReopenHistory.8[0]=src/org/crosswire/common/util/CWClassLoader.java
-sys.ReopenHistory.9[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/lang/Class.java
+sys.ReopenHistory.1[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/util/Iterator.java
+sys.ReopenHistory.10[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/lang/System.java
+sys.ReopenHistory.11[0]=src/org/crosswire/common/util/CWClassLoader.java
+sys.ReopenHistory.12[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/lang/Class.java
+sys.ReopenHistory.13[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/net/JarURLConnection.java
+sys.ReopenHistory.14[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/net/URLConnection.java
+sys.ReopenHistory.15[0]=src/org/crosswire/flashcards/migrate/ImportLesson.java
+sys.ReopenHistory.16[0]=src/org/crosswire/modedit/SWInputMethod.java
+sys.ReopenHistory.17[0]=src/org/crosswire/flashcards/SetupPane.java
+sys.ReopenHistory.18[0]=src/org/crosswire/modedit/NullIM.java
+sys.ReopenHistory.19[0]=src/org/crosswire/modedit/Ibycus4IM.java
+sys.ReopenHistory.2[0]=src/org/crosswire/flashcards/FlashCardColumns.java
+sys.ReopenHistory.20[0]=src/org/crosswire/modedit/HebrewMCIM.java
+sys.ReopenHistory.21[0]=src/org/crosswire/modedit/HebrewDurusauIM.java
+sys.ReopenHistory.22[0]=src/org/crosswire/modedit/Gtk2ClassicalGreekIM.java
+sys.ReopenHistory.23[0]=src/org/crosswire/modedit/GreekKeymanIM.java
+sys.ReopenHistory.24[0]=src/org/crosswire/modedit/CGreekIM.java
+sys.ReopenHistory.25[0]=E%|/Eclipse/JSword/flashcards/target/jar/flashcards.jar
+sys.ReopenHistory.26[0]=E%|/Eclipse/JSword/flashcards/lessons/black/eimi_pi.flash
+sys.ReopenHistory.27[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter21vocab.flash
+sys.ReopenHistory.28[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter19vocab.flash
+sys.ReopenHistory.29[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter18vocab.flash
+sys.ReopenHistory.3[0]=src/org/crosswire/flashcards/LessonSetPane.java
+sys.ReopenHistory.30[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter17vocab.flash
+sys.ReopenHistory.31[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter15vocab.flash
+sys.ReopenHistory.32[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter14vocab.flash
+sys.ReopenHistory.33[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter13vocab.flash
+sys.ReopenHistory.34[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter12vocab.flash
+sys.ReopenHistory.35[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter11vocab.flash
+sys.ReopenHistory.36[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter10vocab.flash
+sys.ReopenHistory.37[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter09vocab.flash
+sys.ReopenHistory.38[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter08vocab.flash
+sys.ReopenHistory.39[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter07vocab.flash
+sys.ReopenHistory.4[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/util/Set.java
+sys.ReopenHistory.40[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter06vocab.flash
+sys.ReopenHistory.41[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter05vocab.flash
+sys.ReopenHistory.42[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter04vocab.flash
+sys.ReopenHistory.43[0]=E%|/Eclipse/JSword/flashcards/lessons/black/chapter03vocab.flash
+sys.ReopenHistory.44[0]=Flash.jar
+sys.ReopenHistory.45[0]=src/org/crosswire/flashcards/MainFrame_AboutBox.java
+sys.ReopenHistory.46[0]=src/org/crosswire/flashcards/EditorFrame_AboutBox.java
+sys.ReopenHistory.47[0]=src/org/crosswire/flashcards/EditorFrame.java
+sys.ReopenHistory.48[0]=src/flash/Quiz.java
+sys.ReopenHistory.49[0]=src/flash/openFile.png
+sys.ReopenHistory.5[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/io/File.java
+sys.ReopenHistory.50[0]=src/flash/OpenFile.java
+sys.ReopenHistory.51[0]=src/flash/MainFrame_AboutBox.java
+sys.ReopenHistory.52[0]=src/flash/MainFrame.java
+sys.ReopenHistory.53[0]=src/flash/help.png
+sys.ReopenHistory.54[0]=Flash.html
+sys.ReopenHistory.55[0]=src/flash/EditorFrame_AboutBox.java
+sys.ReopenHistory.56[0]=src/flash/EditorFrame.java
+sys.ReopenHistory.57[0]=src/flash/Editor.java
+sys.ReopenHistory.58[0]=src/flash/closeFile.png
+sys.ReopenHistory.59[0]=src/flash/about.png
+sys.ReopenHistory.6[0]=[/space/opt/JBuilder2005/jdk1.4/jre/lib/rt.jar]/sun/misc/Launcher.class
+sys.ReopenHistory.60[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/java/awt/Font.java
+sys.ReopenHistory.61[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/javax/swing/JFileChooser.java
+sys.ReopenHistory.62[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/javax/swing/text/JTextComponent.java
+sys.ReopenHistory.63[0]=[/space/opt/JBuilderX/jdk1.4/src.zip]/java/util/Properties.java
+sys.ReopenHistory.7[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/net/URL.java
+sys.ReopenHistory.8[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/util/TreeSet.java
+sys.ReopenHistory.9[0]=[/space/opt/JBuilder2005/jdk1.4/src.zip]/java/lang/StringBuffer.java
 team.ActiveVCS[0]=Subversion
-team.lastScanned[0]=1099192590199
+team.lastScanned[0]=1099207059759
 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

Modified: trunk/app/src/org/crosswire/flashcards/LessonSetPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/LessonSetPane.java	2004-10-31 03:19:03 UTC (rev 75)
+++ trunk/app/src/org/crosswire/flashcards/LessonSetPane.java	2004-10-31 07:20:54 UTC (rev 76)
@@ -41,7 +41,7 @@
 
 /**
  * A panel consisting of all the lesson sets known to FlashCards.
- * 
+ *
  * @author DM Smith [dmsmith555 at yahoo dot com]
  */
 public class LessonSetPane extends JPanel
@@ -124,7 +124,7 @@
 
     public void createLessonSet(String name)
     {
-        LessonSet lessonSet = new LessonSet(LessonManager.LESSON_ROOT + '/' + name);
+        LessonSet lessonSet = new LessonSet("file:"+LessonManager.instance().getHomeProjectPath() + "/" + LessonManager.LESSON_ROOT + '/' + name);
         DefaultListModel model = (DefaultListModel) lessonSetList.getModel();
         if (!model.contains(lessonSet))
         {
@@ -186,4 +186,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}

Modified: trunk/app/src/org/crosswire/flashcards/QuizPane.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/QuizPane.java	2004-10-31 03:19:03 UTC (rev 75)
+++ trunk/app/src/org/crosswire/flashcards/QuizPane.java	2004-10-31 07:20:54 UTC (rev 76)
@@ -46,143 +46,144 @@
  * @author Troy A. Griffitts [scribe at crosswire dot org]
  * @author DM Smith [dmsmith555 at yahoo dot com]
  */
-public class QuizPane extends JPanel
-{
-    private static final int NUM_COLUMNS = 2;
-    // NUM_ANSWERS should be a multiple of NUM_COLUMNS.
-    private static final int NUM_ANSWERS = 10;
-    
-    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();
+public class QuizPane
+          extends JPanel {
+     private static final int NUM_COLUMNS = 2;
+     // NUM_ANSWERS should be a multiple of NUM_COLUMNS.
+     private static final int NUM_ANSWERS = 10;
 
-    JPanel choicesPanel = new JPanel();
-    GridLayout choicesPanelGridLayout = new GridLayout();
-    JPanel statusPanel = new JPanel();
-    BorderLayout statusPanelBorderLayout = new BorderLayout();
-    GridBagLayout gridBagLayout1 = new GridBagLayout();
+     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();
 
-    static class WordEntry
-    {
-        public WordEntry(FlashCard flashCard)
-        {
-            this.flashCard = flashCard;
-        }
+     JPanel choicesPanel = new JPanel();
+     GridLayout choicesPanelGridLayout = new GridLayout();
+     JPanel statusPanel = new JPanel();
+     BorderLayout statusPanelBorderLayout = new BorderLayout();
+     GridBagLayout gridBagLayout1 = new GridBagLayout();
 
-        public void incrementFailures(int failures)
-        {
-            attempts += failures;
-        }
+     static class WordEntry {
+          public WordEntry(FlashCard flashCard) {
+               this.flashCard = flashCard;
+          }
 
-        public int getFailures()
-        {
-            return attempts;
-        }
 
-        public String getSide(boolean front)
-        {
-            return flashCard.getSide(front);
-        }
+          public void incrementFailures(int failures) {
+               attempts += failures;
+          }
 
-        public String toString()
-        {
-            return flashCard.getFront();
-        }
-        private FlashCard flashCard;
-        private int attempts;
-    }
 
+          public int getFailures() {
+               return 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));
+          public String getSide(boolean front) {
+               return flashCard.getSide(front);
+          }
 
-        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);
+          public String toString() {
+               return flashCard.getFront();
+          }
 
-        statusBar.setBorder(BorderFactory.createEtchedBorder());
-        statusBar.setText(" ");
-        wCount.setBorder(BorderFactory.createEtchedBorder());
 
-        choicesPanel.setLayout(choicesPanelGridLayout);
-        choicesPanelGridLayout.setColumns(NUM_COLUMNS);
-        choicesPanelGridLayout.setRows(0);
+          private FlashCard flashCard;
+          private int attempts;
+     }
 
-        statusPanel.setLayout(statusPanelBorderLayout);
-        statusBar.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
-        statusPanel.add(statusBar, BorderLayout.CENTER);
-        statusPanel.add(wCount, BorderLayout.EAST);
 
-        setLayout(gridBagLayout1);
+     //Construct the frame
+     public QuizPane(SetupPane setupPane) {
+          this.setupPane = setupPane;
+          try {
+               jbInit();
+          }
+          catch (Exception e) {
+               e.printStackTrace();
+          }
+     }
 
-        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));
+     //Component initialization
+     private void jbInit() throws Exception {
+          startLessonButton.setText("Start");
+          startLessonButton.addActionListener(new QuizPane_startLessonButton_actionAdapter(this));
 
-        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));
+          showAnswerButton.setFocusPainted(true);
+          showAnswerButton.setMnemonic('A');
+          showAnswerButton.setText("Show Answer");
+          showAnswerButton.addActionListener(new QuizPane_showAnswerButton_actionAdapter(this));
 
-        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));
+          wordText.setBackground(SystemColor.text);
+          wordText.setFont(new Font("Dialog", 0, 30));
+          wordText.setHorizontalAlignment(SwingConstants.CENTER);
+          wordText.setHorizontalTextPosition(SwingConstants.CENTER);
 
-        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));
-    }
+          statusBar.setBorder(BorderFactory.createEtchedBorder());
+          statusBar.setText(" ");
+          wCount.setBorder(BorderFactory.createEtchedBorder());
 
-    public void deleteChildren(JComponent c)
-    {
-        while (c.getComponentCount() > 0)
-            c.remove(c.getComponent(0));
-    }
+          choicesPanel.setLayout(choicesPanelGridLayout);
+          choicesPanelGridLayout.setColumns(NUM_COLUMNS);
+          choicesPanelGridLayout.setRows(0);
 
-    public void loadTest()
-    {
+          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()));
-            }
+          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();
@@ -198,9 +199,22 @@
 //                    }
 //                }
 //            }
-        }
-    }
+          }
+          // let's combine duplicate words
+          for (int i = 0; i < words.size() - 1; i++) {
+               WordEntry w = (WordEntry) words.get(i);
+               for (int j = i + 1; j < words.size(); j++) {
+                    WordEntry x = (WordEntry) words.get(j);
+                    if (w.flashCard.getFront().equals(x.flashCard.getFront())) {
+                         w.flashCard.setBack(w.flashCard.getBack() + " or " + x.flashCard.getBack());
+                         words.remove(j);
+                         j--;
+                    }
+               }
+          }
+     }
 
+
 //    public void loadFont(InputStream is)
 //    {
 //        try
@@ -219,258 +233,226 @@
 //        }
 //    }
 
-    void startLessonButton_actionPerformed(ActionEvent e)
-    {
-        loadTest();
-        notLearned = (Vector) words.clone();
-        totalAsked = 0;
-        totalWrong = 0;
-        showRandomWord(currentWord);
-    }
+     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 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()));
-        if(setupPane.isNoMultipleChoice())
-        {
-            choicesPanel.invalidate();
-            choicesPanel.validate();
-            choicesPanel.repaint();
-        }
-        else
-        {
-            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(NUM_ANSWERS, size))
-            {
-                int c = (int) (Math.random() * choices.size());
-                WordEntry wc = (WordEntry) choices.get(c);
-                String answer = wc.getSide(flipped);
+     public void showWord(WordEntry w) {
+          currentWord = w;
+          wordText.setText(w.getSide(!setupPane.isFlipped()));
+          if (setupPane.isNoMultipleChoice()) {
+               choicesPanel.invalidate();
+               choicesPanel.validate();
+               choicesPanel.repaint();
+          }
+          else {
+               Vector choices = (Vector) words.clone();
+               choices.remove(w);
 
-                // 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();
-        }
-    }
+               // 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(NUM_ANSWERS, 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) + "%)");
-    }
+     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 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);
+     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
-                        currentWord.incrementFailures(-1);
-                    if (currentWord.getFailures() < 0)
-                    {
-                        notLearned.remove(currentWord);
+                    else {
+                         notLearned.remove(currentWord);
+                         deleteChildren(choicesPanel);
+                         wordText.setText("-=+* Great! *+=-");
+                         statusBar.setText("Nice Job!  You've mastered all " + words.size() + " words!");
                     }
-                    showRandomWord(currentWord);
-                }
-                else
-                {
+               }
+               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 (setupPane.isNoMultipleChoice()) {
+               ++totalAsked; String dialogString = new String(currentWord.getSide(!setupPane.isFlipped()) + "\n" +
+                         currentWord.getSide(setupPane.isFlipped()) + "\n" + "Did You Get It Right?\n");
+               int choice = JOptionPane.showConfirmDialog(this, dialogString, "Result", JOptionPane.YES_NO_OPTION);
+               if (JOptionPane.YES_OPTION == choice) {
                     notLearned.remove(currentWord);
-                    deleteChildren(choicesPanel);
+               }
+               else {
+                    ++totalWrong;
+               }
+               updateStats();
+               if (notLearned.size() > 0) {
+                    showRandomWord(currentWord);
+               }
+               else {
                     wordText.setText("-=+* Great! *+=-");
                     statusBar.setText("Nice Job!  You've mastered all " + words.size() + " words!");
-                }
-            }
-            updateStats();
-        }
-    }
+               }
+          }
+          else {
+               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();
+          }
+     }
 
-    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 (setupPane.isNoMultipleChoice())
-        {
-            ++totalAsked;
-            String dialogString = new String(currentWord.getSide(!setupPane.isFlipped())+"\n"+
-                                             currentWord.getSide(setupPane.isFlipped())+"\n"+
-                                             "Did You Get It Right?\n");
-            int choice = JOptionPane.showConfirmDialog(this,dialogString,"Result",
-                                                       JOptionPane.YES_NO_OPTION);
-            if (JOptionPane.YES_OPTION == choice)
-            {
-                notLearned.remove(currentWord);
-            }
-            else
-            {
-                ++totalWrong;
-            }
-            updateStats();
-            if (notLearned.size() > 0)
-            {
-                showRandomWord(currentWord);
-            }
-            else
-            {
-                wordText.setText("-=+* Great! *+=-");
-                statusBar.setText("Nice Job!  You've mastered all " + words.size() + " words!");
-            }
-        }
-        else
-        {
-            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;
 
-class QuizPane_startLessonButton_actionAdapter implements ActionListener
-{
-    QuizPane adaptee;
+     QuizPane_startLessonButton_actionAdapter(QuizPane adaptee) {
+          this.adaptee = adaptee;
+     }
 
-    QuizPane_startLessonButton_actionAdapter(QuizPane adaptee)
-    {
-        this.adaptee = adaptee;
-    }
 
-    public void actionPerformed(ActionEvent e)
-    {
-        adaptee.startLessonButton_actionPerformed(e);
-    }
+     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;
-    }
+class QuizPane_answer_itemAdapter
+          implements ItemListener {
+     QuizPane adaptee;
 
-    public void itemStateChanged(ItemEvent e)
-    {
-        adaptee.answer_itemStateChanged(e);
-    }
+     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;
-    }
+class QuizPane_showAnswerButton_actionAdapter
+          implements ActionListener {
+     QuizPane adaptee;
 
-    public void actionPerformed(ActionEvent e)
-    {
-        adaptee.showAnswerButton_actionPerformed(e);
-    }
+     QuizPane_showAnswerButton_actionAdapter(QuizPane adaptee) {
+          this.adaptee = adaptee;
+     }
+
+
+     public void actionPerformed(ActionEvent e) {
+          adaptee.showAnswerButton_actionPerformed(e);
+     }
 }

Modified: trunk/lessons/GreekParsing/VerbIndicImpeAct.flash
===================================================================
--- trunk/lessons/GreekParsing/VerbIndicImpeAct.flash	2004-10-31 03:19:03 UTC (rev 75)
+++ trunk/lessons/GreekParsing/VerbIndicImpeAct.flash	2004-10-31 07:20:54 UTC (rev 76)
@@ -2,13 +2,15 @@
 #Sun Sep 26 22:46:54 GMT-07:00 2004
 answers4=IAI-1P
 answers3=IAI-2P
-answers2=IAI-1S or IAI-3P
-wordCount=5
+answers2=IAI-1S
+answers5=IAI-3P
+wordCount=6
 word4=\u03B5\u0313\u03BB\u03C5\u0301\u03BF\u03BC\u03B5\u03BD
 answers1=IAI-2S
 word3=\u03B5\u0313\u03BB\u03C5\u0301\u03B5\u03C4\u03B5
 answers0=IAI-3S
 word2=\u03B5\u0313\u0301\u03BB\u03C5\u03BF\u03BD
+word5=\u03B5\u0313\u0301\u03BB\u03C5\u03BF\u03BD
 word1=\u03B5\u0313\u0301\u03BB\u03C5\u03B5\u03C2
 word0=\u03B5\u0313\u0301\u03BB\u03C5\u03B5(\u03BD)
 lessonTitle=VerbIndicImpeAct



More information about the sword-cvs mailing list