Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在java中的Graphics2D对象上创建事件_Java_Image_Awt_Mouseevent_Graphics2d - Fatal编程技术网

如何在java中的Graphics2D对象上创建事件

如何在java中的Graphics2D对象上创建事件,java,image,awt,mouseevent,graphics2d,Java,Image,Awt,Mouseevent,Graphics2d,您知道如何将自定义鼠标事件添加到graphics2D对象吗 image = ImageIO.read(map_file); logo_maps = ImageIO.read(map_file_logo); Graphics2D test; test = image.createGraphics(); test.setColor(Color.red); test.drawImage(logo_maps,l.getX(),l.getY(), 20, 20,this); test.drawStrin

您知道如何将自定义鼠标事件添加到graphics2D对象吗

image = ImageIO.read(map_file);
logo_maps = ImageIO.read(map_file_logo);
Graphics2D test;
test = image.createGraphics();

test.setColor(Color.red);
test.drawImage(logo_maps,l.getX(),l.getY(), 20, 20,this);
test.drawString(l.getLibelle(), l.getX(),l.getY());
看看这个: