Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
    Bookmark Topic Watch Topic
  • New Topic

need help with string array using methods  RSS feed

Posts: 28
  • Mark post as helpful
  • send pies
  • Report post to moderator
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){
display(stringArray, g);}
public void actionPerformed (ActionEvent e){
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is being continued elsewhere.
I found a beautiful pie. And a tiny ad:
Rocket Oven Kickstarter - from the trailboss
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!