Jump to content
Che

Cum se rezolva aceasta eroare ?

Recommended Posts

Posted (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 by Che
Posted (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 by Erase
Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...