Merge pull request #1745 from SiboVG/issue-1742

[#1742] Highlight text white if in selection
This commit is contained in:
Sibo Van Gool 2022-10-18 23:12:03 +02:00 committed by GitHub
commit 1ded75fd49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ import java.awt.Font;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.stream.IntStream;
import javax.swing.JTree;
import javax.swing.ToolTipManager;
@ -174,9 +175,14 @@ public class SimulationModifierTree extends BasicTree {
if (selectedModifiers.contains(object)) {
setForeground(Color.GRAY);
} else {
if (tree.getSelectionRows() != null &&
IntStream.of(tree.getSelectionRows()).anyMatch(r -> r == row)) {
setForeground(Color.WHITE);
} else {
setForeground(Color.BLACK);
}
}
setFont(modifierFont);
setText(((SimulationModifier) object).getName());
setToolTipText(((SimulationModifier) object).getDescription());