001    /*
002     * TextAreaCodeSource.java
003     *
004     * Created on December 19, 2002, 3:38 PM
005     */
006    
007    package spirograph;
008    
009    import java.awt.TextArea;
010    
011    /**
012     * A code source that takes student code directly from a pair of
013     * <code>TextArea</code>s.
014     *
015     * @author Patrick G. Heck
016     */
017    public class TextAreaCodeSource implements CodeSource {
018        
019        private TextArea codeTA;
020        
021        private TextArea fieldTA;
022        
023        /**
024         * Creates a new instance of TextAreaCodeSource
025         *
026         * @param cta The <code>TextArea</code> for the code body
027         * @param fta The <code>TextArea</code> for the fields code
028         */
029        public TextAreaCodeSource(TextArea cta, TextArea fta) {
030            fieldTA = fta;
031            codeTA = cta;
032        }
033        
034        /**
035         * Return the contents of the <code>TextArea</code> for the code body.
036         *
037         * @return The student code
038         */    
039        public String getCode() {
040            return codeTA.getText();
041        }
042        
043        /**
044         * Return the contents of the <code>TextArea</code> for the fields.
045         *
046         * @return The student fields
047         */    
048        public String getFields() {
049            return fieldTA.getText();
050        }
051        
052    }
053    
054    /*
055     * $Log: TextAreaCodeSource.java,v $
056     * Revision 1.3  2003/01/17 21:40:11  gus
057     * Javadocs... yeah!
058     *
059     * Revision 1.2  2003/01/15 17:36:10  gus
060     * adding log keywords to files that don't have them
061     *
062     */