Index: NodeRenderer.java =================================================================== RCS file: /cvs/openide/src/org/openide/explorer/view/NodeRenderer.java,v retrieving revision 1.24 diff -c -r1.24 NodeRenderer.java *** NodeRenderer.java 25 Aug 2003 21:33:39 -0000 1.24 --- NodeRenderer.java 17 Oct 2003 13:07:43 -0000 *************** *** 16,22 **** --- 16,24 ---- import java.awt.Color; import java.awt.Component; + import java.awt.Container; import java.awt.Image; + import java.awt.KeyboardFocusManager; import javax.swing.BorderFactory; import javax.swing.ImageIcon; *************** *** 263,272 **** this.hasFocus = hasFocus; selected = sel; ! if(sel) { setForeground(getTextSelectionColor()); } else { setForeground(getTextNonSelectionColor()); } return this; --- 265,292 ---- this.hasFocus = hasFocus; selected = sel; ! ! if (sel) { ! //Find out who has focus ! Component focusOwner = ! KeyboardFocusManager.getCurrentKeyboardFocusManager(). ! getFocusOwner(); ! ! //see if it's in the hierarchy ! boolean treeHasFocus = hasFocus || tree.isAncestorOf(focusOwner); ! ! //A hack to make treeTableView work correctly ! if (!treeHasFocus && focusOwner instanceof TreeTable) { ! treeHasFocus = ((Container) focusOwner).isAncestorOf(tree); ! } ! ! setBackgroundSelectionColor(treeHasFocus ? ! UIManager.getColor("Tree.selectionBackground") : ! getNoFocusSelectionColor()); //NOI18N setForeground(getTextSelectionColor()); } else { setForeground(getTextNonSelectionColor()); + setBackground(tree.getBackground()); } return this; *************** *** 312,320 **** ImageIcon nodeicon = NodeRenderer.getIcon(vis.node.getIcon(BeanInfo.ICON_COLOR_16x16)); setIcon(nodeicon); setText(vis.getDisplayName ()); - if (isSelected) { ! setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); --- 332,348 ---- ImageIcon nodeicon = NodeRenderer.getIcon(vis.node.getIcon(BeanInfo.ICON_COLOR_16x16)); setIcon(nodeicon); setText(vis.getDisplayName ()); if (isSelected) { ! Component focusOwner = ! KeyboardFocusManager.getCurrentKeyboardFocusManager(). ! getFocusOwner(); ! ! boolean hasFocus = cellHasFocus || ! list.isAncestorOf(focusOwner); ! ! setBackground(hasFocus ? list.getSelectionBackground() : ! getNoFocusSelectionColor()); ! setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); *************** *** 379,387 **** setIcon(NodeRenderer.getIcon(vis.node.getIcon(BeanInfo.ICON_COLOR_32x32))); setText(vis.getDisplayName ()); if (isSelected){ ! setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { --- 407,420 ---- setIcon(NodeRenderer.getIcon(vis.node.getIcon(BeanInfo.ICON_COLOR_32x32))); setText(vis.getDisplayName ()); + Component focusOwner = + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); + + boolean hasFocus = cellHasFocus || list.isAncestorOf(focusOwner); if (isSelected){ ! setBackground(hasFocus ? list.getSelectionBackground() ! : getNoFocusSelectionColor()); setForeground(list.getSelectionForeground()); } else { *************** *** 400,403 **** --- 433,457 ---- } // End of class Pane. + private static Color noFocusSelectionColor=null; + static Color getNoFocusSelectionColor() { + if (noFocusSelectionColor == null) { + //allow theme/ui custom definition + noFocusSelectionColor = + UIManager.getColor("nb.explorer.noFocusSelectionColor"); //NOI18N + if (noFocusSelectionColor == null) { + //try to get standard shadow color + noFocusSelectionColor = UIManager.getColor("controlShadow"); //NOI18N + if (noFocusSelectionColor == null) { + //Okay, the look and feel doesn't suport it, punt + noFocusSelectionColor = Color.lightGray; + } + //Lighten it a bit because disabled text will use controlShadow/ + //gray + noFocusSelectionColor = noFocusSelectionColor.brighter(); + } + } + return noFocusSelectionColor; + } + } Index: TableSheetCell.java =================================================================== RCS file: /cvs/openide/src/org/openide/explorer/view/TableSheetCell.java,v retrieving revision 1.10 diff -c -r1.10 TableSheetCell.java *** TableSheetCell.java 15 Apr 2003 14:03:51 -0000 1.10 --- TableSheetCell.java 17 Oct 2003 13:07:43 -0000 *************** *** 20,25 **** --- 20,26 ---- import java.lang.reflect.InvocationTargetException; import java.awt.Graphics; import java.awt.Component; + import java.awt.KeyboardFocusManager; import java.lang.ref.Reference; import java.lang.ref.WeakReference; import java.util.Map; *************** *** 243,252 **** propPanel.setFocused(hasFocus); propPanel.setToolTipText(prop.getShortDescription()); propPanel.setOpaque(true); ! if (isSelected) propPanel.setBackground(table.getSelectionBackground()); ! else propPanel.setBackground(table.getBackground()); return propPanel; } --- 244,267 ---- propPanel.setFocused(hasFocus); propPanel.setToolTipText(prop.getShortDescription()); propPanel.setOpaque(true); ! ! if (isSelected){ ! ! Component focusOwner = KeyboardFocusManager. ! getCurrentKeyboardFocusManager().getFocusOwner(); ! ! boolean tableHasFocus = hasFocus || ! table.isAncestorOf(focusOwner); ! ! propPanel.setBackground(tableHasFocus ? ! table.getSelectionBackground() : ! NodeRenderer.getNoFocusSelectionColor()); ! propPanel.setBackground(table.getSelectionBackground()); ! ! } else { propPanel.setBackground(table.getBackground()); + } return propPanel; } *************** *** 257,265 **** nullPanel.setNode(node); } ! if (isSelected) ! nullPanel.setBackground(table.getSelectionBackground()); ! else nullPanel.setBackground(table.getBackground()); --- 272,286 ---- nullPanel.setNode(node); } ! if (isSelected) { ! Component focusOwner = KeyboardFocusManager. ! getCurrentKeyboardFocusManager().getFocusOwner(); ! ! boolean tableHasFocus = hasFocus || table.isAncestorOf(focusOwner); ! nullPanel.setBackground(tableHasFocus ? ! table.getSelectionBackground() : ! NodeRenderer.getNoFocusSelectionColor()); ! } else nullPanel.setBackground(table.getBackground()); Index: TreeTable.java =================================================================== RCS file: /cvs/openide/src/org/openide/explorer/view/TreeTable.java,v retrieving revision 1.28 diff -c -r1.28 TreeTable.java *** TreeTable.java 4 Jun 2003 20:55:45 -0000 1.28 --- TreeTable.java 17 Oct 2003 13:07:44 -0000 *************** *** 442,448 **** boolean hasFocus, int row, int column) { if(isSelected) { ! setBackground(table.getSelectionBackground()); } else { setBackground(table.getBackground()); } --- 442,457 ---- boolean hasFocus, int row, int column) { if(isSelected) { ! Component focusOwner = ! KeyboardFocusManager.getCurrentKeyboardFocusManager(). ! getFocusOwner(); ! ! boolean tableHasFocus = hasFocus || focusOwner == TreeTable.this ! || TreeTable.this.isAncestorOf(focusOwner); ! ! setBackground(tableHasFocus ? ! table.getSelectionBackground() : ! NodeRenderer.getNoFocusSelectionColor()); } else { setBackground(table.getBackground()); }