Dear All,

this is my code.

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

// TODO add your handling code here:

double i[]=new double[100000];

double a=Double.parseDouble(jTextField1.getText());

double b=Double.parseDouble(jTextField2.getText());

double m=Double.parseDouble(jTextField3.getText());

jButton1.setEnabled(false);

i[0]=10; //Starting Value

//Generating Random Numbers

for(int j=1; j<i.length; j++) {

i[j]=(((a*i[j-1]+b)%m)/m);

}

//Arranging the Randomly Generated Numbers into Order.

jTable1....................................................

jButton1.setEnabled(true);

}

and i want to show the values of array i[] to jTable1, how can I do this.

It is not enought to know one-dimensional array

to build the table, you probably want to know how

many columns (and rows) you'll have and you may want to know

the column headers therefore it is good to start with the Vector

of column headers:

Vector vCol = new Vector();

vCol.addElement("Col1");

vCol.addElement("Col2");

...

This vector will communicate to table model how many columns

we want to have and what are their names.

Then you'll first create tableModel feeding this vector to the constructor,

following the naming of the link above and taking advantage of the

EntryTableModel class which they suggested which extends DefaultTableModel

you'll then say

tableModel = new EntryTableModel(vCol);

then you can start populating vectors for each row

and adding them to table model like say with elements of your array :

int counter = 0;

let's say you want numRows = 10;

int numRows = 10;

for(int j=0; j<numRows; j++){

Vector rowData = new Vector();

for(int jj=0; jj<vCol.size(); jj++) {

rowData.addElement(new Double(i[counter]));

counter++;

}

tableModel.addRow(rowData)

}

Elements of vectors should be objects

therefore you need to use newDouble(double)

when addiing to vectors, rather than numbers

After you run through these loops

you can create JTable and set its model

JTable table = new JTable();

table.setModel(tableModel)

This is really rathe long process but should be understandable.

Let us know if you see any problems.