Che Posted July 22, 2017 Report Posted July 22, 2017 (edited) Quote error: incompatible types: java.util.List cannot be converted to java.awt.List graph.setSelectionCells(graph.getSelectionCellsForChanges(changes)); final mxEventSource.mxIEventListener selectionHandler = new mxEventSource.mxIEventListener() { public void invoke(final Object source, final mxEventObject evt) { final List changes = ((mxUndoableEdit)evt.getArgAt(0)).getChanges(); graph.setSelectionCells(graph.getSelectionCellsForChanges(changes)); } }; Daca pun import java.uitl.list eroarea imi apare pe ultimul rand din cod. Daca pun java.awt.List eroarea apare pe penultimul rand. De fiecare data e la fel ca nu se pot schimba tipurile ba unul, ba celalalt. Nu reusesc sa rezolv problema. Sunt incepator la Java, va rog ajutor. Multumesc mult ! Edited July 22, 2017 by Che Quote
Erase Posted July 22, 2017 Report Posted July 22, 2017 (edited) E prea vag codul pe care l-ai pus dar pot presupune ca setSelectionCells cere awt.List ca parametru insa tu ii dai utils.List. Daca amandoua implementeaza IList faci cast; final List changes = ((mxUndoableEdit)evt.getArgAt(0)).getChanges(); graph.setSelectionCells((awt.List)graph.getSelectionCellsForChanges(changes))); .. daca nu atunci initializezi variabila 'changes' ca obiect de tip awt.List; Edited July 22, 2017 by Erase Quote
Che Posted July 22, 2017 Author Report Posted July 22, 2017 7 hours ago, Erase said: E prea vag codul pe care l-ai pus dar pot presupune ca setSelectionCells cere awt.List ca parametru insa tu ii dai utils.List. Daca amandoua implementeaza IList faci cast; final List changes = ((mxUndoableEdit)evt.getArgAt(0)).getChanges(); graph.setSelectionCells((awt.List)graph.getSelectionCellsForChanges(changes))); .. daca nu atunci initializezi variabila 'changes' ca obiect de tip awt.List; Multumesc mult ! Am rezolvat exact asa cum ai spus tu. Quote