adalogo.gui

Class TurtleCanvas

Implemented Interfaces:
ComponentListener, EventListener, FocusListener, MouseListener, MouseWheelListener, Turtle.TurtleListener, VisitorMaster.VisitorListener

public class TurtleCanvas
extends JPanel
implements FocusListener, MouseListener, MouseWheelListener, ComponentListener, Turtle.TurtleListener, VisitorMaster.VisitorListener

this is class to hold canvas to draw turtle

Nested Class Summary

Constructor Summary

TurtleCanvas(Engine engine)
constructor.

Method Summary

void
componentHidden(ComponentEvent e)
void
componentMoved(ComponentEvent e)
void
componentResized(ComponentEvent e)
void
componentShown(ComponentEvent e)
void
focusGained(FocusEvent e)
void
focusLost(FocusEvent e)
Dimension
getMinimumSize()
Dimension
getPreferredSize()
Action
getResetAction()
Action
getScrollDownAction()
Action
getScrollLeftAction()
Action
getScrollRigthAction()
Action
getScrollUpAction()
Action
getZoomInAction()
Action
getZoomOutAction()
void
init()
init.
void
mouseClicked(MouseEvent e)
void
mouseEntered(MouseEvent e)
void
mouseExited(MouseEvent e)
void
mousePressed(MouseEvent e)
void
mouseReleased(MouseEvent e)
void
mouseWheelMoved(MouseWheelEvent e)
void
paintComponent(Graphics g)
custom paint.
void
repaint()
controlled repaint.
void
resetCanvas()
reset canvas
void
turtleReset(Turtle.TurtleEvent e)
void
turtleStateChanged(Turtle.TurtleEvent e)
void
visitorRunning(VisitorMaster.VisitorEvent e)
void
visitorStarted(VisitorMaster.VisitorEvent e)
void
visitorStopped(VisitorMaster.VisitorEvent e)
void
visitorWaiting(VisitorMaster.VisitorEvent e)

Constructor Details

TurtleCanvas

public TurtleCanvas(Engine engine)
constructor. here is done: click listener for scroll, mousewheel listener for zoom, component listener for resize, various buttons.

Method Details

componentHidden

public void componentHidden(ComponentEvent e)


componentMoved

public void componentMoved(ComponentEvent e)


componentResized

public void componentResized(ComponentEvent e)


componentShown

public void componentShown(ComponentEvent e)


focusGained

public void focusGained(FocusEvent e)


focusLost

public void focusLost(FocusEvent e)


getMinimumSize

public Dimension getMinimumSize()


getPreferredSize

public Dimension getPreferredSize()


getResetAction

public Action getResetAction()


getScrollDownAction

public Action getScrollDownAction()


getScrollLeftAction

public Action getScrollLeftAction()


getScrollRigthAction

public Action getScrollRigthAction()


getScrollUpAction

public Action getScrollUpAction()


getZoomInAction

public Action getZoomInAction()


getZoomOutAction

public Action getZoomOutAction()


init

public void init()
init. extended constructor. called by engine.


mouseClicked

public void mouseClicked(MouseEvent e)


mouseEntered

public void mouseEntered(MouseEvent e)


mouseExited

public void mouseExited(MouseEvent e)


mousePressed

public void mousePressed(MouseEvent e)


mouseReleased

public void mouseReleased(MouseEvent e)


mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent e)


paintComponent

public void paintComponent(Graphics g)
custom paint. this will paint the turtle lines and the turtle.


repaint

public void repaint()
controlled repaint. if interpreter is running this will be disabled.


resetCanvas

public void resetCanvas()
reset canvas


turtleReset

public void turtleReset(Turtle.TurtleEvent e)
Specified by:
turtleReset in interface Turtle.TurtleListener


turtleStateChanged

public void turtleStateChanged(Turtle.TurtleEvent e)
Specified by:
turtleStateChanged in interface Turtle.TurtleListener


visitorRunning

public void visitorRunning(VisitorMaster.VisitorEvent e)
Specified by:
visitorRunning in interface VisitorMaster.VisitorListener


visitorStarted

public void visitorStarted(VisitorMaster.VisitorEvent e)
Specified by:
visitorStarted in interface VisitorMaster.VisitorListener


visitorStopped

public void visitorStopped(VisitorMaster.VisitorEvent e)
Specified by:
visitorStopped in interface VisitorMaster.VisitorListener


visitorWaiting

public void visitorWaiting(VisitorMaster.VisitorEvent e)
Specified by:
visitorWaiting in interface VisitorMaster.VisitorListener