Results 1 to 1 of 1
Thread: mouseDragged problem
- 11-15-2010, 01:41 AM #1
Member
- Join Date
- Dec 2008
- Posts
- 27
- Rep Power
- 0
mouseDragged problem
I am unable to understand the following:
- In g.drawRect, p1.x is subtracted from p.x
- In case RECTANGLE, why g.drawRect is being called twice.
Please help.
Java Code:public void mouseDragged(MouseEvent ev) { Graphics2D g = (Graphics2D)getGraphics(); g.setXORMode(Color.white); Point p1 = (Point)points.get(pointIndex-1); switch (shapeType) { case RECTANGLE: if (p != null) g.drawRect(p1.x, p1.y, p.x-p1.x, p.y-p1.y); p = ev.getPoint(); g.drawRect(p1.x, p1.y, p.x-p1.x, p.y-p1.y); break;
Similar Threads
-
n00b : Ghost image while using mouseDragged event to move a filled jPanel
By ankitmcgill in forum New To JavaReplies: 5Last Post: 11-02-2008, 06:41 AM -
MouseDragged Event
By Preethi in forum New To JavaReplies: 1Last Post: 03-04-2008, 05:09 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks