All Packages Class Hierarchy This Package Previous Next Index
Class jumbo.xml.XTreeCellRenderer
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----com.sun.java.swing.JComponent
|
+----com.sun.java.swing.JLabel
|
+----jumbo.xml.XTreeCellRenderer
- public class XTreeCellRenderer
- extends JLabel
- implements TreeCellRenderer
derived from SwingSet examples to allow customisation of the
node display in the trees. Used to work nicely but has stopped. I will
comment this more when it works - at present the comments are
primarily from the SwingSet docs.
There is a bug of some sort here and JLabel.setIcon() seems to give
problems whereby the icon is not properly rendered. Therefore some of this
code represents experiements
- Author:
- P.Murray-Rust, 1998
-
blueBall
-
-
defaultFont
-
-
jButton
-
-
jLabel
- kludge; jLabel can be set to 'this' when XTreeCellRenderer is
subclassed from JLable; else to jLable add'ed to JPanel
-
selected
- Whether or not the item that was last configured is selected.
-
selectedBackgroundColor
-
-
XTreeCellRenderer()
-
-
getHeight()
-
-
getTreeCellRendererComponent(JTree, Object, boolean, boolean, boolean, int, boolean)
- This is messaged from JTree whenever it needs to get the size
of the component or it wants to draw it.
-
getWidth()
-
-
paint(Graphics)
- paint is subclassed to draw the background correctly.
-
paintLabel(Graphics)
-
defaultFont
protected static Font defaultFont
blueBall
protected static ImageIcon blueBall
selectedBackgroundColor
protected static final Color selectedBackgroundColor
selected
protected boolean selected
- Whether or not the item that was last configured is selected.
jLabel
protected JLabel jLabel
- kludge; jLabel can be set to 'this' when XTreeCellRenderer is
subclassed from JLable; else to jLable add'ed to JPanel
jButton
protected JButton jButton
XTreeCellRenderer
public XTreeCellRenderer()
getTreeCellRendererComponent
public Component getTreeCellRendererComponent(JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
- This is messaged from JTree whenever it needs to get the size
of the component or it wants to draw it.
This attempts to set the font based on value, which will be
a TreeNode.
paint
public void paint(Graphics g)
- paint is subclassed to draw the background correctly. JLabel
currently does not allow backgrounds other than white, and it
will also fill behind the icon. Something that isn't desirable.
- Overrides:
- paint in class JComponent
paintLabel
public void paintLabel(Graphics g)
getWidth
public int getWidth()
- Overrides:
- getWidth in class JComponent
getHeight
public int getHeight()
- Overrides:
- getHeight in class JComponent
All Packages Class Hierarchy This Package Previous Next Index