Is this right to change the labels [row][2] into double?
String x = Double.parseDouble(labels[row][2]);?
I know this is a kinda of cross post but I need to do this for my final project ..
Code:
JLabel[][] labels = new JLabel[5][3];
// index which row I am at
int row = 0;
DisplayPanel() {
// 6 rows and 3 columns
super(new GridLayout(6, 3, 5, 5));
// add the 3 header
for(int i = 0; i < header.length; ++i)
add(new JLabel(header[i]));
// the other JLabel. Each row
for(int i = 0; i < labels.length; ++i) {
// each columns
for(int j = 0; j < labels[i].length; ++j) {
labels[i][j] = new JLabel("");
labels[i][j].setOpaque(true);
labels[i][j].setBackground(Color.WHITE);
add(labels[i][j]);
}
}
}
// adds the new entry into the next one
void addFiedls() {
if(row == labels.length)
return; // sorry no more room
labels[row][0].setText(id.getText());
labels[row][1].setText(name.getText());
labels[row][2].setText(sales.getText());
++row;
Re: Is this right to change the labels [row][2] into double?
Quote:
Originally Posted by
opeboy
I know this is a kinda of cross post
No 'kinda' about it.
How Can I Transfer The Data To Other Txtfield When Click Submit - Java | Dream.In.Code - Page 2
db
Re: Is this right to change the labels [row][2] into double?