Change Color of Drop Location Indicator in Explorer.
"r4dium" <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I want to change the color (in the explorer) of the horizontal drop-indicator-line and the color of the node when dragging an item over it (drop target).
I tried the follwoing approaches:
1. Implemented a CustomTreeCellRenderer extending NodeRenderer.
Then overwriting "getTreeCellRendererComponent()".Attach
CustomTreeCellRenderer to
the jTree constituting my Explorer's BeanTreeView. I managed to
chagnge the color of the selected node, but not of the dragged-over
node. I am not able to distinguish which rendering-event refers to
a drag-event by this code in getTreeCellRendererComponent():
JTree.DropLocation dropLocation = tree.getDropLocation();
if (dropLocation != null)
{
if ( dropLocation.getChildIndex() == -1 && tree.getRowForPath(dropLocation.getPath()) == row)
{
label.setBackground(_DARK_CYAN);
label.setForeground(Color.BLACK);
label.setOpaque(true);
}
}
2. By attaching a listner to the jTree constituting my Explorer's
BeanTreeView: no drag and drop events were raised.
btv.getTree().addPropertyChangeListener("dropLocation", new Repainter(cbtv.getTree()));
3. By adding an PropertyChangeListener to my ExplorerManager:
No drag and drop events were raised!
_explorermanager.addPropertyChangeListener( new PropertyChangeListener()
{
@Override
public void propertyChange(PropertyChangeEvent evt)
{
String d = evt.getPropertyName();
System.out.println("property:" + d);
}
});
4. By trying to change the dropline-variable in UIManager.
UIManager.put("Tree.dropLine", new Color(0,0xAA,0xAA)); // no effect!
How can I change the color of the horizontal-drop-line-indicator and
of the "dragged-over" node?
Help appreciated.
Regards
R4DIUM