File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes need help with string array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic

need help with string array


Joined: Mar 11, 2003
Posts: 5
im trying to create a program that uses a method
getData to read 10 strings in an array from a TextField. Im getting an error on the method getData that says 'class' or 'interface' expected. Can anyone help me on this issue? thanks --jbowl
private TextField input;
private String [] stringArray = new String [10];
public void init()
{ input = new TextField (20);
add (input);
input.addActionListener (this);}
public void paint(Graphics g)
{ getData(stringArray);
g.drawString(toString(), 50,50);}
public void actionPerformed (ActionEvent e)
{ input.setText(null);
repaint ();}
// This section below contains the method getData
public void getData (String [] array)
{for (int i=0; i< array.length; i++)
array [i] = (input.getText());}

_ _____________________ _ <br />Jbowl to the nineth degree
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Answered in Beginner. Here.
Name change requested.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
I agree. Here's the link:
subject: need help with string array
It's not a secret anymore!