Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Drag and Drop error  RSS feed

 
Niko Prinz
Greenhorn
Posts: 15
Eclipse IDE PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heey guys im making a drag and drop applic with swing but at the and i got this error

Bound mismatch: The generic method createDragGestureRecognizer(Class<T>,
DragSource, Component, int, DragGestureListener) of type Toolkit is not applicable
for the arguments (Class<capture#1-of ?>, DragSource, Draggable, int,
Draggable.DGListener). The inferred type capture#1-of ? is not a valid substitute for
the bounded parameter <T extends DragGestureRecognizer>

the error code :


i dont know what to do can some one plzz help me thanks !! ^^
 
Michal Plutynski
Greenhorn
Posts: 14
Eclipse IDE jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first suggestion - try to check is "MousedragGestureRecognizer" is correct name. Maybe it should be "MouseDragGestureRecognizer"?
 
Niko Prinz
Greenhorn
Posts: 15
Eclipse IDE PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michal Plutynski wrote:first suggestion - try to check is "MousedragGestureRecognizer" is correct name. Maybe it should be "MouseDragGestureRecognizer"?


If i change i got the same error massage and it it say change it back
 
Michal Plutynski
Greenhorn
Posts: 14
Eclipse IDE jQuery Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok. i answered too fast

the problem is about method Class.forName(...), bacause the return type is Class<?> and what you need is typed class (Class<T>).

the solution is to use:
getToolkit().createDragGestureRecognizer(MouseDragGestureRecognizer.class, source, this, dragAction, listener);

I found the orginal code on internet with this code. My suggestion is to check which Java version the code refers to, this code was created around 1999 - so it is very old!
Try to find some examples of Java 7.
 
Niko Prinz
Greenhorn
Posts: 15
Eclipse IDE PHP Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you ver much it helps alot i know its a old example im working with thinking in java 2
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!