Here you can find the source of getRowIndex(Element cell)
Parameter | Description |
---|---|
cell | the cell element to get the row index for |
public static int getRowIndex(Element cell)
//package com.java2s; /*//ww w . ja v a 2 s . co m * This file is part of the Scriba source distribution. This is free, open-source * software. For full licensing information, please see the LicensingInformation file * at the root level of the distribution. * * Copyright (c) 2006-2007 Kobrix Software, Inc. */ import javax.swing.text.Element; public class Main { /** * get the row index for a given table cell * * @param cell the cell element to get the row index for * * @return the row index of the given cell element */ public static int getRowIndex(Element cell) { Element thisRow = cell.getParentElement(); Element table = thisRow.getParentElement(); int index = 0; int count = table.getElementCount(); Element elem = table.getElement(index); while (!elem.equals(thisRow) && index < count) { elem = table.getElement(++index); } return index; } }