View Single Post
Old 01-13-2005, 03:23 PM   PM User | #5
thehaunt
New to the CF scene

 
Join Date: Jan 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
thehaunt is an unknown quantity at this point
AHA!! Boy those FAQ's are handy!
Here you go, code in a more readable format!
Thanks for the tip.

Code:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;


public class SntncArray extends Applet implements ActionListener
   {
   TextField theSntnc = new TextField(60);
   Button pressMe=new Button("parse to array");
   String fillIt;
   String checkIt;
   Label fillMe;

   public void init()
      {
      add(theSntnc);
      add(pressMe);
      pressMe.addActionListener(this);
      }

   public void actionPerformed(ActionEvent pressMe)
      {
      fillIt=new String (theSntnc.getText());
      fillMe=new Label("FillIt"+fillIt);
      add (fillMe);
      invalidate();
      validate();
      brkSntnc(fillIt);
      }


   public void brkSntnc(String sntnc)
      {
      int x=0;
      int wrdCnt=0;
      int myLen;
      while (x!=-1)
         {
         myLen=sntnc.length();
         x=sntnc.indexOf(" ");
         sntncArray[wrdCnt]=sntnc.substring(0,x)
         wrdCnt++;
         sntnc=sntnc.substring(x,myLen);
         }
      }
}
thehaunt is offline   Reply With Quote