本文整理匯總了Java中org.jdesktop.swingx.JXTable.getRowCount方法的典型用法代碼示例。如果您正苦於以下問題:Java JXTable.getRowCount方法的具體用法?Java JXTable.getRowCount怎麽用?Java JXTable.getRowCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jdesktop.swingx.JXTable
的用法示例。
在下文中一共展示了JXTable.getRowCount方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findAttributeCell
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
public static TableCell findAttributeCell(final JXTable table, final HUAttributeSetModel model, final String identifier)
{
int resultViewRowIndex = -1;
for (int viewRowIndex = 0; viewRowIndex < table.getRowCount(); viewRowIndex++)
{
final int modelRowIndex = table.convertRowIndexToModel(viewRowIndex);
final I_M_Attribute attribute = model.getM_Attribute(modelRowIndex);
if (attribute.getName().equals(identifier))
{
resultViewRowIndex = viewRowIndex;
break;
}
}
return TableCell.row(resultViewRowIndex).column(HUAttributeSetModel.COLUMN_PropertyValue);
}
示例2: createListModel
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* @param tableModel2
* @param i
* @return
*/
private ListModel createListModel(final JXTable tableModel, final int i) {
ListModel listModel = new AbstractListModel(){
@Override
public Object getElementAt(int index) {
return tableModel.getValueAt(index, i);
}
@Override
public int getSize() {
return tableModel.getRowCount();
}};
return listModel ;
}
示例3: interactiveColorValueMappedHighlighterPredicate
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Example to highlight against a value/color map.
* Here the control is in predicate. <p>
*
*/
public void interactiveColorValueMappedHighlighterPredicate() {
JXTable table = new JXTable(new AncientSwingTeam());
// build a quick color lookup to simulate multi-value value-based
// coloring
final int numberColumn = 3;
table.toggleSortOrder(numberColumn);
Color[] colors = new Color[] { Color.YELLOW, Color.CYAN, Color.MAGENTA,
Color.GREEN };
int rowsPerColor = (table.getRowCount() - 5) / colors.length;
Map<Color, HighlightPredicate> map = new HashMap<Color, HighlightPredicate>();
for (int i = 0; i < colors.length; i++) {
List<Integer> values = new ArrayList<Integer>();
for (int j = 0; j < rowsPerColor; j++) {
values.add((Integer) table.getValueAt(i * rowsPerColor + j, numberColumn));
}
map.put(colors[i], new ValueMappedHighlightPredicate(values, numberColumn));
}
// create one ColorHighlighter for each color/predicate pair and
// add to a compoundHighlighter
CompoundHighlighter chl = new CompoundHighlighter();
for (Color color : colors) {
chl.addHighlighter(new ColorHighlighter(map.get(color), color, null));
}
table.resetSortOrder();
table.addHighlighter(chl);
showWithScrollingInFrame(table,
"compound highlighter with value-based color mapping predicate");
}
示例4: interactiveColorValueMappedHighlighter
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Example to highlight against a value/color map. <p>
* Here the Highlighter takes full control. Which is a bit
* on the border line of
* the intended distribution of responsibility between
* Highlighter and HighlighterPredicate.
*/
public void interactiveColorValueMappedHighlighter() {
JXTable table = new JXTable(new AncientSwingTeam());
// build a quick color lookup to simulate multi-value value-based
// coloring
final int numberColumn = 3;
table.toggleSortOrder(numberColumn);
final Map<Integer, Color> lookup = new HashMap<Integer, Color>();
Color[] colors = new Color[] { Color.YELLOW, Color.CYAN, Color.MAGENTA,
Color.GREEN };
int rowsPerColor = (table.getRowCount() - 5) / colors.length;
for (int i = 0; i < colors.length; i++) {
for (int j = 0; j < rowsPerColor; j++) {
lookup.put((Integer) table.getValueAt(i * rowsPerColor + j,
numberColumn), colors[i]);
}
}
table.resetSortOrder();
// PENDING JW: add and use HighlightPredicate.SELECTED/UN_SELECTED
Highlighter hl = new ColorHighlighter() {
@Override
protected void applyBackground(Component renderer, ComponentAdapter adapter) {
if (adapter.isSelected()) return;
Color background = lookup.get(adapter.getValue(numberColumn));
if (background != null) {
renderer.setBackground(background);
}
}
};
table.addHighlighter(hl);
showWithScrollingInFrame(table,
"conditional highlighter with value-based color mapping");
}
示例5: updateRowHeight
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Sets per-row rowHeight based on the rendering component's preferred height.
*
* @param table
*/
private void updateRowHeight(final JXTable table) {
for (int row = 0; row < table.getRowCount(); row++) {
int rowHeight = 0;
for (int column = 0; column < table.getColumnCount(); column++) {
Component comp = table.prepareRenderer(table
.getCellRenderer(row, column), row, column);
rowHeight = Math.max(rowHeight,
comp.getPreferredSize().height);
}
table.setRowHeight(row, rowHeight);
}
}
示例6: testTableNotFoundLastRowWithoutWrapping
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* test if not-wrapping returns not found marker (-1) if the
* last found position is the last row.
*
*/
@Test
public void testTableNotFoundLastRowWithoutWrapping() {
JXTable table = new JXTable(new TestTableModel());
int row = table.getRowCount() - 1;
String searchText = table.getValueAt(row, 0).toString();
int foundIndex = table.getSearchable().search(searchText);
assertEquals("last line found", row, foundIndex);
int notFoundIndex = table.getSearchable().search(searchText, foundIndex);
assertEquals("nothing found after last line", -1, notFoundIndex);
}
示例7: testPatternPredicateAllColumns
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Issue #1317-swingx: PatternPredicate causes exception with testColumn -1 (ALL)
*
*/
@Test
public void testPatternPredicateAllColumns() {
JXTable table = new JXTable(new AncientSwingTeam());
PatternPredicate predicate = new PatternPredicate(".*e.*");
table.addHighlighter(new ColorHighlighter(predicate, Color.BLUE, null));
for (int i = 0; i < table.getRowCount(); i++) {
for (int j = 0; j < table.getColumnCount(); j++) {
TableCellRenderer renderer = table.getCellRenderer(i, j);
table.prepareRenderer(renderer, i, j);
}
}
}
示例8: getRowCount
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Returns the number of table view rows accessible during row-related
* config. All row-related access is bounded by the value returned from this
* method.
*
* Here: delegates to table.getRowCount().
* <p>
*
* Subclasses can override to reduce the number (for performance) or support
* restrictions due to lazy loading, f.i. Implementors must guarantee that
* view row access with <code>0 <= row < getRowCount(JXTable)</code>
* succeeds.
*
* @param table the table to access
* @return valid rowCount
*/
protected int getRowCount(JXTable table) {
return table.getRowCount();
}