站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

HtmlRenderer.Renderer (NetBeans UI Utilities API) - NetBeans API Javadoc 5.0.0

 

org.openide.awt
Interface HtmlRenderer.Renderer

All Superinterfaces:
ListCellRenderer, TableCellRenderer, TreeCellRenderer
Enclosing interface:
HtmlRenderer

public static interface HtmlRenderer.Renderer
extends TableCellRenderer, TreeCellRenderer, ListCellRenderer

Interface aggregating table, tree, and list cell renderers.

See Also:
HtmlRenderer.createRenderer(), HtmlRenderer.createLabel()

Method Summary
 void reset()
          Clear any stale data from previous use by other components, clearing the icon, text, disabled state and other customizations, returning the component to its initialized state.
 void setCentered(boolean centered)
          Indicate that the text should be painted centered below the icon.
 void setHtml(boolean val)
          Explicitly tell the renderer it is going to receive HTML markup, or it is not.
 void setIcon(Icon icon)
          Set the icon to be used for painting
 void setIconTextGap(int gap)
          Convenience method to set the gap between the icon and text.
 void setIndent(int pixels)
          Set a number of pixels the icon and text should be indented.
 void setParentFocused(boolean parentFocused)
          Indicate that the component being rendered has keyboard focus.
 void setRenderStyle(int style)
          Set the rendering style - this can be JLabel-style truncated-with-elipsis (...) text, or clipped text.
 void setText(String txt)
          Set the text to be displayed.
 
Methods inherited from interface javax.swing.table.TableCellRenderer
getTableCellRendererComponent
 
Methods inherited from interface javax.swing.tree.TreeCellRenderer
getTreeCellRendererComponent
 
Methods inherited from interface javax.swing.ListCellRenderer
getListCellRendererComponent
 

Method Detail

setParentFocused

public void setParentFocused(boolean parentFocused)
Indicate that the component being rendered has keyboard focus. NetBeans requires that a different selection color be used depending on whether the view has focus.

Parameters:
parentFocused - Whether or not the focused selection color should be used

setCentered

public void setCentered(boolean centered)
Indicate that the text should be painted centered below the icon. This is primarily used by org.openide.explorer.view.IconView

Parameters:
centered - Whether or not centered painting should be used.

setIndent

public void setIndent(int pixels)
Set a number of pixels the icon and text should be indented. Used by ChoiceView and ListView to fake tree-style nesting. This value has no effect if setCentered(true) has been called.

Parameters:
pixels - The number of pixels to indent

setHtml

public void setHtml(boolean val)
Explicitly tell the renderer it is going to receive HTML markup, or it is not. If the renderer should check the string for opening HTML tags to determine this, don't call this method. If you know the string will be compliant HTML, it is preferable to call this method with true; if you want to intentionally render HTML markup literally, call this method with false.

Parameters:
val -

setRenderStyle

public void setRenderStyle(int style)
Set the rendering style - this can be JLabel-style truncated-with-elipsis (...) text, or clipped text. The default is HtmlRenderer.STYLE_CLIP.

Parameters:
style - The text style

setIcon

public void setIcon(Icon icon)
Set the icon to be used for painting

Parameters:
icon - An icon or null

reset

public void reset()
Clear any stale data from previous use by other components, clearing the icon, text, disabled state and other customizations, returning the component to its initialized state. This is done automatically when get*CellRenderer() is called, and to the shared instance when HtmlRenderer.createLabel() is called.

Users of the static HtmlRenderer.createLabel() method may want to call this method if they use the returned instance more than once without again calling HtmlRenderer.createLabel().


setText

public void setText(String txt)
Set the text to be displayed. Use this if the object being rendered's toString() does not return a real user-displayable string, after calling get**CellRenderer(). Typically after calling this one calls setHtml(boolean) if the text is known to either be or not be HTML markup.

Parameters:
txt - The text that should be displayed

setIconTextGap

public void setIconTextGap(int gap)
Convenience method to set the gap between the icon and text.

Parameters:
gap - an integer number of pixels

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.