Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 50918 invoked from network); 30 Oct 2006 06:58:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Oct 2006 06:58:36 -0000 Received: (qmail 84947 invoked by uid 500); 30 Oct 2006 06:58:46 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 84855 invoked by uid 500); 30 Oct 2006 06:58:46 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 84844 invoked by uid 500); 30 Oct 2006 06:58:46 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 84841 invoked by uid 99); 30 Oct 2006 06:58:46 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Oct 2006 22:58:46 -0800 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Oct 2006 22:58:34 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 8D17E1A9846; Sun, 29 Oct 2006 22:58:11 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r469081 - in /webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck: ./ src/ src/spellcheck/ src/spellcheck/text_editor/ Date: Mon, 30 Oct 2006 06:58:11 -0000 To: axis2-cvs@ws.apache.org From: sanka@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061030065811.8D17E1A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sanka Date: Sun Oct 29 22:58:10 2006 New Revision: 469081 URL: http://svn.apache.org/viewvc?view=rev&rev=469081 Log: Added the new code for this sample Added: webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/build.xml webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/ webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/ webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/ webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/AsyncPanel.java webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/FormModel.java webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/Observer.java webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SimplifiedSpellCheckCallbackHandlerImpl.java webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SuggestionForm.java webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SyncPanel.java Added: webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/build.xml URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/build.xml?view=auto&rev=469081 ============================================================================== --- webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/build.xml (added) +++ webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/build.xml Sun Oct 29 22:58:10 2006 @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Added: webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/AsyncPanel.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/AsyncPanel.java?view=auto&rev=469081 ============================================================================== --- webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/AsyncPanel.java (added) +++ webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/AsyncPanel.java Sun Oct 29 22:58:10 2006 @@ -0,0 +1,110 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package spellcheck.text_editor; + +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; + +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +/** + * class sample.google.spellcheck.AsyncPanel + * This Impements its own GUI of the Asynchronous Client and it updates the string after getting the response to textarea + */ +public class AsyncPanel extends javax.swing.JPanel implements Observer, + KeyListener { + FormModel formModel; + JTextArea writingTextArea; + JTextArea displayTextArea; + JTextField errorMessageField; + + public AsyncPanel() { + GridBagLayout gbLayout = new GridBagLayout(); + GridBagConstraints constraint = new GridBagConstraints(); + this.setLayout(gbLayout); + + formModel = new FormModel(this); + + writingTextArea = new JTextArea(); + writingTextArea.setLineWrap(true); + + displayTextArea = new JTextArea(); + displayTextArea.setEditable(false); + displayTextArea.setLineWrap(true); + + errorMessageField = new JTextField(); + errorMessageField.setEditable(false); + errorMessageField.setBackground(Color.LIGHT_GRAY); + errorMessageField.setForeground(Color.RED); + + JScrollPane scrollPaneGet = new JScrollPane(writingTextArea); + JScrollPane scrollPaneSet = new JScrollPane(displayTextArea); + + writingTextArea.setText("Enter a String"); + writingTextArea.addKeyListener(this); + + constraint.fill = GridBagConstraints.BOTH; + constraint.gridx = 0; + constraint.weightx = 1; + constraint.weighty = 8; + gbLayout.setConstraints(scrollPaneGet, constraint); + this.add(scrollPaneGet); + gbLayout.setConstraints(scrollPaneSet, constraint); + this.add(scrollPaneSet); + constraint.weighty = 1; + gbLayout.setConstraints(errorMessageField, constraint); + this.add(errorMessageField); + + + } + + public void update(String message) { + displayTextArea.setText(displayTextArea.getText() + " " + message); + } + + //updates the error message to the error message display area + public void updateError(String message) { + errorMessageField.setText(message); + } + + + public void keyPressed(KeyEvent e) { + int key = e.getKeyChar(); + if ((key == KeyEvent.VK_SPACE) || (key == KeyEvent.VK_ENTER)) { + String[] words = writingTextArea.getText().split("\\s"); + if (words.length > 0) + formModel.doAsyncSpellingSuggestion(words[words.length - 1]); + } + } + + public void keyReleased(KeyEvent e) { + } + + public void keyTyped(KeyEvent e) { + } + + public void clear() { + displayTextArea.setText(""); + writingTextArea.setText(""); + errorMessageField.setText(""); + } +} Added: webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/FormModel.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/FormModel.java?view=auto&rev=469081 ============================================================================== --- webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/FormModel.java (added) +++ webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/FormModel.java Sun Oct 29 22:58:10 2006 @@ -0,0 +1,76 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package spellcheck.text_editor; + + +import spellcheck_stub.SimplifiedSpellCheckStub; +import spellcheck_stub.SimplifiedSpellCheckStub.DoSpellingSuggestions; +import spellcheck_stub.SimplifiedSpellCheckStub.DoSpellingSuggestionsResponse; + +/** + * class sample.google.spellcheck.FormModel + * This is the Impementation of the Asynchronous Client + */ +public class FormModel { + Observer observer; + + public FormModel(Observer observer) { + this.observer = observer; + } + + public void doAsyncSpellingSuggestion(String word) { + + try { + + SimplifiedSpellCheckStub stub = new SimplifiedSpellCheckStub(); + + DoSpellingSuggestions doSpellingSuggestions = new DoSpellingSuggestions(); + doSpellingSuggestions.setPhrase(word); + + SimplifiedSpellCheckCallbackHandlerImpl callbackHandlerImpl = new SimplifiedSpellCheckCallbackHandlerImpl(observer, word); + + stub.startdoSpellingSuggestions(doSpellingSuggestions, callbackHandlerImpl); + + } catch (Exception ex) { + observer.updateError(ex.getMessage()); + } + } + + public void doSyncSpellingSuggestion(String word) { + + try { + SimplifiedSpellCheckStub stub = new SimplifiedSpellCheckStub(); + + DoSpellingSuggestions suggestions = new DoSpellingSuggestions(); + suggestions.setPhrase(word); + + DoSpellingSuggestionsResponse response = stub.doSpellingSuggestions(suggestions); + String suggestion = response.get_return(); + + if (suggestion == null) { + observer.update("No suggestions found for " + word); + + } else { + observer.update(suggestion); + } + + } catch (Exception ex) { + observer.updateError(ex.getMessage()); + } + } + +} Added: webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/Observer.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/Observer.java?view=auto&rev=469081 ============================================================================== --- webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/Observer.java (added) +++ webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/Observer.java Sun Oct 29 22:58:10 2006 @@ -0,0 +1,31 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package spellcheck.text_editor; + + +/** + * interface sample.google.spellcheck.Observer + */ +public interface Observer { + // updates the message to the main test display area + public void update(String message); + + //updates the error message to the error message display area + public void updateError(String message); + + public void clear(); +} Added: webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SimplifiedSpellCheckCallbackHandlerImpl.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SimplifiedSpellCheckCallbackHandlerImpl.java?view=auto&rev=469081 ============================================================================== --- webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SimplifiedSpellCheckCallbackHandlerImpl.java (added) +++ webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SimplifiedSpellCheckCallbackHandlerImpl.java Sun Oct 29 22:58:10 2006 @@ -0,0 +1,53 @@ +package spellcheck.text_editor; + +import spellcheck_stub.SimplifiedSpellCheckCallbackHandler; +import spellcheck_stub.SimplifiedSpellCheckStub.DoSpellingSuggestionsResponse; + +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +public class SimplifiedSpellCheckCallbackHandlerImpl extends SimplifiedSpellCheckCallbackHandler { + + private Observer observer = null; + private String phrase = null; + + public SimplifiedSpellCheckCallbackHandlerImpl(Observer observer, String phrase) { + this.observer = observer; + this.phrase = phrase; + } + + public void receiveResultdoSpellingSuggestions(DoSpellingSuggestionsResponse param1) { + String suggestion = param1.get_return(); + + if (suggestion == null) { + observer.update(phrase); + observer.updateError( + "No suggestions found for " + phrase); + } else { + observer.update(suggestion); + } + } + + public void receiveErrordoSpellingSuggestions(Exception e) { + e.printStackTrace(); + observer.updateError(e.getMessage()); + } + + + + +} + Added: webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SuggestionForm.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SuggestionForm.java?view=auto&rev=469081 ============================================================================== --- webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SuggestionForm.java (added) +++ webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SuggestionForm.java Sun Oct 29 22:58:10 2006 @@ -0,0 +1,205 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package spellcheck.text_editor; + +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.HeadlessException; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.io.File; +import java.io.IOException; + +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.KeyStroke; +import javax.swing.WindowConstants; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; + +/** + * class sample.google.spellcheck.SuggestionForm + * This is the implementation of the GUI + */ +public class SuggestionForm extends javax.swing.JFrame implements HyperlinkListener { + private AsyncPanel asyncPanel; + private SyncPanel syncPanel; + private JEditorPane helpDisplayPane; + + private JMenuItem syncMenuItem; + private JMenuItem asyncMenuItem; + private static final String HELP_FILE_NAME = "/docs/GoogleSpellCheck.html"; + + + public SuggestionForm() throws HeadlessException { + asyncPanel = new AsyncPanel(); + syncPanel = new SyncPanel(); + + JMenuBar menuBar; + //Create the menu bar. + menuBar = new JMenuBar(); + + JMenu modeMenu = new JMenu("Mode"); + modeMenu.setMnemonic(KeyEvent.VK_M); + syncMenuItem = new JMenuItem("Sync Mode", KeyEvent.VK_S); + syncMenuItem.setAccelerator( + KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); + syncMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + setSyncPanel(); + } + }); + asyncMenuItem = new JMenuItem("ASync Mode", KeyEvent.VK_A); + asyncMenuItem.setAccelerator( + KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK)); + asyncMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + setAsyncPanel(); + } + }); + modeMenu.add(syncMenuItem); + modeMenu.add(asyncMenuItem); + + JMenu clearMenu = new JMenu("Clear"); + clearMenu.setMnemonic(KeyEvent.VK_C); + JMenuItem clearMenuItem = new JMenuItem("Clear text boxes"); + clearMenuItem.setAccelerator( + KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK)); + clearMenuItem.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + asyncPanel.clear(); + syncPanel.clear(); + } + }); + clearMenu.add(clearMenuItem); + + JMenu helpMenu = new JMenu("Help"); + JMenuItem mnuItemHelp = new JMenuItem("Show Help"); + helpMenu.add(mnuItemHelp); + + mnuItemHelp.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + showHelp(); + } + }); + + menuBar.add(modeMenu); + menuBar.add(clearMenu); + menuBar.add(helpMenu); + + this.setJMenuBar(menuBar); + + this.getContentPane().setLayout(new GridLayout(1, 1)); + setAsyncPanel(); + + + } + + public static void main(String[] args) { + SuggestionForm form = new SuggestionForm(); + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + form.setLocation(screenSize.width / 4, + screenSize.height / 4); + form.setSize(screenSize.width / 2, screenSize.height / 2); + form.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + //form.setResizable(false); + //form.pack(); + form.setVisible(true); + } + + private void setAsyncPanel() { + this.getContentPane().removeAll(); + this.getContentPane().add(asyncPanel); + this.syncMenuItem.setEnabled(true); + this.asyncMenuItem.setEnabled(false); + this.getContentPane().repaint(); + this.setTitle("Google Spell checker - Async Mode"); + this.setVisible(true); + + } + + private void setSyncPanel() { + this.getContentPane().removeAll(); + this.getContentPane().add(syncPanel); + this.syncMenuItem.setEnabled(false); + this.asyncMenuItem.setEnabled(true); + this.getContentPane().repaint(); + this.setTitle("Google Spell checker - Sync Mode"); + this.setVisible(true); + } + + /** + * method showHelp + */ + private void showHelp() { + + JFrame frame = new JFrame(); + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + frame.setLocation(screenSize.width / 5, + screenSize.height / 5); + frame.setSize(screenSize.width / 2, screenSize.height / 2); + + BorderLayout layout = new BorderLayout(); + + JScrollPane jsp; + + + helpDisplayPane = new JEditorPane(); + helpDisplayPane.addHyperlinkListener(this); + helpDisplayPane.setEditable(false); + helpDisplayPane.setContentType("text/html"); + + jsp = new JScrollPane(helpDisplayPane); + + Container contentPane = frame.getContentPane(); + contentPane.setLayout(layout); + contentPane.add(jsp, BorderLayout.CENTER); + String helpDoc = System.getProperty("user.dir") + HELP_FILE_NAME; + + try { + helpDisplayPane.setPage(new File(helpDoc).toURL()); + } catch (IOException e) { + JOptionPane.showMessageDialog(this, "Help file not detected", "Help file error", + JOptionPane.ERROR_MESSAGE); + return; + } + frame.setVisible(true); + } + + + public void hyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + try { + String url = e.getURL().toString(); + helpDisplayPane.setPage(url); + } catch (Exception err) { + JOptionPane.showMessageDialog(this, "Help file not detected", err.getMessage(), + JOptionPane.ERROR_MESSAGE); + } + + } + } +} Added: webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SyncPanel.java URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SyncPanel.java?view=auto&rev=469081 ============================================================================== --- webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SyncPanel.java (added) +++ webservices/axis2/branches/java/1_1/modules/samples/googlespellcheck/src/spellcheck/text_editor/SyncPanel.java Sun Oct 29 22:58:10 2006 @@ -0,0 +1,100 @@ +/* +* Copyright 2004,2005 The Apache Software Foundation. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package spellcheck.text_editor; + +import javax.swing.*; + +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/** + * class sample.google.spellcheck.SyncPanel + * This Impements its own GUI of the Synchronous Client and it send the SOAP request after the mouse event. + */ +public class SyncPanel extends javax.swing.JPanel implements Observer, + ActionListener { + FormModel formModel; + JTextArea writingTextArea; + JTextArea displayTextArea; + JTextField errorMessageField; + JButton sendButton; + + public SyncPanel() { + GridBagLayout gbLayout = new GridBagLayout(); + GridBagConstraints constraint = new GridBagConstraints(); + this.setLayout(gbLayout); + + formModel = new FormModel(this); + writingTextArea = new javax.swing.JTextArea(); + writingTextArea.setLineWrap(true); + + displayTextArea = new javax.swing.JTextArea(); + displayTextArea.setLineWrap(true); + displayTextArea.setEditable(false); + + errorMessageField = new JTextField(); + errorMessageField.setEditable(false); + errorMessageField.setBackground(Color.LIGHT_GRAY); + errorMessageField.setForeground(Color.RED); + + sendButton = new javax.swing.JButton("Send"); + JScrollPane scrollPaneget = new JScrollPane(writingTextArea); + JScrollPane scrollPaneset = new JScrollPane(displayTextArea); + writingTextArea.setText("Enter a String"); + + constraint.fill = GridBagConstraints.BOTH; + constraint.gridx = 0; + constraint.weightx = 1; + constraint.weighty = 8; + gbLayout.setConstraints(scrollPaneget, constraint); + this.add(scrollPaneget); + gbLayout.setConstraints(scrollPaneset, constraint); + this.add(scrollPaneset); + constraint.weighty = 1; + gbLayout.setConstraints(sendButton, constraint); + this.add(sendButton); + gbLayout.setConstraints(errorMessageField, constraint); + this.add(errorMessageField); + + sendButton.addActionListener(this); + + } + + public void update(String suggestion) { + displayTextArea.setText(suggestion); + } + + //updates the error message to the error message display area + public void updateError(String message) { + errorMessageField.setText(message); + } + + public void actionPerformed(ActionEvent e) { + String str = writingTextArea.getText().trim(); + formModel.doSyncSpellingSuggestion(str); + } + + public void clear() { + writingTextArea.setText(""); + displayTextArea.setText(""); + errorMessageField.setText(""); + } + +} + + --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org