|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
javax.swing.DefaultListCellRenderer
org.fife.ui.autocomplete.CompletionCellRenderer
public class CompletionCellRenderer
A cell renderer that adds some pizazz when rendering the standard
Completion types, like Eclipse and NetBeans do. Specifically,
this renderer handles:
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.DefaultListCellRenderer |
|---|
DefaultListCellRenderer.UIResource |
| Nested classes/interfaces inherited from class javax.swing.JLabel |
|---|
JLabel.AccessibleJLabel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary |
|---|
| Fields inherited from class javax.swing.DefaultListCellRenderer |
|---|
noFocusBorder |
| Fields inherited from class javax.swing.JLabel |
|---|
labelFor |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
CompletionCellRenderer()
Constructor. |
|
| Method Summary | |
|---|---|
static Color |
getAlternateBackground()
Returns the background color to use on alternating lines. |
Font |
getDisplayFont()
Returns the font used when rendering completions. |
Component |
getListCellRendererComponent(JList list,
Object value,
int index,
boolean selected,
boolean hasFocus)
Returns the renderer. |
boolean |
getShowTypes()
Returns whether the types of fields and return types of methods are shown in the completion text. |
protected void |
paintComponent(Graphics g)
|
protected void |
prepareForFunctionCompletion(JList list,
FunctionCompletion fc,
int index,
boolean selected,
boolean hasFocus)
Prepares this renderer to display a function completion. |
protected void |
prepareForMarkupTagCompletion(JList list,
MarkupTagCompletion mc,
int index,
boolean selected,
boolean hasFocus)
Prepares this renderer to display a markup tag completion. |
protected void |
prepareForOtherCompletion(JList list,
Completion c,
int index,
boolean selected,
boolean hasFocus)
Prepares this renderer to display a completion not specifically handled elsewhere. |
protected void |
prepareForVariableCompletion(JList list,
VariableCompletion vc,
int index,
boolean selected,
boolean hasFocus)
Prepares this renderer to display a variable completion. |
static void |
setAlternateBackground(Color altBG)
Sets the background color to use on alternating lines. |
void |
setDisplayFont(Font font)
Sets the font to use when rendering completion items. |
void |
setShowTypes(boolean show)
Sets whether the types of fields and return types of methods are shown in the completion text. |
| Methods inherited from class javax.swing.DefaultListCellRenderer |
|---|
firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, invalidate, isOpaque, repaint, repaint, repaint, revalidate, validate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public CompletionCellRenderer()
| Method Detail |
|---|
public static Color getAlternateBackground()
null,
alternating colors are not used.setAlternateBackground(Color)public Font getDisplayFont()
null, then the default list
font is used.setDisplayFont(Font)
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean selected,
boolean hasFocus)
getListCellRendererComponent in interface ListCellRenderergetListCellRendererComponent in class DefaultListCellRendererlist - The list of choices being rendered.value - The Completion being rendered.index - The index into list being rendered.selected - Whether the item is selected.hasFocus - Whether the item has focus.public boolean getShowTypes()
setShowTypes(boolean)protected void paintComponent(Graphics g)
paintComponent in class JComponent
protected void prepareForFunctionCompletion(JList list,
FunctionCompletion fc,
int index,
boolean selected,
boolean hasFocus)
list - The list of choices being rendered.fc - The completion to render.index - The index into list being rendered.selected - Whether the item is selected.hasFocus - Whether the item has focus.
protected void prepareForMarkupTagCompletion(JList list,
MarkupTagCompletion mc,
int index,
boolean selected,
boolean hasFocus)
list - The list of choices being rendered.mc - The completion to render.index - The index into list being rendered.selected - Whether the item is selected.hasFocus - Whether the item has focus.
protected void prepareForOtherCompletion(JList list,
Completion c,
int index,
boolean selected,
boolean hasFocus)
list - The list of choices being rendered.c - The completion to render.index - The index into list being rendered.selected - Whether the item is selected.hasFocus - Whether the item has focus.
protected void prepareForVariableCompletion(JList list,
VariableCompletion vc,
int index,
boolean selected,
boolean hasFocus)
list - The list of choices being rendered.vc - The completion to render.index - The index into list being rendered.selected - Whether the item is selected.hasFocus - Whether the item has focus.public static void setAlternateBackground(Color altBG)
altBG - The new alternate background color. If this is
null, alternating lines will not use different
background colors.getAlternateBackground()public void setDisplayFont(Font font)
font - The font to use. If this is null, then
the default list font is used.getDisplayFont()public void setShowTypes(boolean show)
show - Whether to show the types.getShowTypes()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||