diff --git a/app/src/processing/app/LibraryListPanel.java b/app/src/processing/app/LibraryListPanel.java index 7d40b72c7..3f0cb8a3d 100644 --- a/app/src/processing/app/LibraryListPanel.java +++ b/app/src/processing/app/LibraryListPanel.java @@ -66,7 +66,9 @@ public class LibraryListPanel extends JPanel { configureInfoPane(); setShowInfo(false); + updateColors(); updateLibraryListSize(); + addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { for (Component c : LibraryListPanel.this.getComponents()) { @@ -76,6 +78,7 @@ public class LibraryListPanel extends JPanel { } } setShowInfo(true); + updateColors(); updateLibraryListSize(); } }); @@ -172,14 +175,8 @@ public class LibraryListPanel extends JPanel { CardLayout cardLayout = (CardLayout) infoPanel.getLayout(); if (isInfoShown) { - setBackground(UIManager.getColor("List.selectionBackground")); - cascadeForgroundColor(this, UIManager.getColor("List.selectionForeground")); - cardLayout.show(infoPanel, clickedCardId); } else { - setBackground(UIManager.getColor("List.background")); - cascadeForgroundColor(this, UIManager.getColor("List.foreground")); - cardLayout.show(infoPanel, unclickedCardId); } @@ -318,6 +315,34 @@ public class LibraryListPanel extends JPanel { return noLines; } + + private void updateColors() { + + int count = 0; + for (Component c : getComponents()) { + if (c instanceof LibraryPanel) { + LibraryPanel libPanel = (LibraryPanel) c; + + if (libPanel.isInfoShown) { + libPanel.setBackground(UIManager.getColor("List.selectionBackground")); + cascadeForgroundColor(libPanel, UIManager.getColor("List.selectionForeground")); + libPanel.setBorder(UIManager.getBorder("List.focusCellHighlightBorder")); + } else { + if (Base.isMacOS()) { + if (count % 2 == 1) { + libPanel.setBorder(UIManager.getBorder("List.evenRowBackgroundPainter")); + } else { + libPanel.setBorder(UIManager.getBorder("List.oddRowBackgroundPainter")); + } + } + libPanel.setBackground(UIManager.getColor("List.background")); + cascadeForgroundColor(libPanel, UIManager.getColor("List.foreground")); + } + + count++; + } + } + } /** * Calculates the height in pixels of the text in a JTextArea given a width diff --git a/app/src/processing/app/LibraryManager.java b/app/src/processing/app/LibraryManager.java index 3123e6b29..844e1e920 100644 --- a/app/src/processing/app/LibraryManager.java +++ b/app/src/processing/app/LibraryManager.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2004-09 Ben Fry and Casey Reas + Copyright (c) 2004-11 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify