Skip to main content

how do i list numbers from a for loop?

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
Zeezj
Offline
Joined: 2011-09-14

hello party people. i have been programming a small application that factors a number for you. the problem is, i don't know how to get it to list numbers from one instead of just changing the label continuously. here's the code:

private void factorButtonActionPerformed(java.awt.event.ActionEvent evt) {

double i = (Double.parseDouble(factoredNumberField.getText()));

double a;

int b;

for (b=1;b<=i;b++) {

a = i%b;

if (a==0) {

factorList.setText(b + "");

}}

}

so my question is, how can i list the numbers?

EDIT: i'm a java noob, so dont be too complicated :/