[Imagetools-commit] SF.net SVN: imagetools:[6] trunk/imagetools/src/net/codebuilders/desktop/ image
Status: Beta
Brought to you by:
cmarcum
From: <cm...@us...> - 2009-04-08 00:27:14
|
Revision: 6 http://imagetools.svn.sourceforge.net/imagetools/?rev=6&view=rev Author: cmarcum Date: 2009-04-08 00:27:08 +0000 (Wed, 08 Apr 2009) Log Message: ----------- Added MouseMotionListener to setupLineMouseListeners method. Was using listener from cropMouseListener that was still active. Adding the tear down found this. Modified Paths: -------------- trunk/imagetools/src/net/codebuilders/desktop/imagetools/ImageArea.java Modified: trunk/imagetools/src/net/codebuilders/desktop/imagetools/ImageArea.java =================================================================== --- trunk/imagetools/src/net/codebuilders/desktop/imagetools/ImageArea.java 2009-04-07 23:45:35 UTC (rev 5) +++ trunk/imagetools/src/net/codebuilders/desktop/imagetools/ImageArea.java 2009-04-08 00:27:08 UTC (rev 6) @@ -26,7 +26,6 @@ // http://www.javaworld.com/javaworld/jw-04-2006/jw-0424-funandgames.html // original was crop only // added the paint lines, text etc. - package net.codebuilders.desktop.imagetools; import java.awt.*; @@ -86,7 +85,6 @@ * for drawing text */ private Point2D pointSelection; - /** * Ready to crop, usually after rectangle selection */ @@ -386,6 +384,7 @@ // this.removeMouseListener(ml); this.tearDownMouseListeners(); + this.ml = new MouseAdapter() { @Override @@ -411,16 +410,14 @@ // check for rectangle if (srcx != destx || srcy != desty) { - setReadyToCrop(true); - System.out.println("Ready to crop."); + setReadyToCrop(true); + System.out.println("Ready to crop."); } else { setReadyToCrop(false); System.out.println("Not ready to crop."); } - + } - - }; this.addMouseListener(ml); @@ -428,7 +425,7 @@ // during drag operations. // MouseMotionListener mml; - mml = new MouseMotionAdapter() { + this.mml = new MouseMotionAdapter() { public void mouseDragged(MouseEvent e) { // When you start Capture, there is no captured image. @@ -445,10 +442,8 @@ repaint(); } - - }; - addMouseMotionListener(mml); + this.addMouseMotionListener(mml); } @@ -457,6 +452,7 @@ // this.removeMouseListener(ml); this.tearDownMouseListeners(); + this.ml = new MouseAdapter() { @Override @@ -519,8 +515,27 @@ }; this.addMouseListener(ml); + this.mml = new MouseMotionAdapter() { + @Override + public void mouseDragged(MouseEvent e) { + // When you start Capture, there is no captured image. + // Therefore, it makes no sense to try and select a + // subimage. This is the reason for the if (image == null) + // test. + if (image == null) { + return; + } + + destx = e.getX(); + desty = e.getY(); + + repaint(); + } + }; + this.addMouseMotionListener(mml); + } private void setupTextMouseListeners() { @@ -597,7 +612,7 @@ public void tearDownMouseListeners() { this.removeMouseListener(ml); - this.removeMouseMotionListener(mml); + this.removeMouseMotionListener(mml); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |