VANET Simulator
 All Classes Functions Variables
Public Member Functions | List of all members
vanetsim.gui.DrawingArea Class Reference
Inheritance diagram for vanetsim.gui.DrawingArea:

Public Member Functions

 DrawingArea (boolean useDoubleBuffer, boolean drawManualBuffered)
 
void paintComponent (Graphics g)
 
void prepareBufferedImages ()
 
void revalidate ()
 
void paintImmediately (int x, int y, int width, int height)
 
void mouseWheelMoved (MouseWheelEvent e)
 
void keyTyped (KeyEvent e)
 
void keyPressed (KeyEvent e)
 
void mousePressed (MouseEvent e)
 
void mouseReleased (MouseEvent e)
 
void keyReleased (KeyEvent e)
 
void mouseClicked (MouseEvent e)
 
void mouseEntered (MouseEvent e)
 
void mouseExited (MouseEvent e)
 

Detailed Description

This class represents a JComponent on which all map elements are painted. It just creates the basic system which is needed, rendering itself is delegated to the Renderer-class!

See Also
vanetsim.gui.Renderer

Constructor & Destructor Documentation

vanetsim.gui.DrawingArea.DrawingArea ( boolean  useDoubleBuffer,
boolean  drawManualBuffered 
)
inline

Constructor.

Parameters
useDoubleBuffertrue to set DoubleBuffering on, false to set it off
drawManualBufferedset to true to use a BufferdImage for drawing (manual DoubleBuffering)

Member Function Documentation

void vanetsim.gui.DrawingArea.keyPressed ( KeyEvent  e)
inline

Allows panning through pressing the keyboard arrows.

Parameters
ethe KeyEvent
See Also
java.awt.event.KeyListener::keyPressed(java.awt.event.KeyEvent)
void vanetsim.gui.DrawingArea.keyReleased ( KeyEvent  e)
inline

Does nothing. Just necessary to implement the KeyListener.

Parameters
ethe KeyEvent
See Also
java.awt.event.KeyListener::keyReleased(java.awt.event.KeyEvent)
void vanetsim.gui.DrawingArea.keyTyped ( KeyEvent  e)
inline

Does nothing. Just necessary to implement the KeyListener.

Parameters
ethe KeyEvent
See Also
java.awt.event.KeyListener::keyTyped(java.awt.event.KeyEvent)
void vanetsim.gui.DrawingArea.mouseClicked ( MouseEvent  e)
inline

Does nothing. Just necessary to implement the MouseListener.

Parameters
ethe MouseEvent
See Also
java.awt.event.MouseListener::mouseClicked(java.awt.event.MouseEvent)
void vanetsim.gui.DrawingArea.mouseEntered ( MouseEvent  e)
inline

Notifies the MouseDragManager that mouse entered this area.

Parameters
ethe MouseEvent
See Also
java.awt.event.MouseListener::mouseEntered(java.awt.event.MouseEvent)
void vanetsim.gui.DrawingArea.mouseExited ( MouseEvent  e)
inline

Notifies the MouseDragManager that mouse left this area.

Parameters
ethe MouseEvent
See Also
java.awt.event.MouseListener::mouseExited(java.awt.event.MouseEvent)
void vanetsim.gui.DrawingArea.mousePressed ( MouseEvent  e)
inline

Tracks clicks in order to get focus and allow to get information about points on the map or edit something on the map. The work itself is done in the MousedragManager.

Parameters
ethe MouseEvent
See Also
java.awt.event.MouseListener::mousePressed(java.awt.event.MouseEvent)
void vanetsim.gui.DrawingArea.mouseReleased ( MouseEvent  e)
inline

Used for panning through mousedragging through the MousedragManager.

Parameters
ethe MouseEvent
See Also
java.awt.event.MouseListener::mouseReleased(java.awt.event.MouseEvent)
void vanetsim.gui.DrawingArea.mouseWheelMoved ( MouseWheelEvent  e)
inline

Listener for mouse scrolls.

Parameters
ethe MouseWheelEvent
See Also
java.awt.event.MouseWheelListener::mouseWheelMoved(java.awt.event.MouseWheelEvent)
void vanetsim.gui.DrawingArea.paintComponent ( Graphics  g)
inline

This method gets automatically called on a repaint(). Therefore, rendering is delegated from here to the renderer.

Parameters
gthe Graphics object to paint on
void vanetsim.gui.DrawingArea.paintImmediately ( int  x,
int  y,
int  width,
int  height 
)
inline

Setting the RepaintManager like seen on the official examples for Java2D (link last time checked on 12.08.2008).
This imitates the "On Screen" method used there and in some cases drastically improves performance (even when DoubleBuffering of this JComponent is off the DoubleBuffering might still be on because the DoubleBuffering is inherited from the main JFrame!).

Parameters
xthe x coordinate for the bounding box to repaint
ythe y coordinate for the bounding box to repaint
widththe width
heightthe height
void vanetsim.gui.DrawingArea.prepareBufferedImages ( )
inline

Prepares all BufferedImages and notifies the Renderer of a new drawing area size.

void vanetsim.gui.DrawingArea.revalidate ( )
inline

This function gets called when a property value changes such that size, location or internal layout of change. We then need to check if our BufferdImages still have the correct size and create new ones if needed!


The documentation for this class was generated from the following file: