Class JGrid.JGrid2
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JGrid.JGrid2

Object
   |
   +----Component
           |
           +----Container
                   |
                   +----Panel
                           |
                           +----JGrid.JGrid2

public class JGrid2
extends Panel

Variable Index

 o BOTH_BORDER
both borders
 o HORIZONTAL_BORDER
horizontal border only
 o VERTICAL_BORDER
vertical border only

Constructor Index

 o JGrid.JGrid2(String[], String[], boolean, int)
constructor.

Method Index

 o action(Event, Object)
overrides action() method.
 o computeHScroll()
rearranges the position and value of horizontal scroll bar.
 o computeVScroll()
rearranges the position and value of vertical scroll bar.
 o getCell(int, int)
get the cell at position (row,column)
 o keyDown(Event, int)
handles key event
 o mouseDown(Event, int, int)
handles mouseDown Events.
 o mouseDrag(Event, int, int)
handles mouseDrag events.
 o mouseMove(Event, int, int)
handles the mouse move event.
 o mouseUp(Event, int, int)
handles mouseUp Event.
 o paint(Graphics)
 o refresh()
call this method after the data and/or cell features have been changed
 o reshape(int, int, int, int)
overrides the reshape method of component.
 o setCallback(JGridCallback)
set the callback for the grid
 o setColWidths(int[])
set the column width for each column
CAUTION: The array size of colWidths should be the same as the size of the title array
 o setContents(Object[][], boolean)
set the contents of the grid
 o setFeatures(String, String)
set the cell/row/column features
CAUTION: New features will override the old features.
 o update(Graphics)
overrides the update method of component

Variables

 o BOTH_BORDER
public static final int BOTH_BORDER
both borders

 o HORIZONTAL_BORDER
public static final int HORIZONTAL_BORDER
horizontal border only

 o VERTICAL_BORDER
public static final int VERTICAL_BORDER
vertical border only

Constructors

 o JGrid2
public JGrid2(String[] title,
              String[] columnTypes,
              boolean margin,
              int borderFlag)
constructor.
NOTE: The constructor determines the column number and all titles for each column. You can't change the title and column types after the grid is created.

Parameters:
title - The title array for the grid
columnTypes - The column types for the grid: Basic,News,Chart
margin - Whether the grid has margin or not
borderFlag - The border for each cell

Methods

 o action
public boolean action(Event evt,
                      Object what)
overrides action() method. NOTE: all scrollbar event should return false so that scrollbar can handle it.

Parameters:
evt - java.awt.Event
Returns:
boolean
Overrides:
action in class Component
 o computeHScroll
protected void computeHScroll()
rearranges the position and value of horizontal scroll bar.

 o computeVScroll
protected void computeVScroll()
rearranges the position and value of vertical scroll bar.

 o getCell
public JGrid.ICell getCell(int row,
                           int column)
get the cell at position (row,column)

Parameters:
row - row number of the cell
column - column number of the cell
Returns:
ICell a cell
 o keyDown
public boolean keyDown(Event evt,
                       int key)
handles key event

Parameters:
evt - event object
key - the key code for the key input
Overrides:
keyDown in class Component
 o mouseDown
public boolean mouseDown(Event evt,
                         int x,
                         int y)
handles mouseDown Events.

Parameters:
evt - java.awt.Event
x - int
y - int
Returns:
boolean
Overrides:
mouseDown in class Component
 o mouseDrag
public boolean mouseDrag(Event evt,
                         int x,
                         int y)
handles mouseDrag events.

Parameters:
evt - java.awt.Event
x - int
y - int
Returns:
boolean
Overrides:
mouseDrag in class Component
 o mouseMove
public boolean mouseMove(Event evt,
                         int x,
                         int y)
handles the mouse move event.

Parameters:
evt - java.awt.Event
x - int
y - int
Returns:
boolean
Overrides:
mouseMove in class Component
 o mouseUp
public boolean mouseUp(Event evt,
                       int x,
                       int y)
handles mouseUp Event.

Parameters:
evt - java.awt.Event
x - int
y - int
Returns:
boolean
Overrides:
mouseUp in class Component
 o paint
public void paint(Graphics g)
Overrides:
paint in class Container
 o refresh
public void refresh()
call this method after the data and/or cell features have been changed

 o reshape
public void reshape(int x,
                    int y,
                    int width,
                    int height)
overrides the reshape method of component.

Parameters:
x - int
y - int
width - int
height - int
Overrides:
reshape in class Component
 o setCallback
public void setCallback(JGridCallback callback)
set the callback for the grid

Parameters:
callback - a JGridCallback instance
 o setColWidths
public void setColWidths(int colWidths)
set the column width for each column
CAUTION: The array size of colWidths should be the same as the size of the title array

Parameters:
colWidths - the array of sizes for columns
 o setContents
public void setContents(Object[][] newValues,
                        boolean createContents)
set the contents of the grid

Parameters:
contents - array of values
recreateContents - if the size of the array changed compared to the current size
 o setFeatures
public void setFeatures(String pos,
                        String feature)
set the cell/row/column features
CAUTION: New features will override the old features. So it is recommended that users set the row features first, column features next and cell features last.

Parameters:
pos - group cells or a single cell; have a format of "row,column" or ",column"
NOTE: set features on a row has no effect.
feature - features "bgColor,textColor"; feature does not include type of cells.
Basic type: basic data type,background color,text color,alignment
Chart type: no features so far
News type: background color,text color
HNews type: background color,text color,step size

features can be enhanced based on special requirements.

 o update
public void update(Graphics g)
overrides the update method of component

Parameters:
g - java.awt.Graphics
Overrides:
update in class Container

All Packages  Class Hierarchy  This Package  Previous  Next  Index