gui

Class GridDisplay


public class GridDisplay
extends JComponent

Überschrift:

Beschreibung:

Copyright: Copyright (c) 2002

Organisation:

Nested Class Summary

private class
GridDisplay.MenuItemListener
This class provides the ItemListener for the JPopupMenu
private class
GridDisplay.MouseObserver
This class provides the MouseListener for the JPanel

Field Summary

private AlgorithmListener
algoListener
private Rectangle2D.Double
backgroundRectangle
private Graphics2D
g2
private Grid
grid
private double
gridFieldHeight
private double
gridFieldWidth
private Gui
gui
private GridDisplay.MenuItemListener
itemListener
private GridDisplay.MouseObserver
observer
private JPopupMenu
popupMenu
private int
scaleFactor
private JCheckBoxMenuItem
showGridScaleCheckBox
private double
size
private double
startCol
private double
startLine

Constructor Summary

GridDisplay(Grid gr, Gui g)

Method Summary

private JPopupMenu
createPopupMenu()
void
handleMouseClick(MouseEvent e)
This method checks if the mouseclick hit one of the grid coordinates.
void
paint(Graphics g)
private void
paintGridNode(Graphics2D g, int status, int gridRow, int gridCol)
This method provides the painting of un-/filled dots at the grid coordinates
void
setGrid(Grid gr)

Field Details

algoListener

private AlgorithmListener algoListener

backgroundRectangle

private Rectangle2D.Double backgroundRectangle

g2

private Graphics2D g2

grid

private Grid grid

gridFieldHeight

private double gridFieldHeight

gridFieldWidth

private double gridFieldWidth

gui

private Gui gui

itemListener

private GridDisplay.MenuItemListener itemListener

observer

private GridDisplay.MouseObserver observer

popupMenu

private JPopupMenu popupMenu

scaleFactor

private int scaleFactor

showGridScaleCheckBox

private JCheckBoxMenuItem showGridScaleCheckBox

size

private double size

startCol

private double startCol

startLine

private double startLine

Constructor Details

GridDisplay

public GridDisplay(Grid gr,
                   Gui g)
Parameters:

Method Details

createPopupMenu

private JPopupMenu createPopupMenu()

handleMouseClick

public void handleMouseClick(MouseEvent e)
This method checks if the mouseclick hit one of the grid coordinates. If it does, the status of this field in the class Grid is changed.

paint

public void paint(Graphics g)

paintGridNode

private void paintGridNode(Graphics2D g,
                           int status,
                           int gridRow,
                           int gridCol)
This method provides the painting of un-/filled dots at the grid coordinates
Parameters:

setGrid

public void setGrid(Grid gr)