String prodname = prodbox.getSelectedItem().toString();
String qty = txtqty.getText();
String prod = prodID.getSelectedItem().toString();
int quantity = Integer.valueOf(txtqty.getText().trim());
// VectorTableCellRenderer renderer = new VectorTableCellRenderer();
//set TableCellRenderer into a specified JTable column class
// jTable6.setDefaultRenderer(Vector.class, renderer);
String sql = "SELECT * FROM products WHERE "
+ " productID = ('"+prod+"')";
for(int i = 0; i < arr.length; i++){
if(i == 0 && !prodname.equals("") ){
arr[i] = prodname;
ctr++;
}
else
break;
}
for(int i = 0; i < qty_arr.length; i++){
if(i == 0 && !qty.equals("") || i == 0 && !qty.equals("0")){
qty_arr[i] = qty;
totalqty += quantity;
}
else
break;
}
for(int i = 0; i < ctr; i++){
checker++;
if(checker > 0){
allQuantity.append(System.getProperty("line.separator"));
}
allQuantity.append(qty_arr[i]);
//comma2 = "\n ";
}
for(int i = 0; i < ctr; i++){
if(checker > 0){
allProducts.append(System.getProperty("line.separator"));
}
allProducts.append(arr[i]);
//comma = "\n ";
}
我尝试追加,使用行分隔符并使用“\ n”但是 这仍然显示
我的表结果: