public class

DefaultTableCellHeaderRenderer

extends DefaultTableCellRenderer
implements UIResource
java.lang.Object
   ↳ java.awt.Component
     ↳ java.awt.Container
       ↳ javax.swing.JComponent
         ↳ javax.swing.JLabel
           ↳ javax.swing.table.DefaultTableCellRenderer
             ↳ sun.swing.table.DefaultTableCellHeaderRenderer

Summary

[Expand]
Inherited Constants
From class javax.swing.JComponent
From class java.awt.Component
From interface java.awt.image.ImageObserver
From interface javax.swing.SwingConstants
[Expand]
Inherited Fields
From class javax.swing.table.DefaultTableCellRenderer
From class javax.swing.JLabel
From class javax.swing.JComponent
Public Constructors
DefaultTableCellHeaderRenderer()
Public Methods
static SortOrder getColumnSortOrder(JTable table, int column)
Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
Returns the default table cell renderer.
void paintComponent(Graphics g)
Calls the UI delegate's paint method, if the UI delegate is non-null.
void setHorizontalTextPosition(int textPosition)
Sets the horizontal position of the label's text, relative to its image.
[Expand]
Inherited Methods
From class javax.swing.table.DefaultTableCellRenderer
From class javax.swing.JLabel
From class javax.swing.JComponent
From class java.awt.Container
From class java.awt.Component
From class java.lang.Object
From interface java.awt.MenuContainer
From interface java.awt.image.ImageObserver
From interface javax.accessibility.Accessible
From interface javax.swing.table.TableCellRenderer

Public Constructors

public DefaultTableCellHeaderRenderer ()

Public Methods

public static SortOrder getColumnSortOrder (JTable table, int column)

public Component getTableCellRendererComponent (JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)

Returns the default table cell renderer.

During a printing operation, this method will be called with isSelected and hasFocus values of false to prevent selection and focus from appearing in the printed output. To do other customization based on whether or not the table is being printed, check the return value from isPaintingForPrint().

Parameters
table the JTable
value the value to assign to the cell at [row, column]
isSelected true if cell is selected
hasFocus true if cell has focus
row the row of the cell to render
column the column of the cell to render
Returns
  • the default table cell renderer

public void paintComponent (Graphics g)

Calls the UI delegate's paint method, if the UI delegate is non-null. We pass the delegate a copy of the Graphics object to protect the rest of the paint code from irrevocable changes (for example, Graphics.translate).

If you override this in a subclass you should not make permanent changes to the passed in Graphics. For example, you should not alter the clip Rectangle or modify the transform. If you need to do these operations you may find it easier to create a new Graphics from the passed in Graphics and manipulate it. Further, if you do not invoker super's implementation you must honor the opaque property, that is if this component is opaque, you must completely fill in the background in a non-opaque color. If you do not honor the opaque property you will likely see visual artifacts.

The passed in Graphics object might have a transform other than the identify transform installed on it. In this case, you might get unexpected results if you cumulatively apply another transform.

Parameters
g the Graphics object to protect

public void setHorizontalTextPosition (int textPosition)

Sets the horizontal position of the label's text, relative to its image.

Parameters
textPosition One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT, LEADING, or TRAILING (the default).