public class Grid extends Panel implements TableModelListener, AdjustmentListener
Panel.AccessibleAWTPanelContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
AUTO_RESIZE_EVENT |
static int |
AUTO_RESIZE_FIRST_COLUMN |
static int |
AUTO_RESIZE_LAST_COLUMN |
static int |
AUTO_RESIZE_OFF |
protected Font |
fFont |
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
Grid()
Constructor declaration
|
Grid(TableModel model)
Constructor declaration
|
| Modifier and Type | Method and Description |
|---|---|
void |
addActionListener(ActionListener l) |
void |
adjustmentValueChanged(AdjustmentEvent e) |
void |
changed() |
void |
clearSelection()
Clear the selection
|
Dimension |
getPreferredSize()
Method declaration
|
protected TableCellRenderer |
getRendererForColumn(int col) |
int |
getScrollBlockIncrement() |
int |
getScrollPosition() |
int |
getScrollUnitIncrement() |
int |
getSelectedRow()
Return the first selected row, or -1 if nothing is selected
|
int |
getSelectedRowCount() |
int[] |
getSelectedRows() |
Color |
getSelectionBackground()
Get the selection background colour
|
Color |
getSelectionForeground()
Get the selection foreground colour
|
void |
layoutChanged() |
static void |
main(String[] args) |
void |
paint(Graphics g)
Method declaration
|
Dimension |
preferredSize()
Method declaration
|
void |
removeActionListener(ActionListener l) |
void |
rowChanged(int row) |
void |
rowDeleted(int row) |
void |
rowInserted(int row) |
void |
setBounds(int x,
int y,
int w,
int h)
Method declaration
|
void |
setCellRenderer(Class columnClass,
TableCellRenderer renderer)
Set the cell renderer for a given column class
|
void |
setCellRenderer(int column,
TableCellRenderer renderer)
Set the cell renderer for a given number
|
void |
setColumnWidths(int[] colWidth) |
void |
setModel(TableModel model)
Set model
|
void |
setScrollPosition(int i) |
void |
setSelectionBackground(Color selectionBackground)
Set the selection background colour
|
void |
setSelectionForeground(Color selectionForeground)
Set the selection foreground colour
|
void |
setShowGrid(boolean showGrid) |
void |
update()
Method declaration
|
void |
update(Graphics g)
Method declaration
|
addNotify, getAccessibleContextadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, paramString, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final int AUTO_RESIZE_OFF
public static final int AUTO_RESIZE_EVENT
public static final int AUTO_RESIZE_FIRST_COLUMN
public static final int AUTO_RESIZE_LAST_COLUMN
protected Font fFont
public Grid()
public Grid(TableModel model)
model - modelpublic void addActionListener(ActionListener l)
public void removeActionListener(ActionListener l)
protected TableCellRenderer getRendererForColumn(int col)
public int getSelectedRow()
public void clearSelection()
model - public void setSelectionBackground(Color selectionBackground)
selectionBackground - selection background colourpublic Color getSelectionBackground()
public void setSelectionForeground(Color selectionForeground)
selectionForeground - selection foreground colourpublic Color getSelectionForeground()
public void setCellRenderer(Class columnClass, TableCellRenderer renderer)
columnClass - class to set renderer forrenderer - renderer to usepublic void setCellRenderer(int column,
TableCellRenderer renderer)
column - column numberrenderer - renderer to usepublic void setModel(TableModel model)
model - modelpublic void setColumnWidths(int[] colWidth)
public static void main(String[] args)
public void setBounds(int x,
int y,
int w,
int h)
public void update()
public void paint(Graphics g)
public void update(Graphics g)
public Dimension preferredSize()
preferredSize in class Containerpublic Dimension getPreferredSize()
getPreferredSize in class Containerpublic void layoutChanged()
layoutChanged in interface TableModelListenerpublic void changed()
changed in interface TableModelListenerpublic void rowInserted(int row)
rowInserted in interface TableModelListenerpublic void rowDeleted(int row)
rowDeleted in interface TableModelListenerpublic void rowChanged(int row)
rowChanged in interface TableModelListenerpublic void adjustmentValueChanged(AdjustmentEvent e)
adjustmentValueChanged in interface AdjustmentListenerpublic int[] getSelectedRows()
public void setScrollPosition(int i)
public int getScrollPosition()
public int getScrollBlockIncrement()
public int getScrollUnitIncrement()
public int getSelectedRowCount()
public void setShowGrid(boolean showGrid)
b - Copyright © 2021. All rights reserved.