/** * Returns the URL of the document. * * @return the URL of the document */ public SchemaElement getSelectedElement() { int index = list.getSelectedIndex(); // if(model.getSize() > 0) { if (index != -1) { return model.getElement(index); } else { return model.getElement(0); } // } // else { // return(null); // } }
/** * Set the selected element. * * @param element the selected element. */ public void setElements(Vector elements) { model = new ElementListModel(elements); list.setModel(model); if (model.getSize() > 0) { list.setSelectedIndex(0); list.ensureIndexIsVisible(0); } }