|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--Watcher.v2_1.Table
Table is a component class which inherits JPanel. It contains a JTable in a JScrollpane and methods for getting and setting both the data in the JTable and the column headers. You can also edit the look-and-feel of the table by for example setting the font in a table cell and the background color of the table.
Inner classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent, javax.swing.JComponent.ActionStandin, javax.swing.JComponent.IntVector, javax.swing.JComponent.KeyboardState |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock |
Field Summary | |
private boolean |
autoresize
|
private java.awt.Color |
background
|
private boolean |
cellEditable
|
private java.awt.Dimension |
defDim
|
private java.awt.Font |
defFont
|
private int |
defRowHeight
|
private java.awt.Dimension |
defViewport
|
private int |
numOfRows
|
private javax.swing.JScrollPane |
scroll
|
private javax.swing.JTable |
table
|
private TableModell |
tableModell
|
private WatcherWindow |
window
|
Fields inherited from class javax.swing.JPanel |
defaultLayout, uiClassID |
Fields inherited from class javax.swing.JComponent |
_bounds, accessibleContext, actionMap, ACTIONMAP_CREATED, alignmentX, alignmentY, ANCESTOR_INPUTMAP_CREATED, ANCESTOR_USING_BUFFER, ancestorInputMap, ancestorNotifier, autoscroller, border, changeSupport, clientProperties, CREATED_DOUBLE_BUFFER, flags, FOCUS_INPUTMAP_CREATED, focusInputMap, HAS_FOCUS, htmlKey, htmlView, inputVerifier, IS_DOUBLE_BUFFERED, IS_OPAQUE, IS_PAINTING_TILE, IS_PRINTING, IS_PRINTING_ALL, KEY_EVENTS_ENABLED, KEYBOARD_BINDINGS_KEY, listenerList, maximumSize, minimumSize, NEXT_FOCUS, paintImmediatelyClip, paintingChild, preferredSize, readObjectCallbacks, REQUEST_FOCUS_DISABLED, tmpRect, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, verifyInputWhenFocusTarget, vetoableChangeSupport, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, WHEN_IN_FOCUSED_WINDOW_BINDINGS, WIF_INPUTMAP_CREATED, windowInputMap |
Fields inherited from class java.awt.Container |
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads, serialVersionUID |
Fields inherited from class java.awt.Component |
actionListenerK, adjustmentListenerK, appContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, width, windowClosingException, windowListenerK, visible, x, y |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
Table(java.lang.Object[] headers,
int[] widths,
int numOfRows)
Instantiates a new Table with the specified column headers and column widths, as well as the number of empty rows which is added. |
|
Table(java.lang.Object[] headers,
int[] widths,
java.lang.Object[][] data)
Instantiates a new Table with the specified column headers and column widths, and sets the table data to be the data in the specified array. |
Method Summary | |
private void |
dbg(java.lang.String dbg)
Adds a new debug-string to the DebugView with the classname as prefix. |
java.lang.Object |
getData(int row,
int column)
Returs the data in the specified cell or null if an Exception is caught. |
int |
getFirstEmptyRowNumber()
Checks the first cell in every row, starting from the top, and returns the row number of the first row without any data. |
int |
getRowCount()
Returns the number of rows in the table's model. |
int |
getRowForGAI(java.lang.String GAI)
Searches through the JTable for the specified GAI. |
int |
getSelectedRow()
Returns the row number of the selected row. |
boolean |
isCellEditable()
Returns True if the cells are editable, False otherwise. |
void |
removeData()
Removes all the data in the table by removing all the rows and adding a predefined number of empty rows afterwards. |
void |
removeRow(int rowNumber)
Removes the specified row from the table modell. |
void |
setBackgroundColor(java.awt.Color background)
Sets the background color of the table. |
void |
setCellEditable(boolean editable)
Sets wether the cells are editable. |
void |
setCellFont(java.awt.Font newFont)
Sets the font of the table cells. |
void |
setCellSpaceDimension(java.awt.Dimension newCellDim)
Sets the spacing between the table cells. |
void |
setColumnWidths(int[] widths)
Sets the column widths. |
void |
setData(int row,
int column,
java.lang.Object data)
Sets the data in the specified cell. |
void |
setDefaultValues()
Sets the properties of the table to the predefined values. |
void |
setHeaderFont(java.awt.Font newFont)
Sets the font of the headers. |
void |
setHeaders(java.lang.Object[] headers)
Sets the column headers. |
void |
setPanelBackgroundColor(java.awt.Color background)
Sets the background color of the JPanel. |
void |
setResizeMode(boolean automatic)
Sets the resize mode. |
void |
setRowHeight(int newHeight)
Sets the row height. |
void |
setRowSelectable(boolean selectable)
Sets wether user is allowed to select a row or not. |
void |
setScrollViewport(java.awt.Dimension newViewport)
Sets the viewport of the scrollpane. |
void |
setSelectedRow(int row)
Sets the specified row in the JTable as selected. |
void |
setToolTipText(java.lang.String tooltip)
Sets the ToolTipText of the table. |
Methods inherited from class javax.swing.JPanel |
|
Methods inherited from class javax.swing.JComponent |
_paintImmediately, addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, adjustPaintFlags, alwaysOnTop, checkIfChildObscuredBySibling, clearFocusOwners, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperties, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getFlag, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getWidth, getVisibleRect, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paintWithBuffer, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, readObject, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, registerWithKeyboardManager, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFlag, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager, unregisterWithKeyboardManager, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resetGC, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
Field Detail |
private javax.swing.JTable table
private TableModell tableModell
private javax.swing.JScrollPane scroll
private WatcherWindow window
private java.awt.Font defFont
private java.awt.Dimension defDim
private java.awt.Dimension defViewport
private int defRowHeight
private boolean autoresize
private boolean cellEditable
private java.awt.Color background
private int numOfRows
Constructor Detail |
public Table(java.lang.Object[] headers, int[] widths, int numOfRows)
headers
- Array of objects which are the column headers.widths
- Array of integers which are the column widths.numOfRows
- The number of rows which are added.public Table(java.lang.Object[] headers, int[] widths, java.lang.Object[][] data)
headers
- Array of objects which are the column headers.widths
- Array of integers which are the column widths.data
- A 2D-table of objects which is the table data to be added.Method Detail |
public java.lang.Object getData(int row, int column)
row
- The cell's row number.column
- The cell's column number.public int getFirstEmptyRowNumber()
public int getRowCount()
public int getRowForGAI(java.lang.String GAI)
GAI
- The wanted GAI.public int getSelectedRow()
public boolean isCellEditable()
public void removeData()
public void removeRow(int rowNumber)
rowNumber
- The row to be removed.public void setBackgroundColor(java.awt.Color background)
background
- The new background color.public void setCellEditable(boolean editable)
editable
- If True the cells are editable, if false they are not.public void setCellFont(java.awt.Font newFont)
newFont
- The new font.public void setCellSpaceDimension(java.awt.Dimension newCellDim)
newCellDim
- The dimension of the cell spacing.public void setColumnWidths(int[] widths)
widths
- An array of integers which specifies the column widths.public void setData(int row, int column, java.lang.Object data)
row
- The cell's row number.column
- The cell's column number.data
- The cell's new data.public void setDefaultValues()
public void setHeaderFont(java.awt.Font newFont)
newFont
- The new header font.public void setHeaders(java.lang.Object[] headers)
headers
- An array of objects which are the column headers.public void setPanelBackgroundColor(java.awt.Color background)
background
- The new background color.public void setResizeMode(boolean automatic)
automatic
- Specifies which of the two resize modes to use.public void setRowSelectable(boolean selectable)
selectable
- Specifies wether rowselection is allowed or not.public void setRowHeight(int newHeight)
newHeight
- The new row height.public void setScrollViewport(java.awt.Dimension newViewport)
public void setSelectedRow(int row)
row
- The row to be selected.public void setToolTipText(java.lang.String tooltip)
setToolTipText
in class javax.swing.JComponent
tooltip
- The table's tooltiptext.private void dbg(java.lang.String dbg)
dbg
- The debug-string to be added.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |