Home Work 3:

Task Descriptin:

The task is to compute Jacobi iteration and draw a graphic about the result.

Class Description:

Class hmwk3 defines a frame and the components in the frame, including choice, list, checkbox, button, canvas and panel.
Class jacoGraph computs Jacobi Iteration,and paint the matrix by a selected color

Methods Description:

Class jacoGraph:

public void setClrChoice(int clr)    /** This method specifies the color flag used in painting */
public int currentRectSize()            /** This method gets the size of each array element of the metrix in the canvas */
public void setRectSize(int newsize) /** This method specifies the size of each array element of the metrix in the canvas */
public void setGridSize(int len, int wid) /** This method specifies the grid size of the matrix */
public void rst(int times)                  /** This method specifies restart the computing and repaint it */
public void jacoInit()                        /** This method initialize the array to be computed */
public void paint(Graphics g)        /** This method computes Jacobi Iteration and paint it */
public void setClr(double[][] clrArray)    /** This method set up the color array */
public void cpArray2(double [][] src, double [][] dst, int len, int wid)
                                                              /** This method copy two arrays */

Class hmwk3:

public hmwk3()    /** Constructor. This method initialize all the components in the frame and arrange them */
public void constrain(Container container, Component component, int grid_x, int grid_y, int grid_width, int grid_height, int fill, int anchor, double weight_x, double weight_y, int top, int left, int bottom, int right)
                                /** This is the main constrain method. It setup the layout in the frame,It has arguments for all constraints.This method specifies the position of a component that can grow, and does have margins */
public void constrain(Container container, Component component, int grid_x, int grid_y, int grid_width, int grid_height)
                                /** This method specifies the position of a component that does not grow and does not have margins */
public void constrain(Container container, Component component,int grid_x, int grid_y, int grid_width, int grid_height, int top, int left, int bottom, int right)
                                /** This method specifies the position of a component that does not grow, but does have margins */
public boolean handleEvent(Event event)   /** This method handles all the events generated by all the components */
public void setIterNumChoice(int Times) /** This method specifies the times of Jacobi Iteration */