Class TablePanel

public class TablePanel
extends Canvas
A graphical representation of the reservation table. It allows the user to fill in the reservation table by simply clicking on the individual squares of the reservation table.

Variables

o squareLen
    public final int squareLen

        The side length of each square in the table.

o table
    public Table table

        The reservation table.

o rows
    private int rows

        The number of rows in the reservation table.

o cols
    private int cols

        The number of columns in the reservation table.

o markList
    private Vector markList

        A list of squares that were marked in the reservation table.

o name
    private String name

        The name of the reservation table

Constructors

o TablePanel
    public TablePanel(Table table, String name, int rows, int cols)

        Build a table with the specified name, rows, and cols.

Methods

o getPreferredSize
    public Dimension getPrefrerredSize()

        Returns the actual size of the panel.

o unmark
    public void unmark(int row, int col)

        Removes the mark in the reservation table at the location specified by the method parameters.

o mark
    public void mark(int x, int y)

        When the user clicks on one of squares in the reservation table one out of two things can happen.
        1. If the square already has a X on it then the X is removed.
        2. If the square is empty then a X is placed in the square.

o paint
    public void paint(Graphics g)

        This method is responsible for the actual drawing of the reservation table and Xs.



Send all bug reports and comments to tchou@elux3.cs.umass.edu