Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
    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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

need help with string array using methods  RSS feed

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello,
This program compiles correctly, but
i cant seem to get anything to appear on my applet screen except for the textField with the current program down below. Can anyone see a problem, i cant?
i think im seeing doubles, since ive been looking at
this program for 30 hours.

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);
display(stringArray, g);}
public void actionPerformed (ActionEvent e){
input.setText(null);
repaint ();}

// This section below contains the methods
public void getData (String [] array)
{
for (int z=0; z < array.length; z++){
array [z] = input.getText();}}
public void display(String [] array, Graphics g){
int yValue=100;
for (int w=0; w < array.length; w++)
g.drawString("Index "+w+"is "+array[w], 100, yValue*15);}
}//end of program
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is being continued elsewhere.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!