Merge lp:~tapaal-contributor/tapaal/query-list-selection-win-fix-1520106 into lp:tapaal

Proposed by Jakob Dyhr
Status: Merged
Approved by: Jiri Srba
Approved revision: 926
Merged at revision: 929
Proposed branch: lp:~tapaal-contributor/tapaal/query-list-selection-win-fix-1520106
Merge into: lp:tapaal
Diff against target: 56 lines (+10/-2)
2 files modified
src/pipe/gui/GuiFrame.java (+5/-0)
src/pipe/gui/widgets/QueryPane.java (+5/-2)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/query-list-selection-win-fix-1520106
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+288217@code.launchpad.net

Commit message

List elements on Windows 8 and 10 are now presented visually correct according to the Nimbus L&F.

Description of the change

The issue also affected other lists than the Query list. There appears to be a bug in the current Nimbus L&F that we use for Windows, where JList elements are wrongly colored. I have hard-coded a simple workaround that applies the color to all list elements according to the colors found on http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/_nimbusDefaults.html

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/pipe/gui/GuiFrame.java'
2--- src/pipe/gui/GuiFrame.java 2016-02-15 10:28:53 +0000
3+++ src/pipe/gui/GuiFrame.java 2016-03-06 14:25:28 +0000
4@@ -1,6 +1,7 @@
5 package pipe.gui;
6
7 import java.awt.BorderLayout;
8+import java.awt.Color;
9 import java.awt.Container;
10 import java.awt.Dimension;
11 import java.awt.FlowLayout;
12@@ -288,6 +289,10 @@
13 for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
14 if ("Nimbus".equals(info.getName())) {
15 UIManager.setLookAndFeel(info.getClassName());
16+ UIManager.getLookAndFeelDefaults().put("List[Selected].textBackground", new Color(57, 105, 138));
17+ UIManager.getLookAndFeelDefaults().put("List[Selected].textForeground", new Color(255,255,255));
18+ UIManager.getLookAndFeelDefaults().put("List.background", new Color(255,255,255));
19+
20 break;
21 }
22 }
23
24=== modified file 'src/pipe/gui/widgets/QueryPane.java'
25--- src/pipe/gui/widgets/QueryPane.java 2015-11-26 19:59:39 +0000
26+++ src/pipe/gui/widgets/QueryPane.java 2016-03-06 14:25:28 +0000
27@@ -15,6 +15,7 @@
28 import java.util.Arrays;
29
30 import javax.swing.BorderFactory;
31+import javax.swing.DefaultListCellRenderer;
32 import javax.swing.DefaultListModel;
33 import javax.swing.ImageIcon;
34 import javax.swing.JButton;
35@@ -376,10 +377,12 @@
36 listModel.removeElement(queryToRemove);
37 }
38
39- private class QueryCellRenderer extends JLabel implements ListCellRenderer {
40+ private class QueryCellRenderer extends DefaultListCellRenderer {
41 private static final long serialVersionUID = 3071924451912979500L;
42
43+ @Override
44 public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
45+ Component superRenderer = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
46 if(value instanceof TAPNQuery)
47 setText(((TAPNQuery)value).getName());
48 else
49@@ -399,7 +402,7 @@
50 setToolTipText("Double-click or press the edit button to edit this query");
51 setFont(list.getFont());
52 setOpaque(true);
53- return this;
54+ return superRenderer;
55 }
56 }
57

Subscribers

People subscribed via source and target branches