#4 Zoom does not repaint properly

open
nobody
None
5
2004-02-09
2004-02-09
Ahmad Aslami
No

Problem:
Zoom does not repaint properly
- When you attempt to move a zoomed object, the object
is repainted within a graphics context that is scaled
(through getGraphics() method call) and then scaled
again (through paint method). In order to solve this
problem, I modified DrawingView so that it would not
override the getGraphics method of JComponent by
changing the method to graphics(). I then changed
AreaTracker and SelectAreaTracker so that the scaled
graphics context would be retrieved.

files changed:
DrawingView
- changed getGraphics() to graphics()
StandardDrawingView
- changed getGraphics() to graphics()
NullDrawingView
- changed getGraphics() to graphics()
ZoomDrawingView
- changed getGraphics() to graphics()
- changed zoom methods so that usersize is set to
drawing size

AreaTracker
- changed view().getGraphics() to view().graphics()
SelectAreaTracker
- changed view().getGraphics() to view().graphics()

The modified files in JHotDraw6.0b1 are attached. Let
me know if you have any questions or problems. If you
find a cleaner way to fix this problem, send me the update.

Discussion

  • Ahmad Aslami
    Ahmad Aslami
    2004-02-09

    Modified files

     
    Attachments