public class JTableHelper extends Object
JTableHelper
Modifier and Type | Field and Description |
---|---|
protected JTable |
m_Table
the table to work with.
|
static int |
MAX_ROWS
the maximum number of rows to use for calculation.
|
Constructor and Description |
---|
JTableHelper(JTable table)
initializes the object.
|
Modifier and Type | Method and Description |
---|---|
int |
calcColumnWidth(int col)
calcs the optimal column width of the given column.
|
static int |
calcColumnWidth(JTable table,
int col)
Calculates the optimal width for the column of the given table.
|
int |
calcHeaderWidth(int col)
calcs the optimal header width of the given column.
|
static int |
calcHeaderWidth(JTable table,
int col)
Calculates the optimal width for the header of the given table.
|
JTable |
getJTable()
returns the JTable.
|
void |
scrollToVisible(int row,
int col)
Assumes table is contained in a JScrollPane.
|
static void |
scrollToVisible(JTable table,
int row,
int col)
Assumes table is contained in a JScrollPane.
|
void |
setOptimalColumnWidth()
sets the optimal column width for all columns.
|
void |
setOptimalColumnWidth(int col)
sets the optimal column width for the given column.
|
static void |
setOptimalColumnWidth(JTable table)
sets the optimal column width for alls column if the given table.
|
static void |
setOptimalColumnWidth(JTable table,
int col)
sets the optimal column width for the given column.
|
void |
setOptimalHeaderWidth()
sets the optimal header width for all columns.
|
void |
setOptimalHeaderWidth(int col)
sets the optimal header width for the given column.
|
static void |
setOptimalHeaderWidth(JTable table)
sets the optimal header width for alls column if the given table.
|
static void |
setOptimalHeaderWidth(JTable table,
int col)
sets the optimal header width for the given column.
|
public static final int MAX_ROWS
protected JTable m_Table
public JTableHelper(JTable table)
table
- the table to work onpublic JTable getJTable()
public int calcColumnWidth(int col)
col
- the column indexpublic static int calcColumnWidth(JTable table, int col)
table
- the table to calculate the column widthcol
- the column to calculate the widthspublic int calcHeaderWidth(int col)
col
- the column indexpublic static int calcHeaderWidth(JTable table, int col)
table
- the table to calculate the column widthcol
- the column to calculate the widthspublic void setOptimalColumnWidth(int col)
col
- the column indexpublic static void setOptimalColumnWidth(JTable table, int col)
table
- the table to work oncol
- the column indexpublic void setOptimalColumnWidth()
public static void setOptimalColumnWidth(JTable table)
table
- the table to work onpublic void setOptimalHeaderWidth(int col)
col
- the column indexpublic static void setOptimalHeaderWidth(JTable table, int col)
table
- the table to work oncol
- the column indexpublic void setOptimalHeaderWidth()
public static void setOptimalHeaderWidth(JTable table)
table
- the table to work withpublic void scrollToVisible(int row, int col)
row
- the row indexcol
- the column indexpublic static void scrollToVisible(JTable table, int row, int col)
table
- the table to work withrow
- the row indexcol
- the column indexCopyright © 2017. All Rights Reserved.