All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fathzer.soft.ajlib.swing.table.RowHeaderRenderer Maven / Gradle / Ivy

Go to download

AJlib is a simple java library with Swing widgets, utilities and other stuff

There is a newer version: 0.3.16
Show newest version
package com.fathzer.soft.ajlib.swing.table;

import java.awt.Component;

import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
import javax.swing.JTable;

/**
 * A table CellRenderer that renders row headers.
 * @author Jean-Marc Astesana 
* License: LGPL v3 */ public class RowHeaderRenderer implements TableCellRenderer { private TableCellRenderer renderer; public RowHeaderRenderer() { renderer = new JTable().getTableHeader().getDefaultRenderer(); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) { try { return renderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col); } catch (NullPointerException e) { // Bug workaround: Under some unclear circumstances (Launch Application, Menu File/New, then choose Windows look and feel, then Windows Classic, // then Nimbus, then, open a non empty file ... a NullPointerException occurred :-( return new DefaultTableCellRenderer().getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy