mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GT-3103 - Look and Feel - fixed Linux Nimbus LaF issues with painting so
that fixups are isolated to individual components
This commit is contained in:
parent
b6765e539d
commit
314274f70a
2 changed files with 13 additions and 36 deletions
|
@ -46,15 +46,20 @@ public class GTreeRenderer extends DefaultTreeCellRenderer implements GComponent
|
|||
boolean expanded, boolean leaf, int row, boolean hasFocus1) {
|
||||
|
||||
super.getTreeCellRendererComponent(tree, value, selected1, expanded, leaf, row, hasFocus1);
|
||||
GTreeNode node = (GTreeNode) value;
|
||||
|
||||
String text = node.getName();
|
||||
setText(text);
|
||||
setToolTipText(node.getToolTip());
|
||||
|
||||
setOpaque(true);
|
||||
setBackground(selected1 ? getBackgroundSelectionColor() : getBackgroundNonSelectionColor());
|
||||
|
||||
if (!(value instanceof GTreeNode)) {
|
||||
// not a GTree
|
||||
return this;
|
||||
}
|
||||
|
||||
GTreeNode node = (GTreeNode) value;
|
||||
String text = node.getName();
|
||||
setText(text);
|
||||
setToolTipText(node.getToolTip());
|
||||
|
||||
Icon icon = node.getIcon(expanded);
|
||||
if (icon == null) {
|
||||
icon = getIcon();
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
*/
|
||||
package ghidra.docking.util;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -207,39 +207,11 @@ public class DockingWindowsLookAndFeelUtils {
|
|||
UIDefaults defaults = lookAndFeel.getDefaults();
|
||||
defaults.put("ScrollBar.minimumThumbSize", new Dimension(30, 30));
|
||||
|
||||
UIDefaults lafd = UIManager.getLookAndFeelDefaults();
|
||||
|
||||
Painter<JComponent> painterStub = new Painter<>() {
|
||||
@Override
|
||||
public void paint(Graphics2D g, JComponent c, int width, int height) {
|
||||
// stub
|
||||
}
|
||||
};
|
||||
|
||||
// (see NimbusDefaults for key values)
|
||||
// These settings disable tree row selection; when enable each tree row paints its
|
||||
// selection independently from the renderer
|
||||
lafd.put("Tree:TreeCell[Enabled+Selected].backgroundPainter", painterStub);
|
||||
lafd.put("Tree:TreeCell[Focused+Selected].backgroundPainter", painterStub);
|
||||
|
||||
// These settings force the tree arrow icon painting to use the non-selected
|
||||
// color. We need this since we disabled the row selection painting above.
|
||||
swapPainters(lafd, "Tree[Enabled].collapsedIconPainter",
|
||||
"Tree[Enabled+Selected].collapsedIconPainter");
|
||||
swapPainters(lafd, "Tree[Enabled].expandedIconPainter",
|
||||
"Tree[Enabled+Selected].expandedIconPainter");
|
||||
|
||||
// (see NimbusDefaults for key values that can be changed here)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void swapPainters(UIDefaults lafd, String from, String to) {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Painter<JComponent> newPainter = (Painter<JComponent>) lafd.get(from);
|
||||
lafd.put(to, newPainter);
|
||||
}
|
||||
|
||||
private static void installGlobalLookAndFeelAttributes() {
|
||||
// Fix up the default fonts that Java 1.5.0 changed to Courier, which looked terrible.
|
||||
Font f = new Font("Monospaced", Font.PLAIN, 12);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue