1 26 27 package org.nightlabs.editor2d.viewer.awt; 28 29 import java.awt.Component ; 30 31 import org.nightlabs.editor2d.viewer.ICanvas; 32 33 public class AWTCanvasAutoScrollSupport 34 extends AbstractAWTAutoScrollSupport 35 { 36 public AWTCanvasAutoScrollSupport(Component comp) { 37 super(comp); 38 } 39 40 protected ICanvas getCanvas() { 41 return (ICanvas) getComponent(); 42 } 43 44 protected void scrollDown(int scrollStep) { 45 getCanvas().translateY(scrollStep); 46 getCanvas().repaint(); 47 } 48 49 protected void scrollUp(int scrollStep) { 50 getCanvas().translateY(-scrollStep); 51 getCanvas().repaint(); 52 } 53 54 protected void scrollLeft(int scrollStep) { 55 getCanvas().translateX(-scrollStep); 56 getCanvas().repaint(); 57 } 58 59 protected void scrollRight(int scrollStep) { 60 getCanvas().translateX(scrollStep); 61 getCanvas().repaint(); 62 } 63 64 } 65 | Popular Tags |