beLejer beLejer - 1 year ago 80
Java Question

Dynamical Java spreadsheet/table

I am facing the task of making a dynamical spreadsheet in Java that has a grid of cells and does operations between between them. I have to "put" all my cells in some kind of container and get an integer index for every cell. I could only think about an array into an array or maybe a JTable. I have to remind that later on I will have to implement this into an Android App. Please help me.

I tried something like this (it's totally wrong):

public class
BaseCell {

public double value;
int i=0,j=0;
int row=20, column=5;

BaseCell[] PrimaryCellArray = new BaseCell[i];
for (i=0; i<column; i++){
BaseCell[] SecondaryCellArray = new BaseCell[j];
} PrimaryBaseCell.addObj.S
//then add the secondary cell to primary cell


Answer Source

I might misunderstand the question, but IMO List would be the best would be to use one of list types.

int rows = 20, cols = 10;
List myList = new Lise();
for (int i=0; i<rows; i++){
   BaseCell[] secondaryCellArray = new BaseCell[cols];

to get acces to some cell, call the row you need with myList.get(rowNum), it will return you variable of that type you're set there before

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download