Jump to content

How to apply loop statement

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Manfrizy

Manfrizy

    Newbie

  • Members
  • Pip
  • 6 posts
Hi people,
Am a newbie in java programing and am trying to create a gui using netbeans IDE.I have created a table to display my data.
The problem is when i want to manipulate my data in the table, am only able to read the value of one cell.Am thinking of using loop but i have no idea on how to apply it.Below is my code
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {                                      
// TODO add your handling code here:
     GetTableValues();   
}
   public void GetTableValues() {
       //for (i=1;.length <=48;i++);
       String str = (String) Xenon.getValueAt(2,1);
       JOptionPane.showMessageDialog(null, str);
}
Anyone with an idea on how i can insert the loop in this code?
Thanks

Edited by WingedPanther, 14 November 2008 - 07:01 AM.
add code tags (the # button)


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
You probably want to compare i to 48, not length.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Manfrizy

Manfrizy

    Newbie

  • Members
  • Pip
  • 6 posts

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {                                      

// TODO add your handling code here:

     GetTableValues();   

}

   public void GetTableValues() {

  //for (i=1;.length <=48;i++);

       String str = (String) Xenon.getValueAt(2,1);

       JOptionPane.showMessageDialog(null, str);

} 
My idea was to get all the cell values or rather it should give me all cells values in the table and not only cell (2,1)

#4
lucuis

lucuis

    Newbie

  • Members
  • PipPip
  • 21 posts
Of which type is Xenon? And what is your final goal?

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
.length is not a valid variable name. You should get a syntax error when you try to use it as a property of nothing.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog