Java JTable Header isRowHeaderVisible(JTable table)

Here you can find the source of isRowHeaderVisible(JTable table)

Description

is Row Header Visible

License

Open Source License

Declaration

public static boolean isRowHeaderVisible(JTable table) 

Method Source Code

//package com.java2s;
/*************************************************************************
 * Copyright 2012 Regents of the University of Michigan 
 * /* w w w  .jav  a2 s .  c o  m*/
 * NCIBI - The National Center for Integrative Biomedical Informatics (NCIBI)
 *         http://www.ncib.org.
 * 
 * This product may includes software developed by others; in that case see specific notes in the code. 
 * 
 * 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 3 of the License, or (at your option) any later version, along with the following terms:
 * 1.   You may convey a work based on this program in accordance with section 5, 
 *      provided that you retain the above notices.
 * 2.   You may convey verbatim copies of this program code as you receive it, 
 *      in any medium, provided that you retain the above notices.
 * 
 * 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, http://www.gnu.org/licenses/.
 * 
 * This work was supported in part by National Institutes of Health Grant #U54DA021519
 *
 ******************************************************************/

import java.awt.Container;

import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JViewport;

public class Main {
    public static boolean isRowHeaderVisible(JTable table) {
        Container p = table.getParent();
        if (p instanceof JViewport) {
            Container gp = p.getParent();
            if (gp instanceof JScrollPane) {
                JScrollPane scrollPane = (JScrollPane) gp;
                JViewport rowHeaderViewPort = scrollPane.getRowHeader();
                if (rowHeaderViewPort != null)
                    return rowHeaderViewPort.getView() != null;
            }
        }
        return false;
    }
}

Related

  1. getSelectedColumn(JTableHeader tableHeader)
  2. getTableHeaderBackground()
  3. getTableHeaderColor()
  4. headerString(JTable t)
  5. isColumnSelected(JTableHeader tableHeader, int columnModelIndex)
  6. layoutHeaders(JTable p_Table)
  7. makeHeaderFillEmptySpace(JTable table)
  8. makeTableHeadersCentered(final JTable table, final boolean dataColsAlso)
  9. modifyTableHeader(JTableHeader head, Vector columnNames)