//Use Stringbuilder to add new listbox items private void btnAddNewActionPerformed(java.awt.event.ActionEvent evt) { // take new item and cost and add to listbox model String newItem = txtNewItem.getText().trim(); String newCost = txtNewCost.getText().trim(); if (newItem.length() > 0 && newCost.length() > 0) { StringBuilder myLBItem = new StringBuilder(); //create new string;builder myLBItem.setLength(60); //60 chars long to hold new line of data myLBItem.insert(0, newItem.toString()); //new item inserted at column 0 myLBItem.insert(35, newCost.toString()); //new price inserted at column 35 //---add new item and cost to listbox and sort it model.addElement(myLBItem.toString()); //be sure to convert to string sortListBox(model); }