/* * Geotoolkit - An Open Source Java GIS Toolkit * http://www.geotoolkit.org * * (C) 2012, Geomatys * * 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; * version 2.1 of the License. * * 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. */ package org.geotoolkit.gui.swing.util; import java.awt.Component; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.table.DefaultTableCellRenderer; /** * Cell renderer displaying nothing. * Can be used to fill space in table to avoid displaying the default toString text. * * @author Johann Sorel (Geomatys) * @module */ public class EmptyCellRenderer extends DefaultTableCellRenderer{ @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final JLabel lbl = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); lbl.setText(""); return lbl; } public static void mimicStyle(final JComponent model, final JComponent candidate) { candidate.setBackground(model.getBackground()); candidate.setForeground(model.getForeground()); candidate.setOpaque(model.isOpaque()); candidate.setBorder(model.getBorder()); candidate.setFont(model.getFont()); } }