Hello, I am trying to get my program to remove and item from my collection and then move all the remaining items back together (removing the space from the removed item). My items are displayed through a GUI application as columns. My problem is once I remove the item my program leaves a space. I need it to move the remaining items to the right of the removed item a spot to the left to delete the space. I know it has something to do with making a new array that is a size smaller and displaying that, but I am having trouble displaying the new array.
/* * Method is used to remove items */ public void remove() { if ((newArray != null) && (size > 0) && (itemSelected > EMPTY) && (itemSelected < size)) { for (int i = itemSelected + 1; i < size; i++) newArray[i - 1] = newArray[i]; size--; } itemSelected = EMPTY; }
// This method removes an item public void removeAction() { myCollection.reset(selectedItem); myCollection.remove(); selectedItem=null; repaint(); }