/** * <p>Title: T2Ti ERP</p> * <p>Description: Classe que será utilizada para personalizar o visual * da tabela.</p> * * <p>The MIT License</p> * * <p>Copyright: Copyright (C) 2010 T2Ti.COM</p> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * The author may be contacted at: * t2ti.com@gmail.com</p> * * @author Albert Eije (T2Ti.COM) * @version 1.0 */ package com.t2tierp.pafecf.infra; import java.awt.Color; import java.awt.Component; import javax.swing.JLabel; import javax.swing.table.DefaultTableCellRenderer; public class PreVendaCabecalhoCellRenderer extends DefaultTableCellRenderer { /** Cria uma nova renderização da tabela. */ public PreVendaCabecalhoCellRenderer() { super(); } /** Retorna a personalização da tabela para que possa ser mostrada ao usuário. */ public Component getTableCellRendererComponent(javax.swing.JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel label = (JLabel) super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column); Color corFundoZebrado = new Color(240, 240, 240); Color corFundoNormal = new Color(255, 255, 230); label.setFont(new java.awt.Font("Tahoma", 0, 12)); if ((row % 2) == 0) { label.setBackground(corFundoNormal); } else { label.setBackground(corFundoZebrado); } if (isSelected) { label.setBackground(Color.BLACK); } if (column == 0) { label.setHorizontalAlignment(CENTER); } else if (column == 1) { label.setHorizontalAlignment(RIGHT); } else if (column == 2) { label.setHorizontalAlignment(LEFT); } else if (column == 3) { label.setHorizontalAlignment(RIGHT); } return label; } }