Source Code : Determining If a Cell Is Visible in a JTable Component
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Determining If a Cell Is Visible in a JTable Component
import java.awt.Point;
import java.awt.Rectangle;
import javax.swing.JTable;
import javax.swing.JViewport;
public class Main {
public static void main(String[] argv) {
JTable table = new JTable(10, 5);
int rowIndex = 1;
int vColIndex = 2;
isCellVisible(table, rowIndex, vColIndex);
}
public static boolean isCellVisible(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return false;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Point pt = viewport.getViewPosition();
rect.setLocation(rect.x - pt.x, rect.y - pt.y);
return new Rectangle(viewport.getExtentSize()).contains(rect);
}
}
Thank with us