Example usage for javax.swing JTable getVisibleRect

List of usage examples for javax.swing JTable getVisibleRect

Introduction

In this page you can find the example usage for javax.swing JTable getVisibleRect.

Prototype

@BeanProperty(bound = false)
public Rectangle getVisibleRect() 

Source Link

Document

Returns the Component's "visible rectangle" - the intersection of this component's visible rectangle, new Rectangle(0, 0, getWidth(), getHeight()), and all of its ancestors' visible rectangles.

Usage

From source file:com.SCI.centraltoko.utility.UtilityTools.java

public static void scroolTorect(JTable tabel, int nextRow) {
    Rectangle currenVisible = tabel.getVisibleRect();
    Rectangle scroolTorect = tabel.getCellRect(nextRow, 0, true);
    if (scroolTorect.getY() > currenVisible.getY() + currenVisible.getHeight()) {
        scroolTorect.setLocation(0,//from  w w  w.j a va 2  s .  co m
                (int) (scroolTorect.getY() + currenVisible.getHeight() - scroolTorect.getHeight()));
    }
    tabel.scrollRectToVisible(scroolTorect);
}

From source file:de.mendelson.comm.as2.client.AS2Gui.java

/**
 * Scrolls to an entry of the passed table
 *
 * @param table Table to to scroll in// w w w.j  ava2  s .co  m
 * @param row Row to ensure visibility
 */
private void makeRowVisible(JTable table, int row) {
    if (table.getColumnCount() == 0) {
        return;
    }
    if (row < 0 || row >= table.getRowCount()) {
        throw new IllegalArgumentException("Requested ensure visible of row " + String.valueOf(row)
                + ", table has only " + table.getRowCount() + " rows.");
    }
    Rectangle visible = table.getVisibleRect();
    Rectangle cell = table.getCellRect(row, 0, true);
    if (cell.y < visible.y) {
        visible.y = cell.y;
        table.scrollRectToVisible(visible);
    } else if (cell.y + cell.height > visible.y + visible.height) {
        visible.y = cell.y + cell.height - visible.height;
        table.scrollRectToVisible(visible);
    }
}

From source file:com.osparking.attendant.AttListForm.java

private boolean rowHidden(JTable usersTable, int i) {
    Rectangle vr = usersTable.getVisibleRect();
    int first = usersTable.rowAtPoint(vr.getLocation());
    vr.translate(0, vr.height);/*ww w  . ja v a2 s.  co m*/
    int visibleRows = usersTable.rowAtPoint(vr.getLocation()) - first;
    if (i < visibleRows) {
        return false;
    } else {
        return true;
    }
}

From source file:org.apache.jmeter.config.gui.ArgumentsPanel.java

/**
 * @param table {@link JTable}/* w  ww .j ava2 s. co m*/
 * @return number of visible rows
 */
private static int getNumberOfVisibleRows(JTable table) {
    Rectangle vr = table.getVisibleRect();
    int first = table.rowAtPoint(vr.getLocation());
    vr.translate(0, vr.height);
    return table.rowAtPoint(vr.getLocation()) - first;
}