java - Event Handling for Pie Chart -


i have created javafx pie chart , want when user clicks on slice of pie. following tutorial:

for (final piechart.data data : chart.getdata()) { data.getnode().addeventhandler(mouseevent.mouse_pressed,     new eventhandler<mouseevent>() {         @override public void handle(mouseevent e) {             caption.settranslatex(e.getscenex());             caption.settranslatey(e.getsceney());             caption.settext(string.valueof(data.getpievalue()) + "%");          }     }); 

i getting these error warnings prior compile: on ".addeventhandler"

bound mismatch: generic method addeventhandler(eventtype<t>, eventhandler<? supert>) of   type node not applicable arguments (integer, new eventhandler<mouseevent>  (){}). inferred type mouseevent&event not valid  substitute bounded parameter <t extends event> 

on "eventhandler"

bound mismatch: type mouseevent not valid substitute bounded parameter   <t extends event> of type eventhandler<t> 

does have insights why getting these errors?

the addeventhandler() method takes 2 parameters: 1 of type t, , 1 has super class t. gave eventhandler , integer. since integer not super class of eventhandler, exception.

my guess you're accidentally using java se's mouseevent instead of java fx's mouseevent.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -