jPlColHeader = new JPanel() { java.awt.Rectangle r; public void paint(Graphics g) { r = g.getClipBounds(); g.clearRect(r.x, r.y, r.width, r.height); g.setFont( f ); fm = g.getFontMetrics(); int xpos = 0, ypos = 0, attribWidth=0;  g.setColor(fontColor); xpos = extpad; ypos=extpad+fm.getHeight();  for(int i=0; i<m_selectedAttribs.length; i++) { if( xpos+cellSize < r.x) { xpos += cellSize+extpad; continue; } else if(xpos > r.x+r.width) { break; } else { attribWidth = fm.stringWidth(m_data.attribute(m_selectedAttribs[i]).name()); g.drawString(m_data.attribute(m_selectedAttribs[i]).name(), (attribWidth<cellSize) ? (xpos + (cellSize/2 - attribWidth/2)):xpos, ypos); } xpos += cellSize+extpad; } fm = null; r=null; }  public Dimension getPreferredSize() { fm = this.getFontMetrics(this.getFont()); return new Dimension( m_selectedAttribs.length*(cellSize+extpad), 2*extpad + fm.getHeight() ); } };  jPlRowHeader = new JPanel() { java.awt.Rectangle r; public void paint(Graphics g) { r = g.getClipBounds(); g.clearRect(r.x, r.y, r.width, r.height); g.setFont( f ); fm = g.getFontMetrics(); int xpos = 0, ypos = 0, attribWidth=0;  g.setColor(fontColor); xpos = extpad; ypos=extpad;  for(int j=m_selectedAttribs.length-1; j>=0; j--) { if( ypos+cellSize < r.y ) { ypos += cellSize+extpad;  continue; } else if( ypos > r.y+r.height ) break; else { g.drawString(m_data.attribute(m_selectedAttribs[j]).name(), xpos+extpad, ypos+cellSize/2); } xpos = extpad; ypos += cellSize+extpad; } r=null; }  public Dimension getPreferredSize() { return new Dimension( 100+extpad, m_selectedAttribs.length*(cellSize+extpad) ); } }; jPlColHeader.setFont(f); jPlRowHeader.setFont(f); this.setFont(f);
    public void initialize() {      lastxpos = lastypos = 0;	        cellRange = cellSize; cellSize = cellRange + 2*intpad;    }      