Updates the colors of all library panels that are visible.
()
| 638 | * Updates the colors of all library panels that are visible. |
| 639 | */ |
| 640 | protected void updateColors() { |
| 641 | int count = 0; |
| 642 | for (Entry<Contribution, DetailPanel> entry : panelByContribution.entrySet()) { |
| 643 | DetailPanel panel = entry.getValue(); |
| 644 | Border border = BorderFactory.createEmptyBorder(1, 1, 1, 1); |
| 645 | |
| 646 | if (panel.isVisible()) { |
| 647 | boolean oddRow = count % 2 == 1; |
| 648 | Color bgColor = null; |
| 649 | Color fgColor = UIManager.getColor("List.foreground"); |
| 650 | |
| 651 | if (panel.isSelected()) { |
| 652 | bgColor = UIManager.getColor("List.selectionBackground"); |
| 653 | fgColor = UIManager.getColor("List.selectionForeground"); |
| 654 | border = UIManager.getBorder("List.focusCellHighlightBorder"); |
| 655 | } else if (Platform.isMacOS()) { |
| 656 | border = oddRow |
| 657 | ? UIManager.getBorder("List.oddRowBackgroundPainter") |
| 658 | : UIManager.getBorder("List.evenRowBackgroundPainter"); |
| 659 | } else { |
| 660 | bgColor = oddRow |
| 661 | ? new Color(219, 224, 229) |
| 662 | : new Color(241, 241, 241); |
| 663 | } |
| 664 | |
| 665 | panel.setForeground(fgColor); |
| 666 | if (bgColor != null) { |
| 667 | panel.setBackground(bgColor); |
| 668 | } |
| 669 | count++; |
| 670 | } |
| 671 | |
| 672 | panel.setBorder(border); |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | |
| 677 | @Override |
no test coverage detected