// Add/Insert public int add(Script script) { // Find the correct spot to add it alphabetically int i, limit; for (i = 0, limit = scripts.size(); i < limit; i++) { Script scriptTemp = (Script) scripts.get(i); if (scriptTemp.getName().compareTo(script.getName()) >= 0) { break; } } scripts.add(i, script); // Update the table fireTableRowsInserted(i, i); return i; }
// Getters public Script get(int i) { return (Script) scripts.get(i); }