|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JTable | +--uk.ac.starlink.table.gui.StarJTable
Extends the JTable for use with StarTable objects.
This convenience class adapts a JTable and sets its components appropriately
for viewing a StarTable. The main jobs it does are to set its
model to a suitable StarTableModel and make sure the cell renderers
are set up suitably.
It also provides configureColumnWidths(int, int)
and related methods
which sets the column widths according to the contents of the first few
rows of the table.
Field Summary |
Fields inherited from class javax.swing.JComponent |
accessibleContext, 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 |
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 |
Constructor Summary | |
StarJTable(boolean rowHeader)
Constructs a new StarJTable, optionally with a dummy first column displaying the row number. |
|
StarJTable(StarTable startable,
boolean rowHeader)
Construsts a new StarJTable to display a given StarTable, optionally with a dummy first column displaying the row number. |
Method Summary | |
static void |
configureColumnWidth(JTable table,
int maxpix,
int nrows,
int icol)
Sets the width of one column to match the width of its contents. |
void |
configureColumnWidths(int maxpix,
int nrows)
Sets the width of each column heuristically from the contents of the cells headers and cells. |
static void |
configureColumnWidths(JTable table,
int maxpix,
int nrows)
Utility method provided to set the widths of the columns of a JTable so that they match the widths of their contents. |
static int |
getCellWidth(JTable jtab,
int irow,
int icol)
Returns the preferred width in pixels of a given cell in a JTable. |
boolean |
hasRowHeader()
Indicates whether the first column of this table is a dummy column displaying the row index. |
void |
setStarTable(StarTable startable,
boolean rowHeader)
Sets this StarJTable up to display a given StarTable object, optionally with a dummy first column displaying the row number. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public StarJTable(boolean rowHeader)
rowHeader
- whether column 0 should contain row indicespublic StarJTable(StarTable startable, boolean rowHeader)
startable
- the StarTable to displayrowHeader
- whether column 0 should contain row indices
IllegalArgumentException
- if startable.isRandom
returns falseTables.randomTable(uk.ac.starlink.table.StarTable)
Method Detail |
public boolean hasRowHeader()
public void setStarTable(StarTable startable, boolean rowHeader)
StarTableModel
,
and the colum model will be set to one of which all the columns
are StarTableColumn
s.
startable
- the StarTable to displayrowHeader
- whether column 0 should contain row indices
IllegalArgumentException
- if startable.isRandom
returns falseTables.randomTable(uk.ac.starlink.table.StarTable)
public void configureColumnWidths(int maxpix, int nrows)
maxpix
- the maximum column width allowed (pixels)nrows
- the number of rows of the tables to survey
for working out column widths. If a number greater
than the number of rows in the table is given,
all rows will be surveyedpublic static void configureColumnWidths(JTable table, int maxpix, int nrows)
table
- the JTable whose widths are to be setmaxpix
- the maximum column width allowed (pixels)nrows
- the number of rows of the tables to survey
for working out column widths. If a number greater
than the number of rows in the table is given,
all rows will be surveyedpublic static void configureColumnWidth(JTable table, int maxpix, int nrows, int icol)
table
- the JTable whose widths are to be setmaxpix
- the maximum column width allowed (pixels)nrows
- the number of rows of the tables to survey
for working out column widths. If a number greater
than the number of rows in the table is given,
all rows will be surveyedicol
- the index of the column to be configuredpublic static int getCellWidth(JTable jtab, int irow, int icol)
jtab
- the table
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |