Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need help with string array

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
hello,
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());}
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
MultiPost.
Answered in Beginner. Here.
Name change requested.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic