Here you can find the source of getRowIndex(final Element cell)
Parameter | Description |
---|---|
cell | the cell element to get the row index for |
public static int getRowIndex(final Element cell)
//package com.java2s; /*/* www .j av a 2s .c o m*/ * SimplyHTML, a word processor based on Java, HTML and CSS * Copyright (C) 2002 Ulrich Hilger * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 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(final Element cell) { final Element thisRow = cell.getParentElement(); final Element table = thisRow.getParentElement(); int index = 0; final int count = table.getElementCount(); Element elem = table.getElement(index); while (!elem.equals(thisRow) && index < count) { elem = table.getElement(++index); } return index; } }