Skip to content

Commit 0ec0920

Browse files
committed
fix font/colors in completion dialog (processing#3906)
1 parent 8c71c20 commit 0ec0920

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

java/src/processing/mode/java/pdex/CompletionPanel.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package processing.mode.java.pdex;
2222

2323
import java.awt.BorderLayout;
24+
import java.awt.Color;
2425
import java.awt.Component;
2526
import java.awt.Font;
2627
import java.awt.FontMetrics;
@@ -40,6 +41,7 @@
4041

4142
import processing.app.Base;
4243
import processing.app.Messages;
44+
import processing.app.Mode;
4345
import processing.app.syntax.JEditTextArea;
4446
import processing.app.ui.Toolkit;
4547
import processing.mode.java.JavaEditor;
@@ -84,6 +86,9 @@ public class CompletionPanel {
8486
static public ImageIcon methodIcon;
8587
static public ImageIcon localVarIcon;
8688

89+
static Color selectionBgColor;
90+
static Color textColor;
91+
8792

8893
/**
8994
* Triggers the completion popup
@@ -108,11 +113,17 @@ public CompletionPanel(final JEditTextArea textarea,
108113
}
109114

110115
if (classIcon == null) {
111-
File dir = new File(editor.getMode().getFolder(), "theme/completion");
116+
Mode mode = editor.getMode();
117+
118+
File dir = new File(mode.getFolder(), "theme/completion");
112119
classIcon = Toolkit.getIconX(dir, "class_obj");
113120
methodIcon = Toolkit.getIconX(dir, "methpub_obj");
114121
fieldIcon = Toolkit.getIconX(dir, "field_protected_obj");
115122
localVarIcon = Toolkit.getIconX(dir, "field_default_obj");
123+
124+
//selectionBgColor = mode.getColor(""); // no theme.txt for Java Mode
125+
selectionBgColor = new Color(0xffF0F0F0);
126+
textColor = new Color(0xff222222);
116127
}
117128

118129
popupMenu = new JPopupMenu();
@@ -560,6 +571,11 @@ public Component getListCellRendererComponent(JList<?> list, Object value,
560571
index,
561572
isSelected,
562573
cellHasFocus);
574+
if (isSelected) {
575+
label.setBackground(selectionBgColor);
576+
}
577+
label.setForeground(textColor);
578+
563579
if (value instanceof CompletionCandidate) {
564580
CompletionCandidate cc = (CompletionCandidate) value;
565581
switch (cc.getType()) {

todo.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,16 @@ _ mouse events (i.e. toggle breakpoint) seem to be firing twice
8989

9090
3.0 final
9191
_ https://github.com/processing/processing/milestones/3.0%20final
92+
_ completion panel
93+
_ what should the background color be?
94+
_ test fg/bg color on other operating systems
95+
_ fix icon sizes/design
9296
_ fix the design of the completions window
9397
X remove extra border around the outside
94-
_ change font
98+
X change font
99+
X add 2x version of the icons
95100
_ change selection highlight color
96101
_ put some margin around it
97-
X add 2x version of the icons
98102
_ https://github.com/processing/processing/issues/3906
99103
_ import suggestions box needs design review
100104
_ https://github.com/processing/processing/issues/3407

0 commit comments

Comments
 (0)