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
-
BOTH_BORDER
- both borders
-
HORIZONTAL_BORDER
- horizontal border only
-
VERTICAL_BORDER
- vertical border only
-
JGrid.JGrid2(String[], String[], boolean, int)
- constructor.
-
action(Event, Object)
- overrides action() method.
-
computeHScroll()
- rearranges the position and value of horizontal scroll bar.
-
computeVScroll()
- rearranges the position and value of vertical scroll bar.
-
getCell(int, int)
- get the cell at position (row,column)
-
keyDown(Event, int)
- handles key event
-
mouseDown(Event, int, int)
- handles mouseDown Events.
-
mouseDrag(Event, int, int)
- handles mouseDrag events.
-
mouseMove(Event, int, int)
- handles the mouse move event.
-
mouseUp(Event, int, int)
- handles mouseUp Event.
-
paint(Graphics)
-
-
refresh()
- call this method after the data and/or cell features have been changed
-
reshape(int, int, int, int)
- overrides the reshape method of component.
-
setCallback(JGridCallback)
- set the callback for the grid
-
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
-
setContents(Object[][], boolean)
- set the contents of the grid
-
setFeatures(String, String)
- set the cell/row/column features
CAUTION: New features will override the old features.
-
update(Graphics)
- overrides the update method of component
BOTH_BORDER
public static final int BOTH_BORDER
- both borders
HORIZONTAL_BORDER
public static final int HORIZONTAL_BORDER
- horizontal border only
VERTICAL_BORDER
public static final int VERTICAL_BORDER
- vertical border only
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
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
computeHScroll
protected void computeHScroll()
- rearranges the position and value of horizontal scroll bar.
computeVScroll
protected void computeVScroll()
- rearranges the position and value of vertical scroll bar.
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
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
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
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
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
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
paint
public void paint(Graphics g)
- Overrides:
- paint in class Container
refresh
public void refresh()
- call this method after the data and/or cell features have been changed
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
setCallback
public void setCallback(JGridCallback callback)
- set the callback for the grid
- Parameters:
- callback - a JGridCallback instance
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
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
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.
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