This discussion is archived
1 2 Previous Next 15 Replies Latest reply: Apr 17, 2007 1:09 PM by 807599 RSS

Using a range to input numbers to a table

807599 Newbie
Currently Being Moderated
Hi i have written this bit of code to allow numbers to be written to the table. I use "b" as the limit the numbers go to but when i want to use "a" as the start point it returns the error loss of precision. E.g. i enter a = 3 and b = 8 and in the table it returns 3, 4, 5, 6, 7, 8 in a single column. The error message reads "Loss of possible precision" and

found : double
required: int
for (int row = a; row <= b; row++)
1 error
BUILD FAILED (total time: 0 seconds)


 double a = Double.parseDouble(txtRangeFrom.getText());
    double b = Double.parseDouble(txtRangeTo.getText());      
    int i = 1;
    for (int row = a; row <= b; row++)
        for (int col = 1; col <= 1; col++){
        tblOut.setValueAt(Double.toString(i),row,col);
        i++;
        }
    }
Thanks any help would be appreciated
1 2 Previous Next