Quote:
Originariamente inviato da federico100mt
insomma, un giro di parole. Io riesco a selezionarle, a stampare il loro contenuto, aggiungo gli elementi in un Vector(object) che poi passo all'altra jlist ma non mi risputa nessun risultato sulla GUI.
|
Il Vector che cos'è? Suppongo sia l'oggetto che passi come model durante la costruzione dell'altra JList.
Se è così, sappi che dietro le quinte con quel Vector viene creato per te un DefaultListModel *immutabile* per la JList, quindi add e remove fanno cilecca...
Quote:
Other JList constructors let you initialize a list from a Vector or from an object that adheres to the ListModel interface. If you initialize a list with an array or vector, the constructor implicitly creates a default list model. The default list model is immutable — you cannot add, remove, or replace items in the list. To create a list whose items can be changed individually, set the list's model to an instance of a mutable list model class, such as an instance of DefaultListModel. You can set a list's model when you create the list or by calling the setModel method. See Adding Items to and Removing Items from a List for an example.
|
Tratto da
questa pagina.