Java JTable Row Height platformTableRowHeight(JTable jtab, boolean forEdit)

Here you can find the source of platformTableRowHeight(JTable jtab, boolean forEdit)

Description

Use to set table rows (platform-dependent)

License

Open Source License

Declaration


public static void platformTableRowHeight(JTable jtab, boolean forEdit) 

Method Source Code

//package com.java2s;
/*//from w ww.j  a  v  a2 s. com
**    Copyright (C) 2003-2012 Institute for Systems Biology 
**                            Seattle, Washington, USA. 
**
**    This library is free software; you can redistribute it and/or
**    modify it under the terms of the GNU Lesser General Public
**    License as published by the Free Software Foundation; either
**    version 2.1 of the License, or (at your option) any later version.
**
**    This library 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
**    Lesser General Public License for more details.
**
**    You should have received a copy of the GNU Lesser General Public
**    License along with this library; if not, write to the Free Software
**    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

import java.util.Vector;
import javax.swing.JComboBox;

import javax.swing.JTable;

public class Main {
    private static int macHeight_;

    /***************************************************************************
    **
    ** Use to set table rows (platform-dependent)
    */

    public static void platformTableRowHeight(JTable jtab, boolean forEdit) {
        boolean isAMac = System.getProperty("os.name").toLowerCase().startsWith("mac os x");
        if (isAMac) {
            if (forEdit) {
                if (macHeight_ == 0) {
                    Vector condTypes = new Vector();
                    condTypes.add("XXXjjggTT");
                    JComboBox testIt = new JComboBox(condTypes);
                    macHeight_ = testIt.getPreferredSize().height;
                }
                jtab.setRowHeight(macHeight_);
            }
            return;
        }
        jtab.setRowHeight(22);
        return;
    }
}

Related

  1. correctRowHeight(JTable table)
  2. getPreferredRowHeight(JTable table, int rowIndex, int margin)
  3. getRowBounds(JTable table, int row, int height)
  4. packRowHeights(final JTable table)
  5. setRowHeight(JTable table, int row)
  6. updateRowHeights(JTable table)