diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java index 964f88b6f37e..7414c7558ee9 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarPanel.java @@ -57,6 +57,7 @@ import com.intellij.problems.WolfTheProblemSolver; import com.intellij.psi.*; import com.intellij.ui.*; import com.intellij.ui.awt.RelativePoint; +import com.intellij.ui.components.panels.OpaquePanel; import com.intellij.ui.popup.AbstractPopup; import com.intellij.ui.popup.PopupOwner; import com.intellij.ui.popup.list.ListPopupImpl; @@ -81,7 +82,7 @@ import java.util.Set; * User: anna * Date: 03-Nov-2005 */ -public class NavBarPanel extends JPanel implements DataProvider, PopupOwner { +public class NavBarPanel extends OpaquePanel.List implements DataProvider, PopupOwner { private static final Logger LOG = Logger.getInstance("#com.intellij.ide.navigationToolbar.NavigationToolbarPanel"); /*private static final Icon LEFT_ICON = IconLoader.getIcon("/general/splitLeft.png"); private static final Icon RIGHT_ICON = IconLoader.getIcon("/general/splitRight.png"); @@ -107,8 +108,6 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner { myProject = project; myModel = new NavBarModel(myProject); - setBackground(UIUtil.getListBackground()); - setOpaque(true); PopupHandler.installPopupHandler(this, IdeActions.GROUP_PROJECT_VIEW_POPUP, ActionPlaces.NAVIGATION_BAR); @@ -482,7 +481,7 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner { } final Object object = myModel.getElement(index); - final List objects = myModel.calcElementChildren(object); + final java.util.List objects = myModel.calcElementChildren(object); if (!objects.isEmpty()) { final Object[] siblings = new Object[objects.size()]; @@ -895,7 +894,7 @@ public class NavBarPanel extends JPanel implements DataProvider, PopupOwner { boolean selected = myModel.getSelectedIndex() == myIndex; setPaintFocusBorder(selected); - setFocusBorderAroundIcon(selected); + setFocusBorderAroundIcon(true); setBackground(selected && focused ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground()); diff --git a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarRootPaneExtension.java b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarRootPaneExtension.java index b7a959bebdd1..9d4b1ddbce10 100644 --- a/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarRootPaneExtension.java +++ b/platform/lang-impl/src/com/intellij/ide/navigationToolbar/NavBarRootPaneExtension.java @@ -25,6 +25,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.wm.impl.IdeRootPaneNorthExtension; import com.intellij.ui.ScrollPaneFactory; +import com.intellij.ui.components.panels.OpaquePanel; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; @@ -47,9 +48,8 @@ public class NavBarRootPaneExtension extends IdeRootPaneNorthExtension { public JComponent getComponent() { if (myPanel == null) { - myPanel = new JPanel(new BorderLayout()); + myPanel = new OpaquePanel.List(new BorderLayout()); - myPanel.setBackground(UIUtil.getListBackground()); myNavigationBar = new NavBarPanel(myProject); JScrollPane scroller = ScrollPaneFactory.createScrollPane(myNavigationBar); diff --git a/platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java b/platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java index 6c3ed97da272..cdbf6f125a2a 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java +++ b/platform/lang-impl/src/com/intellij/ide/util/NavigationItemListCellRenderer.java @@ -34,13 +34,16 @@ import com.intellij.psi.util.PsiUtilBase; import com.intellij.ui.ColoredListCellRenderer; import com.intellij.ui.FileColorManager; import com.intellij.ui.SimpleTextAttributes; +import com.intellij.ui.components.panels.NonOpaquePanel; +import com.intellij.ui.components.panels.OpaquePanel; import com.intellij.util.IconUtil; import com.intellij.util.ui.UIUtil; import javax.swing.*; +import javax.swing.border.LineBorder; import java.awt.*; -public class NavigationItemListCellRenderer extends JPanel implements ListCellRenderer { +public class NavigationItemListCellRenderer extends OpaquePanel implements ListCellRenderer { public NavigationItemListCellRenderer() { super(new BorderLayout()); } @@ -64,6 +67,8 @@ public class NavigationItemListCellRenderer extends JPanel implements ListCellRe final Color listBg = leftCellRendererComponent.getBackground(); add(leftCellRendererComponent, BorderLayout.WEST); + setBackground(isSelected ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground()); + if (hasRightRenderer){ final DefaultListCellRenderer moduleRenderer = factory.getModuleRenderer(); @@ -71,13 +76,13 @@ public class NavigationItemListCellRenderer extends JPanel implements ListCellRe moduleRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); rightCellRendererComponent.setBackground(listBg); add(rightCellRendererComponent, BorderLayout.EAST); - final JPanel spacer = new JPanel(); + final JPanel spacer = new NonOpaquePanel(); + final Dimension size = rightCellRendererComponent.getSize(); spacer.setSize(new Dimension((int)(size.width * 0.015 + leftCellRendererComponent.getSize().width * 0.015), size.height)); spacer.setBackground(isSelected ? UIUtil.getListSelectionBackground() : listBg); add(spacer, BorderLayout.CENTER); } - setBackground(isSelected ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground()); return this; } diff --git a/platform/lang-impl/src/com/intellij/ide/util/PsiElementModuleRenderer.java b/platform/lang-impl/src/com/intellij/ide/util/PsiElementModuleRenderer.java index cbbdb541b39d..7503714e8a58 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/PsiElementModuleRenderer.java +++ b/platform/lang-impl/src/com/intellij/ide/util/PsiElementModuleRenderer.java @@ -27,6 +27,7 @@ import com.intellij.psi.PsiFile; import com.intellij.util.ui.UIUtil; import javax.swing.*; +import javax.swing.border.LineBorder; import java.awt.*; public class PsiElementModuleRenderer extends DefaultListCellRenderer{ @@ -112,9 +113,14 @@ public class PsiElementModuleRenderer extends DefaultListCellRenderer{ setText(value == null ? "" : value.toString()); }*/ setText(myText); - setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2)); + //setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2)); setHorizontalTextPosition(SwingConstants.LEFT); setBackground(selected ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground()); setForeground(selected ? UIUtil.getListSelectionForeground() : UIUtil.getInactiveTextColor()); + + if (UIUtil.isUnderNimbusLookAndFeel()) { + setOpaque(false); + } + } } diff --git a/platform/platform-api/src/com/intellij/ui/components/panels/NonOpaquePanel.java b/platform/platform-api/src/com/intellij/ui/components/panels/NonOpaquePanel.java index 06a7e3649545..1c53923022f9 100644 --- a/platform/platform-api/src/com/intellij/ui/components/panels/NonOpaquePanel.java +++ b/platform/platform-api/src/com/intellij/ui/components/panels/NonOpaquePanel.java @@ -15,11 +15,15 @@ */ package com.intellij.ui.components.panels; +import com.intellij.util.ui.UIUtil; + import javax.swing.*; import java.awt.*; public class NonOpaquePanel extends Wrapper { + private static final Color TRANSPARENT = new Color(0, 0, 0, 0); + public NonOpaquePanel() { setOpaque(false); } @@ -49,4 +53,21 @@ public class NonOpaquePanel extends Wrapper { setOpaque(false); } + @Override + public void setOpaque(boolean isOpaque) { + super.setOpaque(isOpaque); + + if (!isOpaque && UIUtil.isUnderNimbusLookAndFeel()) { + if (UIUtil.isUnderNimbusLookAndFeel()) { + setBackground(TRANSPARENT); + } + } + } + + public static void setTransparent(JComponent c) { + c.setOpaque(false); + if (UIUtil.isUnderNimbusLookAndFeel()) { + c.setBackground(TRANSPARENT); + } + } } diff --git a/platform/platform-api/src/com/intellij/ui/components/panels/OpaquePanel.java b/platform/platform-api/src/com/intellij/ui/components/panels/OpaquePanel.java index ae2d05b4bf33..f90413394b25 100644 --- a/platform/platform-api/src/com/intellij/ui/components/panels/OpaquePanel.java +++ b/platform/platform-api/src/com/intellij/ui/components/panels/OpaquePanel.java @@ -25,6 +25,7 @@ public class OpaquePanel extends JPanel { private boolean myOpaqueActive = true; + private String myKey; public OpaquePanel() { this(null, null); @@ -43,9 +44,15 @@ public class OpaquePanel extends JPanel { setBackground(color); } + public OpaquePanel setKey(String key) { + myKey = key; + return this; + } + protected void paintComponent(Graphics g) { if (myOpaqueActive) { - g.setColor(getBackground()); + Color bg = myKey != null ? UIManager.getColor(myKey) : getBackground(); + g.setColor(bg); Dimension size = getSize(); g.fillRect(0, 0, size.width, size.height); } @@ -58,4 +65,25 @@ public class OpaquePanel extends JPanel { public void setOpaqueActive(final boolean opaqueActive) { myOpaqueActive = opaqueActive; } + + public static class List extends OpaquePanel { + public List() { + setKey("List.background"); + } + + public List(LayoutManager layout) { + super(layout); + setKey("List.background"); + } + + public List(Color color) { + super(color); + setKey("List.background"); + } + + public List(LayoutManager layoutManager, Color color) { + super(layoutManager, color); + setKey("List.background"); + } + } } diff --git a/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsListPanel.java b/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsListPanel.java index ffa226b08673..17ba185aca1f 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsListPanel.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/ui/NotificationsListPanel.java @@ -184,6 +184,10 @@ public class NotificationsListPanel extends JPanel implements NotificationModelL myText.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0)); myText.setOpaque(false); + if (UIUtil.isUnderNimbusLookAndFeel()) { + myText.setBackground(new Color(0, 0, 0, 0)); + } + myText.setEditable(false); myText.setEditorKit(UIUtil.getHTMLEditorKit()); diff --git a/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java b/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java index 6941af28b8f9..a2b16dd885ce 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/PopupFactoryImpl.java @@ -711,7 +711,7 @@ public class PopupFactoryImpl extends JBPopupFactory { final JLabel label = new JLabel(text.getText()); final Dimension size = label.getPreferredSize(); text.setEditable(false); - text.setOpaque(false); + NonOpaquePanel.setTransparent(text); text.setBorder(null); text.setPreferredSize(size); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java index 50e0febdf6bb..644de8146d12 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesTreeList.java @@ -35,6 +35,7 @@ import com.intellij.openapi.vcs.changes.ChangesUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.*; import com.intellij.ui.components.JBList; +import com.intellij.ui.components.panels.NonOpaquePanel; import com.intellij.ui.treeStructure.Tree; import com.intellij.ui.treeStructure.actions.CollapseAllAction; import com.intellij.ui.treeStructure.actions.ExpandAllAction; @@ -556,8 +557,8 @@ public abstract class ChangesTreeList extends JPanel { myCheckBox = new JCheckBox(); myTextRenderer = new ChangesBrowserNodeRenderer(myProject, false, myHighlightProblems); - myCheckBox.setBackground(null); - setBackground(null); + NonOpaquePanel.setTransparent(this); + NonOpaquePanel.setTransparent(myCheckBox); if (myShowCheckboxes) { add(myCheckBox, BorderLayout.WEST);