Class RmaJTable
- All Implemented Interfaces:
ActionListener
,ItemListener
,KeyListener
,MouseListener
,TextListener
,ImageObserver
,MenuContainer
,Printable
,Serializable
,EventListener
,Accessible
,CellEditorListener
,DocumentListener
,ListSelectionListener
,RowSorterListener
,TableColumnModelListener
,TableModelListener
,Scrollable
,Modifiable
,TimeZoneComponent
,UnitsComponent
,EditableComponent
,FormManagementListener
,RmaValidComponent
- Direct Known Subclasses:
AccessTable
,ColorTable
,HecDataTable
JFrame frame = new JFrame();
Object[][] data = {
{"Mary", "Campione",
"Snowboarding", new Integer(5), new Boolean(false)},
{"Alison", "Huml",
"Rowing", new Integer(3), new Boolean(true)},
{"Kathy", "Walrath",
"Chasing toddlers", new Integer(2), new Boolean(false)},
{"Mark", "Andrews",
"Speed reading", new Integer(20), new Boolean(true)},
{"Angela", "Lih",
"Teaching high school", new Integer(4), new Boolean(false)}
};
String[] columnNames = {"First\nName",
"Last\nName",
"Sport",
"# of Years",
"Vegetarian"};
String[] columnNames2 = {"Name\nFirst",
"Name\nLast",
"Sport",
"# of Years",
"Vegetarian"};
boolean[] enabled = { true, true, true, true, true };
//RmaJTable tbl = new RmaJTable(frame, data, columnNames);
RmaJTable tbl = new RmaJTable(frame, columnNames);
tbl.setCellRenderer();
tbl.setMlHeaderRenderer();
tbl.setCells(data);
// to enable row headers
//tbl.setRowHeaderEnabled(true);
// to enable auto row headers
//tbl.setAutoRowHeaders(true);
tbl.setCellSelectionEnabled(false);
tbl.setRowSelectionAllowed(true);
tbl.setColumnSelectionAllowed(false);
Vector v = new Vector();
for (int i = 0; i < data.length; i++ )
v.addElement(data[i][2]);
tbl.setComboBoxEditor(2, v);
frame.getContentPane().add(tbl.getScrollPane(), BorderLayout.NORTH);
frame.setSize(300,600);
frame.setVisible(true);
//tbl.setNumRows(2);
//tbl.displayNumCol(3);
//tbl.displayNumCol(4);
tbl.setColumnLabels(columnNames2);
//tbl.setColumnEnabled(false, 1);
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
static class
Renderer for currency cells with formatting.class
Class Descriptionstatic class
Deprecated.use DefaultCellEditor insteadstatic class
class
Nested classes/interfaces inherited from class javax.swing.JTable
JTable.AccessibleJTable, JTable.DropLocation, JTable.PrintMode
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
is the first row fixed?protected int
DescriptionFields inherited from class javax.swing.JTable
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
-
Constructor Summary
ConstructorsConstructorDescriptioncreate RmaJTable with default data modelcreate RmaJTable with column title arraycreate RmaJTable with rowdata array and columntitles arraycreate new RmaJTable with rowData vector and ColumnNames vectorRmaJTable
(Component parent, RmaTableModelInterface dm) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks to see if editing should be stopped.void
actionPerformed
(ActionEvent event) popup mouse selection has occurredvoid
add a cell editor listenervoid
addPopupItem
(JComponent menuItem, int i) void
add a table change listenervoid
addTableMinMaxTracker
(int col) add a TableMinMaxTracker for column colvoid
add a table model listener to the table modelvoid
adjustAllColumnsWidthToFitData
(int margin) Adjust all column widths to fit data Takes one argument: marginvoid
adjustColumnWidthtoFitData
(int column, int margin) Adjust one column width to fit data Takes two arguments: column index and marginvoid
Appends a row to the end of the tablevoid
append a row of data to the end of the tablevoid
append a row to the table.void
append a row of data to the tablevoid
asks the user how many rows they want to append to the end of the tablevoid
appendRows
(int rows) append rows number of rows to the tableprotected void
build the table controls, setup the default cell editorprotected void
build the popup menuvoid
Method Descriptionvoid
changeSelection
(int rowIndex, int columnIndex, boolean toggle, boolean extend) void
clear()
Method Descriptionvoid
clearAll()
Method Descriptionvoid
clearAllComboBoxRowEditorValues
(int col) clear out all the values in the JComboBoxes for the column colvoid
clear all the cells, leaving cells visible on screenvoid
clear out the foreground and background colorsvoid
Gets called when the form decides to clear itselfvoid
Clears all Row backgrounds set by setRowBackground()void
void
prints out the current widths of all the columns useful for setting up the tableboolean
commitEdit
(boolean commit) if editing is occurring, either commit or cancel itvoid
constantFill
(double constantValue) take the selected cells and add the constantValue to themvoid
copy()
Method Descriptionvoid
copyall()
copyall copies the whole table and puts it in the system clipboard not yet implementedcreateAlignTableCellRenderer
(int align) Creates an AlignTableCellRenderer.protected TableCellRenderer
createBooleanRenderer
(boolean useSelectionBackground) protected RmaJComboBox
createComboBoxEditor
(int col, Object[] data, boolean sortData) protected RmaJDecimalField
createDecimalField
(int col, int precision) protected void
Method Descriptionprotected TableModel
create the default table model, initialize the table sets the table up : setCellSelectionEnabled(true); setRowSelectionAllowed(false); setColumnSelectionAllowed(false);void
Method Descriptionprotected void
Method Descriptionprotected JTableHeader
Create a cell renderer for general use in the table.protected JScrollPane
void
cut()
cut the data from the screen.void
remove all data from the table model and remove from displayvoid
delete the selected rows from the tablevoid
deleteRow
(int rowNum) delete the specified row from the tablevoid
displayNumCol
(int colNum) change the column model to display colNum number of columnsboolean
editCellAt
(int row, int column, EventObject e) Method Descriptionvoid
called when editing has been canceled.void
called when editing has stopped.void
exportAsHTML
(BufferedWriter writer) void
exportAsHTML
(BufferedWriter writer, String title, String indent) void
exportAsHTML
(String fileName) void
exportAsHTML
(String fileName, String title, String indent) void
exportAsXML
(BufferedWriter writer) void
exportAsXML
(BufferedWriter writer, String title, String indent) void
exportAsXML
(String fileName) void
exportAsXML
(String fileName, String title, String indent) void
export the table to file in tab delimited formatvoid
exportData
(BufferedWriter writer, char delimiterChar, boolean writeColumnHeaders) export the table to file in delimiterChar delimited format .void
exportData
(BufferedWriter writer, TableExportOptions options) export the table to file in specified by writer with the export options specified by options.protected void
exportData
(File file, TableExportOptions options) void
exportData
(String fileName, TableExportOptions options) export the table to file in user specified format format Used mainly for scriptingvoid
factorFill
(double factorValue) Method Descriptionvoid
fill()
Method Descriptionvoid
fillColumn
(int[] values, int col) fill a column with an integer arrayvoid
fillColumn
(Object[] values, int col) fill a the column num col with the object array valuesvoid
take the first cell selected and fill all cells in that column with that valueprotected void
protected void
fireTableChangeEvent
(int changeType, int startRow, int startCol, int endRow, int endCol) first off that the table has changed from a menu commandboolean
get the status of the append/insert/delete functionality is turned on/offboolean
int
Gets the AutoRowHeaderOffset attribute of the RmaJTable objectboolean
get whether auto row headers are enabledgetCell
(int row, int col) get a cell in the table model.getCellBackground
(int row, int column) getCellFont
(int row, int column) getCellForeground
(int row, int column) Gets the CellForeground attribute of the RmaJTable objectgetCellRect
(int row, int column, boolean includeSpacing) getCells()
return the data models data.protected Class
getClassForName
(String className) Gets the ClassForName attribute of the RmaJTable objectprotected Object
getClearedCellValue
(int col) get the default value to be used when a cell is cleared.int
getColumnBackground
(int colNum) get the background color for thereturns a vector of vectors which contain CellLocations for the selected columnsgetColumnForeground
(int colNum) Gets the ColumnForeground attribute of the RmaJTable objectgetColumnHeaderBackground
(int colNum) Gets the background color for a column header.getColumnHeaderFont
(int colNum) Gets the font for a column header.getColumnHeaderForeground
(int colNum) Gets the foreground color for a column header.getColumnLabel
(int colNum) Gets a column label (header).String[]
Gets the column headersint
getColumnWidth
(int col) int
getColumnWidthFromData
(int colNum) return the width that the column should be based on the data in the columnint[]
getDefaultRenderer
(Class<?> columnClass) getDisabledBackground
(int row, int col) get the Color to use for disabled cell backgroundsgetDisplayUnitsString
(int system) Gets the DisplayUnitsString attribute of the RmaJTable objectgetDisplayUnitsString
(int system, int column) Gets the DisplayUnitsString attribute of the RmaJTable objectint
Gets the DisplayUnitSystem attribute of the RmaJTable objectgetExportString
(TableExportOptions options) protected RmaJTableFillDialog
getFillDialog
(RmaJTable table) protected Vector<Vector<CellLocation>>
returns the first selected cellint
getHorizontalAlignment
(int col) getHTMLExportString
(String title, String indent) return the last selected cellObject[]
getMinMax
(int col) get the min and max values for a columnGets the ModifiedForegroundColor attribute of the RmaJTable objectint
return the number of rows in the table modelboolean
Gets the PopupMenu attribute of the RmaJTable objectboolean
get whether the popup menu is enabledprotected Font
int
Gets the Precision attribute of the RmaJTable objectint
getPreferredLineHeight
(String str, int width) Returns a reference to the print manager for this table.return other info for printing before tablereturn the title for 1st page of printingVector<?>
getRow
(int rowNum) return a Vector from the table model for row rowNumgetRowBackground
(int rowNum) get the background color for the row at rowNumgetRowBackground
(int rowNum, int colNum) Gets the RowBackground attribute of the RmaJTable objectgetRowForeground
(int rowNum) get the foreground color for the row at rowNumgetRowForeground
(int rowNum, int colNum) boolean
get whether row headers are enabledint
getRowHeight
(int row) protected int
return the scroll pane that this table is residing in this is the component that needs added to the screenreturns the first selected cell's datareturn a vector of CellLocations for the selected cells this functionality isn't implemented if getColumnSelectionAllowed(true) is setreturns a vector of vectors which contain CellLocationsget a vector of the selected cell dataint[]
int[]
if useNonContiguousSelection is set: Normally, for default tables, if user selected (1,1) and (1,2), getSelectedRow and getSelectedColumn would return: rows = [1] and columns = [1,2].when RowSelectionAllowed is set it will return a vector of vectors that contain the selected rowsGets the TimeZone attribute of the RmaJTable objectgetToolTipText
(MouseEvent event) returns the tooltip text for a given cell converts the mouse event to a row/column positionGets the ViewportRowHeader attribute of the RmaJTable objectgetXMLExportString
(String title, String indent) protected void
handlePopupMenu
(MouseEvent event) handle the popup menuvoid
insert a row at the current row ask user how many rows to insert.void
insert a row of data at the specified rowvoid
Method Descriptionboolean
isCellEditable
(int row, int column) Returns true if the cell atrow
andcolumn
is editable.boolean
isCellSelected
(int row, int column) boolean
get whether this table is editable or notboolean
boolean
Gets the ManagingFocus attribute of the RmaJTable objectboolean
returns whether this table has been modifiedboolean
isValid
(boolean showError) Called to check to see if this table has valid data.void
editor listener methodsvoid
keyPressed
(KeyEvent ke) void
keyReleased
(KeyEvent ke) void
void
take the first cell selected and the last cell selected and fill the cells inbetween with linear valuesvoid
linearFill
(CellLocation firstCell, CellLocation lastCell) Method Descriptionstatic void
The main program for the RmaJTable classvoid
mouseClicked
(MouseEvent event) does nothingboolean
does nothingvoid
mouseEntered
(MouseEvent event) does nothingvoid
mouseExited
(MouseEvent event) does nothingvoid
mousePressed
(MouseEvent event) does nothingvoid
mouseReleased
(MouseEvent event) process mouse clicks for the popup menu don't override this method.void
paste()
paste implementationprotected int
Method DescriptionprepareEditor
(TableCellEditor editor, int row, int column) private void setUpDecimalEditor(JTable table) { /Set up the editor for the integer cells.int
print
(Graphics g, PageFormat pageFormat, int pageIndex) print this table This method is public as an implementation side effect.void
create the printjob and tell it to print.void
Method Descriptionprotected void
Method Descriptionvoid
remove a cell editor listenervoid
protected void
Method Descriptionvoid
remove the last row from the tablevoid
Removes the Import option on the default Popup Menu Import is removed if the poup menu is definedvoid
Removes the Fill option on the default Popup Menu Import is removed if the poup menu is definedvoid
Removes the Insert and Append row options on the default Popup Menu Insert Row Append Row Are removed if the poup menu is defined This is useful when the table is editable but doesn't allow inserting rows in between existing elementsvoid
Removes the two Print options on the default Popup Menu Print and Print Preview Are removed if the poup menu is definedvoid
Removes the three Row Editing options on the default Popup Menu Insert Row Append Row Delete Row Are removed if the poup menu is defined This is useful when the table is non-editablevoid
Removes the two Sum options on the default Popup Menu Sum Selected Cells Sum Entire Column Are removed if the poup menu is definedvoid
Method Descriptionvoid
Method Descriptionvoid
take the first cell selected and fill all cells in that column with that valueprotected void
repeatFill
(Vector<Vector<CellLocation>> cellTable, CellLocation firstCell, CellLocation lastCell) void
Method Descriptionvoid
reverse the cells of the selection row 1 becomes the last row and the last row becomes the firstint
rowAtPoint
(Point point) void
select all the cellsvoid
setAddRemoveEnabled
(boolean enable) Sometime you don't want the user to be able to add/delete/append rows this turns off that capability.void
setAllColumnsEnabled
(boolean enable) enables or disables all columnsvoid
setAllowsFontResizing
(boolean allowResizing) void
setAlternatingReportBackground
(boolean b) void
void
setAutoRowHeaders
(boolean enable) if row headers are enabled and the cell renderer is an RmaCellRenderer make the row headers the same as the row number + 1.void
setAutoRowHeaders
(boolean enable, int offset) Sets the AutoRowHeaders attribute of the RmaJTable objectsetButtonCellEditor
(int col) Sets a button editor on the specified column.void
set a cell in the table model.void
setCellBackground
(int row, int column, Color rbColor) void
setCellEnabled
(boolean enable, int row, int col) Sets the CellEnabled attribute of the RmaJTable objectvoid
setCellFont
(int row, int column, Font font) void
setCellForeground
(int row, int column, Color rfColor) void
set the table cell renderer with an RmaCellRenderervoid
set the table model datavoid
Sets the Cells attribute of the RmaJTable objectsetCheckBoxCellEditor
(int col) sets a TextArea editor for column number colsetCheckBoxCellEditor
(int col, boolean useSelectionBackground) sets a TextArea editor for column number col sets a checkbox editor for column number colsetColorComboBoxEditor
(int col) set the column col to have a Color combo box editorvoid
setColumnBackground
(int colNum, Color color) Sets the ColumnBackground attribute of the RmaJTable objectvoid
setColumnEditor
(int col, RmaCellEditor editor) set the column col to have the arg editor.void
setColumnEditor
(int col, RmaCellEditor editor, TableCellRenderer renderer) void
setColumnEnabled
(boolean enable, int col) enable or disable column colvoid
setColumnForeground
(int colNum, Color color) Sets the ColumnForeground attribute of the RmaJTable objectvoid
setColumnHeaderBackground
(int colNum, Color color) Sets the background color for a column header.void
setColumnHeaderFont
(int colNum, Font font) Sets the foreground color for a column header.void
setColumnHeaderForeground
(int colNum, Color color) Sets the foreground color for a column header.void
setColumnLabel
(int colNum, String label) Sets a column label (header).void
setColumnLabels
(String[] colNames) sets the column headersvoid
setColumnParameters
(int[] params) Sets the ColumnParameters attribute of the RmaJTable objectvoid
setColumnPrecision
(int colNum, int precision) void
setColumnsEnabled
(boolean[] enabled) given an array of booleans set the columns to be enabled/disabled according to the arrayvoid
setColumnsEnabled
(boolean enabled, int... cols) enable or disable column a set of columnssetColumnVisible
(int colNum, boolean show, int preferedWidth) show or hide column colNum.setColumnVisible
(int tmColNum, int tcmColNum, boolean show, int preferedWidth) show or hide a column.void
setColumnWidth
(int colNum, int width) set the column width for a given columnvoid
setColumnWidths
(int... widths) set the column widths to the array of widths.setComboBoxCellEditor
(int row, int col, RmaJComboBox comboBox) Sets the RmaJComboBox component Editor for a specific row and columnsetComboBoxEditor
(int col, Object[] data) set the column col to have a combo box editor with the dropdown filled with sorted datasetComboBoxEditor
(int col, Object[] data, boolean sortData) set the column col to have a combo box editor with the dropdown filled with datasetComboBoxEditor
(int col, Vector data) set the column col to have a combo box editor with the dropdown filled with datasetComboBoxRowEditor
(int row, int col, Vector data) Sets the component Editor for a specific row in a columnsetCurrencyCellEditor
(int col) setDateCellEditor
(int col, String format) set the cell editor to be a datesetDateCellEditor
(int col, String format, boolean showCalendar) setDateEditorForCell
(int row, int col, String format, boolean showCalendar) set a date editor for a cellsetDateTimeCellEditor
(int col) setDateTimeEditorForCell
(int row, int col) set a date time editor for a cellvoid
set tooltips for the headers to display whats in the header cellsetDescriptionCellEditor
(int col) set the editor to be a RmaJDescriptionField which has elipsis button to display the entire contents of the textvoid
setDisplayScaleFactor
(int paramId, double scaleFactor) Sets the DisplayScaleFactor attribute of the RmaJTable objectvoid
setDisplayUnitsSystem
(int unitSystem) Sets the DisplayUnitsSystem attribute of the RmaJTable objectvoid
set the cell editor for all the columns to be a RMADecimalFieldvoid
setDoubleCellEditor
(boolean showFormatting) set the cell editor for all the columns to be a RMADecimalField specifying whether to show commas.setDoubleCellEditor
(int col) set a cell editor for column col to be a RMADecimalFieldsetDoubleCellEditor
(int col, boolean showFormatting) set a cell editor for column col to be a RMADecimalFieldvoid
setDoubleCellEditor
(int beginCol, int endCol) set the cell editor from beginCol to EndCol to be a RMADecimalFieldvoid
setDoubleCellEditor
(int beginCol, int endCol, boolean showFormatting) set the double cell editor from beginCol to endCol to be a RMADecimalField if showFormatting is true then show with embedded commas.setDoubleEditorForCell
(int row, int col) Sets an integer editor for a specific row in a columnsetDssPathPartCellEditor
(int col) set the cell editor to be a datevoid
setEditable
(boolean editable) set whether this table is editable or notprotected JTextField
setEditorForCell
(int row, int col, JTextField fld) void
setEnabled
(boolean enable) Sets the Enabled attribute of the RmaJTable objectvoid
setFirstFixedRow
(boolean fixed) set the first row fixed.void
setFixedLengthCellEditor
(int col, int length, int Case) set a cell editor for a column to be a fixed length field if case == 1 then the field will be all uppercase case == -1 then the field will be all lowercasevoid
setHorizontalAlignment
(int align) sets the horizontal alignment for all table columnsvoid
setHorizontalAlignment
(int align, int col) sets the horizontal alignment for a given table columnsetIntegerCellEditor
(int col) setIntegerEditorForCell
(int row, int col) Sets an integer editor for a specific row in a columnvoid
setIsEditable
(boolean b) for EditableComponent interfacesetLongCellEditor
(int col) protected void
setMenusEnabled
(boolean editable) Sets the MenusEnabled attribute of the RmaJTable objectsets table up to display multi line headersvoid
setModel
(TableModel tableModel) void
setModified
(boolean modified) sets whether this table has been modifiedvoid
setModifiedForegroundColor
(Color color) Sets the ModifiedForegroundColor attribute of the RmaJTable objectvoid
setNumColumns
(int columns) set the number of columnsvoid
setNumRows
(int rows) set the number of rows in the table modelvoid
sets the parent for this dialogvoid
setPasteAddsRows
(boolean addRows) void
setPasteBackground
(Color color) set the background for cells that get pasted intovoid
setPasteForeground
(Color color) set the foreground for cells that get pasted intovoid
setPopupMenu
(JPopupMenu popup) allow the user to set their own popup menuvoid
setPopupMenuEnabled
(boolean enable) set the popup menu enabled or notvoid
setPrecision
(int p) Sets the Precision attribute of the RmaJTable objectvoid
setPrintOtherInfo
(PageText otherInfo) void
setPrintTitle
(PageText titleInfo) title for 1st page of printingvoid
setProcessKeyEvents
(boolean process) whether to process key events which causes the Enter and Escape key to be consumed.boolean
set the row rowNum in the table model to the object array rowDataboolean
set the row rowNum in the table model to the vector rowDatavoid
setRowBackground
(int rowNum, Color rbColor) set the background color for the row at rowNumvoid
setRowEnabled
(boolean enable, int row) Sets the RowEnabled attribute of the RmaJTable objectvoid
setRowForeground
(int rowNum, Color rfColor) set the foreground color for the row at rowNumvoid
setRowHeaderEnabled
(boolean enable) set the table to have row headers.void
setRowHeaderRenderer
(int column) void
setRowSelectionInterval
(int index0, int index1, boolean scrollToSelection) void
setRowSorter
(RowSorter<? extends TableModel> sorter) void
setSelectedIndices
(int... indices) void
setTableHeader
(JTableHeader header) Overriding the default operation in setTableHeader to call configureEnclosingScrollPane() if the header is an instance of GroupableTableHeader.void
setTabToEditCell
(boolean tabToEditCell) Set if a tab key should select the next editable cell in the row (if no more editable cells, the tab just moves to the next cell)setTextAreaCellEditor
(int col) setTextAreaCellEditor
(int col, boolean addSrcollPane) set the cell editor and renderer for multiple lines of textvoid
setTextFieldRowEditor
(int row, int col, String value) setTimeCellEditor
(int col) set the cell editor to be Military timesetTimeEditorForCell
(int row, int col) set a time editor for a table cellvoid
setTimeZone
(TimeZone tz) Sets the TimeZone attribute of the RmaJTable objectvoid
setToggleCellEditor
(int col, char key1, char key2, char toggleKey) set the editor to toggle between 2 key values.void
Sets the UnitsHeaderRenderer attribute of the RmaJTable objectvoid
setUnitsHeaderRenderer
(boolean useDefaultRenderer) protected void
set up so that the TAB and SHIFT-TAB are managed by the table.void
setUseDefaultPrintHeader
(boolean useDefaultPrintHeader) final void
setUseNonContiguousSelection
(boolean useNonContiguousSelection) Option to turn on/ off non contiguous selection in a table.setViewportRowHeader
(String[] headers, Object[][] data, ColumnGroup[] groups, int[][] columns, int width) add a row header to the JScrollPanesetViewportRowHeader
(TableModel model, ColumnGroup[] groups, int[][] columns, int width) add a row header to the JScrollPaneprotected boolean
shouldShowPopup
(Point popupPoint) void
sumColumn
(boolean entireColumn) protected void
tabBackAction
(int ancRow, int ancCol) protected void
tabForwardAction
(int ancRow, int ancCol) void
table model data has changedvoid
textValueChanged
(TextEvent event) void
does nothingvoid
does nothingvoid
does nothingvoid
does nothingvoid
undo()
does nothingvoid
updateSelection
(int rowIndex, int columnIndex, boolean toggle, boolean extend) update the cell selection.protected void
updateSelectionModel
(ListSelectionModel sm, int index, boolean toggle, boolean extend) Method Descriptionboolean
protected void
valueFill
(double fillValue, boolean addIt) Method DescriptionMethods inherited from class javax.swing.JTable
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultSelectionModel, createScrollPaneForTable, doLayout, editCellAt, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedRow, getSelectedRowCount, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, initializeLocalVars, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareRenderer, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, unconfigureEnclosingScrollPane, updateUI, valueChanged
Methods inherited from class javax.swing.JComponent
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
_rowForeground
-
_rowBackground
-
_cellForeground
-
_cellBackground
-
_firstFixedRow
protected boolean _firstFixedRowis the first row fixed? -
_maxNumPage
protected int _maxNumPageDescription
-
-
Constructor Details
-
RmaJTable
public RmaJTable() -
RmaJTable
create RmaJTable with default data model- Parameters:
parent
- Description
-
RmaJTable
-
RmaJTable
-
RmaJTable
create RmaJTable with column title array- Parameters:
parent
- DescriptioncolumnNames
- Description
-
RmaJTable
create RmaJTable with rowdata array and columntitles array- Parameters:
parent
- DescriptionrowData
- DescriptioncolumnNames
- Description
-
RmaJTable
create new RmaJTable with rowData vector and ColumnNames vector- Parameters:
parent
- DescriptionrowData
- DescriptioncolumnNames
- Description
-
-
Method Details
-
getDisplayScaleMap
-
setDisplayScaleFactor
public void setDisplayScaleFactor(int paramId, double scaleFactor) Sets the DisplayScaleFactor attribute of the RmaJTable object- Specified by:
setDisplayScaleFactor
in interfaceUnitsComponent
- Parameters:
paramId
- The new DisplayScaleFactor valuescaleFactor
- The new DisplayScaleFactor value
-
setDisplayUnitsSystem
public void setDisplayUnitsSystem(int unitSystem) Sets the DisplayUnitsSystem attribute of the RmaJTable object- Specified by:
setDisplayUnitsSystem
in interfaceUnitsComponent
- Parameters:
unitSystem
- The new DisplayUnitsSystem value
-
getDisplayUnitSystem
public int getDisplayUnitSystem()Gets the DisplayUnitSystem attribute of the RmaJTable object- Returns:
- The DisplayUnitSystem value
-
setTimeZone
Sets the TimeZone attribute of the RmaJTable object- Specified by:
setTimeZone
in interfaceTimeZoneComponent
- Parameters:
tz
- The new TimeZone value
-
getTimeZone
Gets the TimeZone attribute of the RmaJTable object- Specified by:
getTimeZone
in interfaceTimeZoneComponent
- Returns:
- The TimeZone value
-
setColumnParameters
public void setColumnParameters(int[] params) Sets the ColumnParameters attribute of the RmaJTable object- Parameters:
params
- The new ColumnParameters value
-
getDisplayUnitsString
Gets the DisplayUnitsString attribute of the RmaJTable object- Specified by:
getDisplayUnitsString
in interfaceUnitsComponent
- Parameters:
system
- Description- Returns:
- The DisplayUnitsString value
- See Also:
-
getDisplayUnitsString
Gets the DisplayUnitsString attribute of the RmaJTable object- Parameters:
system
- Descriptioncolumn
- Description- Returns:
- The DisplayUnitsString value
-
createRmaCellRenderer
Create a cell renderer for general use in the table. This method was added so that it can be overridden in in subclasses of RmaJTable to use customized cell renderers. -
setCellRenderer
public void setCellRenderer()set the table cell renderer with an RmaCellRenderer -
getDefaultRenderer
- Overrides:
getDefaultRenderer
in classJTable
- Parameters:
columnClass
- Description- Returns:
- The DefaultRenderer value
-
createDefaultDataModel
create the default table model, initialize the table sets the table up : setCellSelectionEnabled(true); setRowSelectionAllowed(false); setColumnSelectionAllowed(false);- Overrides:
createDefaultDataModel
in classJTable
- Returns:
- Description
-
createDefaultEditors
public void createDefaultEditors()Method Description- Overrides:
createDefaultEditors
in classJTable
-
createDefaultRenderers
protected void createDefaultRenderers()Method Description- Overrides:
createDefaultRenderers
in classJTable
-
createDefaultTableHeader
- Overrides:
createDefaultTableHeader
in classJTable
-
createDefaultBorder
protected void createDefaultBorder()Method Description -
buildControls
protected void buildControls()build the table controls, setup the default cell editor -
createScrollPane
-
setPopupMenu
allow the user to set their own popup menu- Parameters:
popup
- The new PopupMenu value
-
buildPopup
protected void buildPopup()build the popup menu -
getPopupMenuItemFont
-
setUpTabKeys
protected void setUpTabKeys()set up so that the TAB and SHIFT-TAB are managed by the table. -
tabBackAction
protected void tabBackAction(int ancRow, int ancCol) - Parameters:
ancRow
-ancCol
-
-
tabForwardAction
protected void tabForwardAction(int ancRow, int ancCol) - Parameters:
ancRow
-ancCol
-
-
findInTableAction
protected void findInTableAction() -
processComponentKeyEvent
Method Description- Overrides:
processComponentKeyEvent
in classJComponent
- Parameters:
e
- Description
-
addTableModelListener
add a table model listener to the table model- Parameters:
l
- The feature to be added to the TableModelListener attribute
-
addTableChangeListener
add a table change listener- Parameters:
t
- The feature to be added to the TableChangeListener attribute
-
removeTableChangeListener
Method Description- Parameters:
t
- Description
-
addTableMinMaxTracker
public void addTableMinMaxTracker(int col) add a TableMinMaxTracker for column col- Parameters:
col
- The feature to be added to the TableMinMaxTracker attribute
-
removeCellEditorListener
- Parameters:
l
- Description
-
addCellEditorListener
add a cell editor listener- Parameters:
l
- The feature to be added to the CellEditorListener attribute
-
removeCellEditorListener
remove a cell editor listener- Parameters:
l
- Description
-
removeEditorListeners
protected void removeEditorListeners()Method Description -
editingCanceled
called when editing has been canceled. Pass on this call to any registered listeners.- Specified by:
editingCanceled
in interfaceCellEditorListener
- Overrides:
editingCanceled
in classJTable
- Parameters:
e
- Description
-
_editingStopped
Checks to see if editing should be stopped. Returns true if editing has been stopped otherwise false. This method check to see if the edited field is valid and if the whole table is valid. If both are true, editing is stopped and the editor is removed.- Parameters:
e
- Description- Returns:
- Description
-
editingStopped
called when editing has stopped. Pass on call to any registered listeners.- Specified by:
editingStopped
in interfaceCellEditorListener
- Overrides:
editingStopped
in classJTable
- Parameters:
e
- Description
-
editCellAt
Method Description- Overrides:
editCellAt
in classJTable
- Parameters:
row
- Descriptioncolumn
- Descriptione
- Description- Returns:
- Description
-
tableChanged
table model data has changed- Specified by:
tableChanged
in interfaceTableModelListener
- Overrides:
tableChanged
in classJTable
- Parameters:
e
- Description
-
itemStateChanged
editor listener methods- Specified by:
itemStateChanged
in interfaceItemListener
- Parameters:
e
- Description
-
changedUpdate
Method Description- Specified by:
changedUpdate
in interfaceDocumentListener
- Parameters:
e
- Description
-
insertUpdate
Method Description- Specified by:
insertUpdate
in interfaceDocumentListener
- Parameters:
e
- Description
-
removeUpdate
Method Description- Specified by:
removeUpdate
in interfaceDocumentListener
- Parameters:
e
- Description
-
getMinMax
get the min and max values for a column- Parameters:
col
- Description- Returns:
- The MinMax value
-
prepareEditor
private void setUpDecimalEditor(JTable table) { /Set up the editor for the integer cells. final RMADecimalField decimalField = new RMADecimalField(0, 5); decimalField.setHorizontalAlignment(decimalField.RIGHT); DefaultCellEditor decimalEditor = new DefaultCellEditor(decimalField) { /Override DefaultCellEditor's getCellEditorValue method /to return an Integer, not a String: public Object getCellEditorValue() { return new Double(decimalField.getValue()); } }; table.setDefaultEditor(Double.class, decimalEditor); } Prepares the specified editor using the value at the specified cell.- Overrides:
prepareEditor
in classJTable
- Parameters:
editor
- Descriptionrow
- Descriptioncolumn
- Description- Returns:
- Description
-
getNumRows
public int getNumRows()return the number of rows in the table model- Returns:
- The NumRows value
-
getRow
return a Vector from the table model for row rowNum- Parameters:
rowNum
- Description- Returns:
- The Row value
-
getScrollPane
return the scroll pane that this table is residing in this is the component that needs added to the screen- Returns:
- The ScrollPane value
-
setRowSelectionInterval
public void setRowSelectionInterval(int index0, int index1, boolean scrollToSelection) -
isModified
public boolean isModified()returns whether this table has been modified- Specified by:
isModified
in interfaceModifiable
- Returns:
- The Modified value
-
setModified
public void setModified(boolean modified) sets whether this table has been modified- Specified by:
setModified
in interfaceModifiable
- Parameters:
modified
- The new Modified value
-
setParent
sets the parent for this dialog- Parameters:
parent
- The new Parent value
-
setColumnWidths
public void setColumnWidths(int... widths) set the column widths to the array of widths.- Parameters:
widths
- The new ColumnWidths value
-
setDefaultHeaderToolTipText
public void setDefaultHeaderToolTipText()set tooltips for the headers to display whats in the header cell -
setColumnWidth
public void setColumnWidth(int colNum, int width) set the column width for a given column- Parameters:
colNum
- The new ColumnWidth valuewidth
- The new ColumnWidth value
-
actionPerformed
popup mouse selection has occurred- Specified by:
actionPerformed
in interfaceActionListener
- Parameters:
event
- Description
-
getSelectedRowsVector
when RowSelectionAllowed is set it will return a vector of vectors that contain the selected rows- Returns:
- The SelectedRowsVector value
-
getSelectedCellData
returns the first selected cell's data- Returns:
- The SelectedCellData value
-
setNumColumns
public void setNumColumns(int columns) set the number of columns- Parameters:
columns
- The new NumColumns value
-
getClickCountToStart
public int getClickCountToStart() -
setRowForeground
set the foreground color for the row at rowNum- Parameters:
rowNum
- The new RowForeground valuerfColor
- The new RowForeground value
-
setRowBackground
set the background color for the row at rowNum- Parameters:
rowNum
- The new RowBackground valuerbColor
- The new RowBackground value
-
clearRowBackgrounds
public void clearRowBackgrounds()Clears all Row backgrounds set by setRowBackground() -
getRowBackground
get the background color for the row at rowNum- Parameters:
rowNum
- Description- Returns:
- The RowBackground value
-
getRowBackground
Gets the RowBackground attribute of the RmaJTable object- Parameters:
rowNum
- DescriptioncolNum
- Description- Returns:
- The RowBackground value
-
setColumnBackground
Sets the ColumnBackground attribute of the RmaJTable object- Parameters:
colNum
- The new ColumnBackground valuecolor
- The new ColumnBackground value
-
setColumnForeground
Sets the ColumnForeground attribute of the RmaJTable object- Parameters:
colNum
- The new ColumnForeground valuecolor
- The new ColumnForeground value
-
getColumnBackground
get the background color for the- Parameters:
colNum
- Description- Returns:
- The ColumnBackground value
-
getColumnForeground
Gets the ColumnForeground attribute of the RmaJTable object- Parameters:
colNum
- Description- Returns:
- The ColumnForeground value
-
setModifiedForegroundColor
Sets the ModifiedForegroundColor attribute of the RmaJTable object- Parameters:
color
- The new ModifiedForegroundColor value
-
getModifiedForegroundColor
Gets the ModifiedForegroundColor attribute of the RmaJTable object- Returns:
- The ModifiedForegroundColor value
-
setPasteBackground
set the background for cells that get pasted into- Parameters:
color
- The new PasteBackground value
-
setPasteForeground
set the foreground for cells that get pasted into- Parameters:
color
- The new PasteForeground value
-
getPasteBackground
- Returns:
- The PasteBackground value
-
getPasteForeground
- Returns:
- The PasteForeground value
-
setCellBackground
- Parameters:
row
- The new CellBackground valuecolumn
- The new CellBackground valuerbColor
- The new CellBackground value
-
setCellForeground
- Parameters:
row
- The new CellForeground valuecolumn
- The new CellForeground valuerfColor
- The new CellForeground value
-
setCellFont
- Parameters:
row
- The new CellBackground valuecolumn
- The new CellBackground valuefont
- The new CellBackground value
-
getCellFont
-
getCellBackground
- Parameters:
row
- Descriptioncolumn
- Description- Returns:
- The CellBackground value
-
getDisabledBackground
get the Color to use for disabled cell backgrounds- Parameters:
row
- the cell's rowcol
- the cell's column- Returns:
- UIManager's TextField.disabledBackground color by default
-
getCellForeground
Gets the CellForeground attribute of the RmaJTable object- Parameters:
row
- Descriptioncolumn
- Description- Returns:
- The CellForeground value
-
getRowForeground
get the foreground color for the row at rowNum- Parameters:
rowNum
- Description- Returns:
- The RowForeground value
-
getRowForeground
- Parameters:
rowNum
- DescriptioncolNum
- Description- Returns:
- The RowForeground value
-
setPrecision
public void setPrecision(int p) Sets the Precision attribute of the RmaJTable object- Parameters:
p
- The new Precision value
-
setAlternatingReportBackground
public void setAlternatingReportBackground(boolean b) -
getAlternatingReportBackground
public boolean getAlternatingReportBackground() -
setAlternatingReportBackgroundColor
-
getAlternatingReportBackgroundColor
-
getPrecision
public int getPrecision()Gets the Precision attribute of the RmaJTable object- Returns:
- The Precision value
-
getColumnLabel
Gets a column label (header).- Parameters:
colNum
- The column for which to retrieve the label.- Returns:
- The column label.
-
getColumnLabels
Gets the column headers- Returns:
- The ColumnLabels value
-
setColumnLabel
Sets a column label (header).- Parameters:
colNum
- The column for which to set the label.label
- The label text.
-
setColumnLabels
sets the column headers- Parameters:
colNames
- The new ColumnLabels value
-
getColumnHeaderForeground
Gets the foreground color for a column header.- Parameters:
colNum
- The column number.- Returns:
- The foreground color of the column header.
-
setColumnHeaderForeground
Sets the foreground color for a column header.- Parameters:
colNum
- The column number.color
- The foreground color.
-
getColumnHeaderBackground
Gets the background color for a column header.- Parameters:
colNum
- The column number.- Returns:
- The background color of the column header.
-
setColumnHeaderBackground
Sets the background color for a column header.- Parameters:
colNum
- The column number.color
- The background color.
-
getColumnHeaderFont
Gets the font for a column header.- Parameters:
colNum
- The column number.- Returns:
- The font of the column header.
-
setColumnHeaderFont
Sets the foreground color for a column header.- Parameters:
colNum
- The column number.font
- The font.
-
setColumnVisible
public TableColumn setColumnVisible(int colNum, boolean show, int preferedWidth) throws IllegalArgumentException show or hide column colNum. If showing set the column width to preferred size hiding a column is based on the TableColumnModel showing a column is based on the TableModel- Parameters:
colNum
- The new ColumnVisible valueshow
- The new ColumnVisible valuepreferedWidth
- The new ColumnVisible value- Returns:
- Description
- Throws:
IllegalArgumentException
- Description
-
setColumnVisible
public TableColumn setColumnVisible(int tmColNum, int tcmColNum, boolean show, int preferedWidth) throws IllegalArgumentException show or hide a column.- Parameters:
tmColNum
- The new ColumnVisible valuetcmColNum
- The new ColumnVisible valueshow
- The new ColumnVisible valuepreferedWidth
- The new ColumnVisible value- Returns:
- Description
- Throws:
IllegalArgumentException
- Description
-
displayNumCol
public void displayNumCol(int colNum) change the column model to display colNum number of columns- Parameters:
colNum
- Description
-
getHorizontalAlignment
public int getHorizontalAlignment(int col) -
createAlignTableCellRenderer
Creates an AlignTableCellRenderer. Method used to allow subclasses of RmaJTable to override the cell renderer.- Parameters:
align
-- Returns:
-
setHorizontalAlignment
public void setHorizontalAlignment(int align) sets the horizontal alignment for all table columns- Parameters:
align
- The new HorizontalAlignment value
-
setHorizontalAlignment
public void setHorizontalAlignment(int align, int col) sets the horizontal alignment for a given table column- Parameters:
align
- The new HorizontalAlignment valuecol
- The column
-
setTabToEditCell
public void setTabToEditCell(boolean tabToEditCell) Set if a tab key should select the next editable cell in the row (if no more editable cells, the tab just moves to the next cell)- Parameters:
tabToEditCell
- The new TabToEditCell value
-
setCurrencyCellEditor
-
setTextAreaCellEditor
set the cell editor and renderer for multiple lines of text- Parameters:
col
- The new TextAreaCellEditor value- Returns:
- Description
-
setTextAreaCellEditor
-
setToggleCellEditor
public void setToggleCellEditor(int col, char key1, char key2, char toggleKey) set the editor to toggle between 2 key values.- Parameters:
col
- The new ToggleCellEditor valuekey1
- The new ToggleCellEditor valuekey2
- The new ToggleCellEditor valuetoggleKey
- The new ToggleCellEditor value
-
setButtonCellEditor
Sets a button editor on the specified column. The button is returned to add ActionListeners or change its appearance. -
setDoubleCellEditor
public void setDoubleCellEditor()set the cell editor for all the columns to be a RMADecimalField -
setDoubleCellEditor
public void setDoubleCellEditor(boolean showFormatting) set the cell editor for all the columns to be a RMADecimalField specifying whether to show commas.- Parameters:
showFormatting
- The new DoubleCellEditor value
-
setDoubleCellEditor
public void setDoubleCellEditor(int beginCol, int endCol) set the cell editor from beginCol to EndCol to be a RMADecimalField- Parameters:
beginCol
- The new DoubleCellEditor valueendCol
- The new DoubleCellEditor value
-
setDoubleCellEditor
public void setDoubleCellEditor(int beginCol, int endCol, boolean showFormatting) set the double cell editor from beginCol to endCol to be a RMADecimalField if showFormatting is true then show with embedded commas.- Parameters:
beginCol
- The new DoubleCellEditor valueendCol
- The new DoubleCellEditor valueshowFormatting
- The new DoubleCellEditor value
-
setDoubleCellEditor
set a cell editor for column col to be a RMADecimalField- Parameters:
col
- The new DoubleCellEditor value- Returns:
- Description
-
setDoubleCellEditor
set a cell editor for column col to be a RMADecimalField- Parameters:
col
- The new DoubleCellEditor valueshowFormatting
- The new DoubleCellEditor value- Returns:
- Description
-
setDoubleEditorForCell
Sets an integer editor for a specific row in a column- Parameters:
row
- the table row for the editorcol
- the table column for the editor
-
setEditorForCell
- Parameters:
row
-col
-fld
-- Returns:
-
createDecimalField
-
setIntegerCellEditor
-
setIntegerEditorForCell
Sets an integer editor for a specific row in a column- Parameters:
row
- the table row for the editorcol
- the table column for the editor
-
setLongCellEditor
- Parameters:
col
-- Returns:
-
setDescriptionCellEditor
set the editor to be a RmaJDescriptionField which has elipsis button to display the entire contents of the text- Parameters:
col
- the table column- Returns:
- the editor component
-
setTimeCellEditor
set the cell editor to be Military time- Parameters:
col
- The new TimeCellEditor value- Returns:
- Description
-
setTimeEditorForCell
set a time editor for a table cell- Parameters:
row
- the editor rowcol
- the editor column- Returns:
- the editor
-
setDateEditorForCell
set a date editor for a cell- Parameters:
row
- row for the editorcol
- column for the editorformat
- the format of the text to enter. @see rma.swing.text.DateDocument for formats- Returns:
- the editor
-
setDateCellEditor
set the cell editor to be a date- Parameters:
col
- The new DateCellEditor valueformat
- The new DateCellEditor value- Returns:
- Description
-
setDateCellEditor
-
setDateTimeCellEditor
-
setDateTimeEditorForCell
set a date time editor for a cell- Parameters:
row
- row for the editorcol
- column for the editor- Returns:
- the editor
-
setDssPathPartCellEditor
set the cell editor to be a date- Parameters:
col
- The new DssPathPartCellEditor value- Returns:
- Description
-
clearAllComboBoxRowEditorValues
public void clearAllComboBoxRowEditorValues(int col) clear out all the values in the JComboBoxes for the column col- Parameters:
col
- the table column
-
setComboBoxRowEditor
Sets the component Editor for a specific row in a column- Parameters:
row
- The new ComboBoxRowEditor valuecol
- The new ComboBoxRowEditor valuedata
- The new ComboBoxRowEditor value
-
setComboBoxCellEditor
Sets the RmaJComboBox component Editor for a specific row and column- Parameters:
row
- The new ComboBoxRowEditor valuecol
- The new ComboBoxRowEditor valuecomboBox
- The new ComboBoxRowEditor- Returns:
- void
-
setTextFieldRowEditor
-
setColorComboBoxEditor
set the column col to have a Color combo box editor- Parameters:
col
- The new ColorComboBoxEditor value- Returns:
- Description
-
setComboBoxEditor
set the column col to have a combo box editor with the dropdown filled with sorted data- Parameters:
col
- The new ComboBoxEditor valuedata
- The new ComboBoxEditor value- Returns:
- Description
-
setComboBoxEditor
set the column col to have a combo box editor with the dropdown filled with data- Parameters:
col
- The new ComboBoxEditor valuedata
- The new ComboBoxEditor valuesortData
- The new ComboBoxEditor value- Returns:
- Description
-
createComboBoxEditor
- Parameters:
col
-data
-- Returns:
-
setComboBoxEditor
set the column col to have a combo box editor with the dropdown filled with data- Parameters:
col
- The new ComboBoxEditor valuedata
- The new ComboBoxEditor value- Returns:
- Description
-
setColumnEditor
set the column col to have the arg editor.- Parameters:
col
- The new ColumnEditor valueeditor
- The new ColumnEditor value
-
setColumnEditor
-
setFixedLengthCellEditor
public void setFixedLengthCellEditor(int col, int length, int Case) set a cell editor for a column to be a fixed length field if case == 1 then the field will be all uppercase case == -1 then the field will be all lowercase- Parameters:
col
- The new FixedLengthCellEditor valuelength
- The new FixedLengthCellEditor valueCase
- The new FixedLengthCellEditor value
-
setUnitsHeaderRenderer
public void setUnitsHeaderRenderer()Sets the UnitsHeaderRenderer attribute of the RmaJTable object -
setUnitsHeaderRenderer
public void setUnitsHeaderRenderer(boolean useDefaultRenderer) - Parameters:
useDefaultRenderer
-
-
setMlHeaderRenderer
sets table up to display multi line headers -
setCheckBoxCellEditor
sets a TextArea editor for column number col- Parameters:
col
- The new CheckBoxCellEditor value- Returns:
- Description
-
setCheckBoxCellEditor
sets a TextArea editor for column number col sets a checkbox editor for column number col- Parameters:
col
- The new CheckBoxCellEditor valueuseSelectionBackground
- true for the CellRenderer to render the selection background when the cell is selection- Returns:
- Description
-
createBooleanRenderer
-
setAllColumnsEnabled
public void setAllColumnsEnabled(boolean enable) enables or disables all columns- Parameters:
enable
- The new AllColumnsEnabled value
-
setIsEditable
public void setIsEditable(boolean b) for EditableComponent interface- Specified by:
setIsEditable
in interfaceEditableComponent
- Parameters:
b
- The new IsEditable value
-
setEnabled
public void setEnabled(boolean enable) Sets the Enabled attribute of the RmaJTable object- Overrides:
setEnabled
in classJComponent
- Parameters:
enable
- The new Enabled value
-
setUseNonContiguousSelection
public final void setUseNonContiguousSelection(boolean useNonContiguousSelection) Option to turn on/ off non contiguous selection in a table.- Parameters:
useNonContiguousSelection
-
-
changeSelection
public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) - Overrides:
changeSelection
in classJTable
-
isCellSelected
public boolean isCellSelected(int row, int column) - Overrides:
isCellSelected
in classJTable
-
clearSelection
public void clearSelection()- Overrides:
clearSelection
in classJTable
-
getSelectedRows
public int[] getSelectedRows()if useNonContiguousSelection is set: Normally, for default tables, if user selected (1,1) and (1,2), getSelectedRow and getSelectedColumn would return: rows = [1] and columns = [1,2]. However, since we are dealing with noncontiguous cells, these two methods return instead: rows = [1, 1] and columns = [1, 2].- Overrides:
getSelectedRows
in classJTable
-
getSelectedColumns
public int[] getSelectedColumns()- Overrides:
getSelectedColumns
in classJTable
-
setMenusEnabled
protected void setMenusEnabled(boolean editable) Sets the MenusEnabled attribute of the RmaJTable object- Parameters:
editable
- The new MenusEnabled value
-
setEditable
public void setEditable(boolean editable) set whether this table is editable or not- Parameters:
editable
- The new Editable value
-
isEditable
public boolean isEditable()get whether this table is editable or not- Returns:
- The Editable value
-
setRowEnabled
public void setRowEnabled(boolean enable, int row) Sets the RowEnabled attribute of the RmaJTable object- Parameters:
enable
- The new RowEnabled valuerow
- The new RowEnabled value
-
resetRowEnabled
public void resetRowEnabled()Method Description -
setColumnsEnabled
public void setColumnsEnabled(boolean enabled, int... cols) enable or disable column a set of columns- Parameters:
enabled
- true to enable the column, false to disablecols
- The columns to set enabled or disabled
-
setColumnEnabled
public void setColumnEnabled(boolean enable, int col) enable or disable column col- Parameters:
enable
- The new ColumnEnabled valuecol
- The new ColumnEnabled value
-
setCellEnabled
public void setCellEnabled(boolean enable, int row, int col) Sets the CellEnabled attribute of the RmaJTable object- Parameters:
enable
- The new CellEnabled valuerow
- The new CellEnabled valuecol
- The new CellEnabled value
-
setColumnsEnabled
public void setColumnsEnabled(boolean[] enabled) given an array of booleans set the columns to be enabled/disabled according to the array- Parameters:
enabled
- The new ColumnsEnabled value
-
setNumRows
public void setNumRows(int rows) set the number of rows in the table model- Parameters:
rows
- The new NumRows value
-
getSelectedCells
get a vector of the selected cell data- Returns:
- The SelectedCells value
-
getFirstSelectedCell
returns the first selected cell- Returns:
- The FirstSelectedCell value
-
getLastSelectedCell
return the last selected cell- Returns:
- The LastSelectedCell value
-
getSelectedCellRange
return a vector of CellLocations for the selected cells this functionality isn't implemented if getColumnSelectionAllowed(true) is set- Returns:
- The SelectedCellRange value
-
getSelectedCellRangeVector
returns a vector of vectors which contain CellLocations- Returns:
- The SelectedCellRangeVector value
-
getFillToEndCellRangeVector
-
getColumnCellRangeVector
returns a vector of vectors which contain CellLocations for the selected columns- Returns:
- The Selected column CellRangeVector value
-
getCell
get a cell in the table model. Unlike the getValueAt() in the JTable this does not try to map the col to the Column Model.- Parameters:
row
- Descriptioncol
- Description- Returns:
- The Cell value
-
setCell
set a cell in the table model. Unlike the setValueAt() in the JTable this does not try to map the col to the Column Model or view. So any table sorting or filtering will result in the wrong cell being set.Normally setValueAt() should be used not this method.
- Parameters:
obj
- The new Cell valuerow
- The new Cell valuecol
- The new Cell value
-
setModel
-
setCells
set the table model data- Parameters:
data
- The new Cells value
-
setCells
Sets the Cells attribute of the RmaJTable object- Parameters:
data
- The new Cells value
-
setRow
set the row rowNum in the table model to the object array rowData- Parameters:
rowNum
- The new Row valuerowData
- The new Row value- Returns:
- Description
-
setRow
set the row rowNum in the table model to the vector rowData- Parameters:
rowNum
- The new Row valuerowData
- The new Row value- Returns:
- Description
-
getCells
return the data models data. A vector of vectors- Returns:
- The Cells value
-
clearAll
public void clearAll()Method Description -
clearColors
public void clearColors()clear out the foreground and background colors -
clearCells
public void clearCells()clear all the cells, leaving cells visible on screen -
getClearedCellValue
get the default value to be used when a cell is cleared.- Returns:
-
deleteCells
public void deleteCells()remove all data from the table model and remove from display -
commitEdit
public boolean commitEdit(boolean commit) if editing is occurring, either commit or cancel it- Parameters:
commit
- Description- Returns:
- Description
-
textValueChanged
- Specified by:
textValueChanged
in interfaceTextListener
- Parameters:
event
- Description
-
keyTyped
- Specified by:
keyTyped
in interfaceKeyListener
- Parameters:
ke
- Description
-
keyPressed
- Specified by:
keyPressed
in interfaceKeyListener
- Parameters:
ke
- Description
-
keyReleased
- Specified by:
keyReleased
in interfaceKeyListener
- Parameters:
ke
- Description
-
mouseReleased
process mouse clicks for the popup menu don't override this method. its public as an implementation side-effect. overridehandlePopupMenu
insead- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
event
- the mouse event
-
handlePopupMenu
handle the popup menu- Parameters:
event
- the mouse event
-
shouldShowPopup
-
mousePressed
does nothing- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
event
- Description
-
mouseClicked
does nothing- Specified by:
mouseClicked
in interfaceMouseListener
- Parameters:
event
- Description
-
mouseEntered
does nothing- Specified by:
mouseEntered
in interfaceMouseListener
- Parameters:
event
- Description
-
mouseExited
does nothing- Specified by:
mouseExited
in interfaceMouseListener
- Parameters:
event
- Description
-
mouseDown
does nothing -
fireTableChangeEvent
protected void fireTableChangeEvent(int changeType, int startRow, int startCol, int endRow, int endCol) first off that the table has changed from a menu command- Parameters:
changeType
- DescriptionstartRow
- DescriptionstartCol
- DescriptionendRow
- DescriptionendCol
- Description
-
clearPerformed
public void clearPerformed()Gets called when the form decides to clear itself- Specified by:
clearPerformed
in interfaceFormManagementListener
-
selectAll
public void selectAll()select all the cells -
undo
public void undo()does nothing -
cut
public void cut()cut the data from the screen. Uses a mix of copy and clear -
fillColumn
public void fillColumn(int[] values, int col) fill a column with an integer array- Parameters:
values
- Descriptioncol
- Description
-
fillColumn
fill a the column num col with the object array values- Parameters:
values
- Descriptioncol
- Description
-
getFillDialog
-
fill
public void fill()Method Description -
reverseSelectionContents
public void reverseSelectionContents()reverse the cells of the selection row 1 becomes the last row and the last row becomes the first -
linearFill
public void linearFill()take the first cell selected and the last cell selected and fill the cells inbetween with linear values -
linearFill
Method Description- Parameters:
firstCell
- DescriptionlastCell
- Description
-
constantFill
public void constantFill(double constantValue) take the selected cells and add the constantValue to them- Parameters:
constantValue
- Description
-
factorFill
public void factorFill(double factorValue) Method Description- Parameters:
factorValue
- Description
-
valueFill
protected void valueFill(double fillValue, boolean addIt) Method Description- Parameters:
fillValue
- DescriptionaddIt
- Description
-
fillToEnd
public void fillToEnd()take the first cell selected and fill all cells in that column with that value -
repeatFill
public void repeatFill()take the first cell selected and fill all cells in that column with that value -
repeatFill
protected void repeatFill(Vector<Vector<CellLocation>> cellTable, CellLocation firstCell, CellLocation lastCell) -
sumColumn
public void sumColumn(boolean entireColumn) -
paste
public void paste()paste implementation -
pasteCell
Method Description- Parameters:
str
- Descriptionr
- Descriptionc
- Description- Returns:
- Description
-
copyall
public void copyall()copyall copies the whole table and puts it in the system clipboard not yet implemented -
copy
public void copy()Method Description -
clear
public void clear()Method Description -
insertRow
public void insertRow()insert a row at the current row ask user how many rows to insert. -
getRowsToInsert
protected int getRowsToInsert()- Returns:
-
insertRow
insert a row of data at the specified row- Parameters:
rowData
- data to insertrow
- place to insert it
-
appendRows
public void appendRows()asks the user how many rows they want to append to the end of the table -
appendRow
public void appendRow()Appends a row to the end of the table -
appendRow
append a row of data to the end of the table- Parameters:
data
- Description
-
appendRow
append a row to the table. allow user to pick whether they want to revalidate the table.- Parameters:
data
- Descriptionreval
- Description
-
appendRow
append a row of data to the table- Parameters:
data
- Descriptionreval
- Descriptionbcolor
- Descriptionfcolor
- Description
-
appendRows
public void appendRows(int rows) append rows number of rows to the table- Parameters:
rows
- Description
-
deleteRow
public void deleteRow()delete the selected rows from the table -
deleteRow
public void deleteRow(int rowNum) delete the specified row from the table- Parameters:
rowNum
-
-
removeLastRow
public void removeLastRow()remove the last row from the table -
traverseCellLeft
public void traverseCellLeft()does nothing -
traverseCellUp
public void traverseCellUp()does nothing -
traverseCellDown
public void traverseCellDown()does nothing -
traverseCellRight
public void traverseCellRight()does nothing -
setAddRemoveEnabled
public void setAddRemoveEnabled(boolean enable) Sometime you don't want the user to be able to add/delete/append rows this turns off that capability. Also turns on/off pasting appending rows if more rows are in the cut buffer than the table has.- Parameters:
enable
- false to turn off add/delete/append rows and pasting appending rows
-
setFirstFixedRow
public void setFirstFixedRow(boolean fixed) set the first row fixed. This disallows inserting before the first row- Parameters:
fixed
-
-
isFirstFixedRow
public boolean isFirstFixedRow()- Returns:
-
setProcessKeyEvents
public void setProcessKeyEvents(boolean process) whether to process key events which causes the Enter and Escape key to be consumed.- Parameters:
process
- true to process key events
-
getAddRemoveEnabled
public boolean getAddRemoveEnabled()get the status of the append/insert/delete functionality is turned on/off- Returns:
- The AddRemoveEnabled value
-
setPopupMenuEnabled
public void setPopupMenuEnabled(boolean enable) set the popup menu enabled or not- Parameters:
enable
- The new PopupMenuEnabled value
-
getPopupMenuEnabled
public boolean getPopupMenuEnabled()get whether the popup menu is enabled- Returns:
- The PopupMenuEnabled value
-
getPopupMenu
Gets the PopupMenu attribute of the RmaJTable object- Returns:
- The PopupMenu value
-
removePopupMenuSumOptions
public void removePopupMenuSumOptions()Removes the two Sum options on the default Popup Menu Sum Selected Cells Sum Entire Column Are removed if the poup menu is defined -
removePopupMenuPrintOptions
public void removePopupMenuPrintOptions()Removes the two Print options on the default Popup Menu Print and Print Preview Are removed if the poup menu is defined -
removePopuMenuExportOptions
public void removePopuMenuExportOptions()Removes the Import option on the default Popup Menu Import is removed if the poup menu is defined -
removePopuMenuFillOptions
public void removePopuMenuFillOptions()Removes the Fill option on the default Popup Menu Import is removed if the poup menu is defined -
removePopupMenuRowEditingOptions
public void removePopupMenuRowEditingOptions()Removes the three Row Editing options on the default Popup Menu Insert Row Append Row Delete Row Are removed if the poup menu is defined This is useful when the table is non-editable -
removePopupMenuInsertAppendOnly
public void removePopupMenuInsertAppendOnly()Removes the Insert and Append row options on the default Popup Menu Insert Row Append Row Are removed if the poup menu is defined This is useful when the table is editable but doesn't allow inserting rows in between existing elements -
setRowHeaderEnabled
public void setRowHeaderEnabled(boolean enable) set the table to have row headers. This only works if the cell renderer is an RmaCellRenderer. The first row of the table model becomes the row headers- Parameters:
enable
- The new RowHeaderEnabled value
-
setRowHeaderRenderer
public void setRowHeaderRenderer(int column) -
getRowHeaderEnabled
public boolean getRowHeaderEnabled()get whether row headers are enabled- Returns:
- The RowHeaderEnabled value
-
setAutoRowHeaders
public void setAutoRowHeaders(boolean enable) if row headers are enabled and the cell renderer is an RmaCellRenderer make the row headers the same as the row number + 1.- Parameters:
enable
- The new AutoRowHeaders value
-
setAutoRowHeaders
public void setAutoRowHeaders(boolean enable, int offset) Sets the AutoRowHeaders attribute of the RmaJTable object- Parameters:
enable
- The new AutoRowHeaders valueoffset
- The new AutoRowHeaders value
-
getAutoRowHeaderOffset
public int getAutoRowHeaderOffset()Gets the AutoRowHeaderOffset attribute of the RmaJTable object- Returns:
- The AutoRowHeaderOffset value
-
getAutoRowHeaders
public boolean getAutoRowHeaders()get whether auto row headers are enabled- Returns:
- The AutoRowHeaders value
-
columnSizes
public void columnSizes()prints out the current widths of all the columns useful for setting up the table -
getToolTipText
returns the tooltip text for a given cell converts the mouse event to a row/column position- Overrides:
getToolTipText
in classJTable
- Parameters:
event
- Description- Returns:
- The ToolTipText value
-
isCellEditable
public boolean isCellEditable(int row, int column) Returns true if the cell atrow
andcolumn
is editable. Otherwise, invokingsetValueAt
on the cell will have no effect.Note: The column is specified in the table view's display order, and not in the
TableModel
's column order. This is an important distinction because as the user rearranges the columns in the table, the column at a given index in the view will change. Meanwhile the user's actions never affect the model's column ordering.- Overrides:
isCellEditable
in classJTable
- Parameters:
row
- the row whose value is to be queriedcolumn
- the column whose value is to be queried- Returns:
- true if the cell is editable
- See Also:
-
isManagingFocus
public boolean isManagingFocus()Gets the ManagingFocus attribute of the RmaJTable object- Overrides:
isManagingFocus
in classJComponent
- Returns:
- The ManagingFocus value
-
getCellRect
- Overrides:
getCellRect
in classJTable
-
getColumnWidth
public int getColumnWidth(int col) -
getColumnWidths
public int[] getColumnWidths() -
setColumnPrecision
public void setColumnPrecision(int colNum, int precision) -
getRowHeight
public int getRowHeight(int row) - Overrides:
getRowHeight
in classJTable
-
getPreferredLineHeight
-
rowAtPoint
- Overrides:
rowAtPoint
in classJTable
-
setViewportRowHeader
public RmaJTable setViewportRowHeader(TableModel model, ColumnGroup[] groups, int[][] columns, int width) add a row header to the JScrollPane- Parameters:
model
- The new ViewportRowHeader valuegroups
- use this if you need to add column groups to the row headers, otherwise null.columns
- A list of columns to add to each group. The rows of the array correspond to each group in the group array, i.e row 1 is the first column group in the group array, and all items in row one represent column numbers of the columns to add to that group. If grououps are null then columns is ignored.width
- The preferred width of the row headers
-
setViewportRowHeader
public RmaJTable setViewportRowHeader(String[] headers, Object[][] data, ColumnGroup[] groups, int[][] columns, int width) add a row header to the JScrollPane- Parameters:
data
- The data to display in the table row headergroups
- use this if you need to add column groups to the row headers, otherwise null.columns
- A list of columns to add to each group. The rows of the array correspond to each group in the group array, i.e row 1 is the first column group in the group array, and all items in row one represent column numbers of the columns to add to that group. If grououps are null then columns is ignored.width
- The preferred width of the row headers
-
updateSelectionModel
protected void updateSelectionModel(ListSelectionModel sm, int index, boolean toggle, boolean extend) Method Description- Parameters:
sm
- Descriptionindex
- Descriptiontoggle
- Descriptionextend
- Description
-
updateSelection
public void updateSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) update the cell selection. will use the selection model to determine if the entire row/column should select.- Parameters:
rowIndex
- - the row to selectcolumnIndex
- - the column to selecttoggle
- - if the selection is currently selected then deselectextend
- - extend to the current select to the new selection.
-
getViewportRowHeader
Gets the ViewportRowHeader attribute of the RmaJTable object- Returns:
- The ViewportRowHeader value
-
getClassForName
Gets the ClassForName attribute of the RmaJTable object- Parameters:
className
- Description- Returns:
- The ClassForName value
-
getPrintManager
Returns a reference to the print manager for this table. -
printData
public void printData()create the printjob and tell it to print. -
print
print this table This method is public as an implementation side effect. do not call.- Specified by:
print
in interfacePrintable
- Parameters:
g
- DescriptionpageFormat
- DescriptionpageIndex
- Description- Returns:
- Description
- Throws:
PrinterException
- Description
-
printPreview
public void printPreview()Method Description -
setPrintTitle
title for 1st page of printing- Parameters:
titleInfo
- The new PrintTitle value
-
setPrintOtherInfo
- Parameters:
otherInfo
- The new PrintOtherInfo value
-
getPrintTitle
return the title for 1st page of printing- Returns:
- The PrintTitle value
-
getPrintOtherInfo
return other info for printing before table- Returns:
- The PrintOtherInfo value
-
exportData
public void exportData()export the table to file in tab delimited format -
exportData
export the table to file in delimiterChar delimited format . if writeHeaders is true write the table headers. no rowheaders, no fixed width columns, no quoted strings, no grid lines, no title- Parameters:
writer
- DescriptiondelimiterChar
- DescriptionwriteColumnHeaders
- Description
-
exportData
export the table to file in user specified format format Used mainly for scripting -
exportData
- Throws:
IOException
-
exportData
export the table to file in specified by writer with the export options specified by options.- Parameters:
writer
- Descriptionoptions
- Description
-
getExportString
-
exportAsXML
-
exportAsXML
-
exportAsXML
-
exportAsXML
-
getXMLExportString
-
getXMLExportString
-
exportAsHTML
-
exportAsHTML
-
exportAsHTML
-
exportAsHTML
-
getHTMLExportString
-
getHTMLExportString
-
isValid
public boolean isValid(boolean showError) Called to check to see if this table has valid data. This method should be overridden to provide a more generalized implemenation.- Specified by:
isValid
in interfaceRmaValidComponent
- Parameters:
showError
- Description- Returns:
- The Valid value
-
setPasteAddsRows
public void setPasteAddsRows(boolean addRows) -
getPasteAddsRows
public boolean getPasteAddsRows() -
main
The main program for the RmaJTable class- Parameters:
args
- The command line arguments
-
useDefaultPrintHeader
public boolean useDefaultPrintHeader()- Returns:
- Returns the useDefaultPrintHeader.
-
setUseDefaultPrintHeader
public void setUseDefaultPrintHeader(boolean useDefaultPrintHeader) - Parameters:
useDefaultPrintHeader
- The useDefaultPrintHeader to set.
-
getColumnWidthFromData
public int getColumnWidthFromData(int colNum) return the width that the column should be based on the data in the column- Parameters:
colNum
- the column index. zero based.- Returns:
- the width of the column
-
adjustAllColumnsWidthToFitData
public void adjustAllColumnsWidthToFitData(int margin) Adjust all column widths to fit data Takes one argument: margin -
adjustColumnWidthtoFitData
public void adjustColumnWidthtoFitData(int column, int margin) Adjust one column width to fit data Takes two arguments: column index and margin -
getPopupPoint
-
setAllowsFontResizing
public void setAllowsFontResizing(boolean allowResizing) -
setSelectedIndices
public void setSelectedIndices(int... indices) -
setTableHeader
Overriding the default operation in setTableHeader to call configureEnclosingScrollPane() if the header is an instance of GroupableTableHeader.- Overrides:
setTableHeader
in classJTable
-
setRowSorter
- Overrides:
setRowSorter
in classJTable
-
addPopupItem
-