Example usage for java.awt Rectangle translate

List of usage examples for java.awt Rectangle translate

Introduction

In this page you can find the example usage for java.awt Rectangle translate.

Prototype

public void translate(int dx, int dy) 

Source Link

Document

Translates this Rectangle the indicated distance, to the right along the X coordinate axis, and downward along the Y coordinate axis.

Usage

From source file:net.sf.vfsjfilechooser.filepane.VFSFilePane.java

private void ensureIndexIsVisible(int i) {
    if (i >= 0) {
        if (list != null) {
            Rectangle cellBounds = list.getCellBounds(i, i);

            if (cellBounds == null) {
                cellBounds = list.getCellBounds(i - 1, i - 1);

                if (cellBounds != null) {
                    //  2* so that you get bottom of cell
                    cellBounds.translate(0, 2 * cellBounds.height);
                    list.scrollRectToVisible(cellBounds);
                }//from  w w w  .  j  a  va  2s . com
            } else {
                list.ensureIndexIsVisible(i);
            }
        }

        if (detailsTable != null) {
            Rectangle r = detailsTable.getCellRect(i, COLUMN_FILENAME, true);
            detailsTable.scrollRectToVisible(r);
        }
    }
}

From source file:com.googlecode.vfsjfilechooser2.filepane.VFSFilePane.java

private void ensureIndexIsVisible(int i) {
    if (i >= 0) {
        if ((list != null) && (list.getModel().getSize() > i)) {
            Rectangle cellBounds = list.getCellBounds(i, i);

            if (cellBounds == null) {
                cellBounds = list.getCellBounds(i - 1, i - 1);

                if (cellBounds != null) {
                    //  2* so that you get bottom of cell
                    cellBounds.translate(0, 2 * cellBounds.height);
                    list.scrollRectToVisible(cellBounds);
                }/* w  ww .j  a v a2  s . c  om*/
            } else {
                list.ensureIndexIsVisible(i);
            }
        }

        if (detailsTable != null) {
            Rectangle r = detailsTable.getCellRect(i, COLUMN_FILENAME, true);
            detailsTable.scrollRectToVisible(r);
        }
    }
}

From source file:corelyzer.ui.CorelyzerApp.java

public Component getPopupParent(CorelyzerGLCanvas srcCanvas) {
    if (srcCanvas == null) {
        return getMainFrame();
    }//from   ww w .j  av  a  2s . c om
    Rectangle mfBounds = getMainFrame().getBounds();
    Rectangle canvasBounds = srcCanvas.getCanvas().getParent().getBounds();
    Point canvasLoc = srcCanvas.getCanvas().getParent().getLocationOnScreen();
    canvasBounds.translate(canvasLoc.x, canvasLoc.y);
    if (mfBounds.intersects(canvasBounds)) {
        return getMainFrame();
    } else {
        return srcCanvas.getCanvas();
    }
}

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);
    int visibleRows = usersTable.rowAtPoint(vr.getLocation()) - first;
    if (i < visibleRows) {
        return false;
    } else {/*from   w w w .  ja v a 2 s . co  m*/
        return true;
    }
}