Last Updated
Viewed 11,597 Times
        

How to check in jTable the values I am trying to add from jField exists or not ? I am using Vector<Object> in jTable.

I am trying to add a JComboBox in a JTable cell. After addding the JComboBox in the row vector

Vector rown=new Vector();
rown.add(comboBox1);

and run my GUI, the table shows:

javax.swing.JComboBox[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.MetalComboBoxUI$MetalComboBoxLayoutManager,alignmentX=0.0,alignmentY=0.0,border=,flags=16777536,maximumSize=,minimumSize=,preferredSize=,isEditable=false,lightWeightPopupEnabled=true,maximumRowCount=8,selectedItemReminder=VALUE_ONE

Rather than VALUE_ONE in a JComboBox.

Where Am I going wrong?

I searched but there are no similar questions.

I have a function with 2 parameters: row_num, value Before adding a new value, I need to check to see if that row exists in the JTable or not. If it is not, I will add a null row before adding value.

The problem is I don't know how to check if it exists. I tried table.isCellEditable(row_num, 2) but I'm not sure why it always returns True though the table doesn't contain that row.

Similar Question 3 : how to add column value in jtable

I am very new to java and i am developing an inventory management system(Its my first project ).I want to add the column values sententiously when a new row is created. please any one help me how to do so.. i want to sum the line total and show it as the arrow is located.enter image description here.here is my code for table data.

int quantity, price;
Product p = new Product();
String[] result = new String[8];
String data[] = new String[7];
int i = 0;
result=p.getInfo(this.addItemField.getText());
for (String s : result) {
    data[i] = s;
    i += 1;
}
data[0] = "1";
quantity = Integer.parseInt(data[0]);
price = Integer.parseInt(data[5]);
int tPrice = price*quantity;
data[6] = Integer.toString(tPrice);  //this is the field which i want to add for all row.
table.addRow(data);
this.addItemField.grabFocus();
addItemField.setText("");

Similar Question 4 (1 solutions) : How to add a double type value to a JTable row?

Similar Question 5 (1 solutions) : How to add an “input value” listener to a JTable?

Similar Question 7 (2 solutions) : How can i add an UndoableEditListener to JTable cells?

Similar Question 8 (2 solutions) : How do I add a JLabel[] to a JTable?

Similar Question 9 (1 solutions) : How can i add Jbutton on Jtable cell?

cc