mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-24 21:21:56 +00:00
GP-2047 - fix for tree rendering bug on some Linux systems
This commit is contained in:
parent
e3a751ca46
commit
0de8cd3aca
@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -25,31 +24,27 @@ class BackgroundIcon implements Icon {
|
||||
private static Color VERSION_ICON_COLOR_DARK = new Color(0x82, 0x82, 0xff);
|
||||
private static Color VERSION_ICON_COLOR_LIGHT = new Color(0x9f, 0x9f, 0xff);
|
||||
|
||||
private static final int WIDTH = 18;
|
||||
private static final int HEIGHT = 17;
|
||||
|
||||
private int width;
|
||||
private int height;
|
||||
private boolean isVersioned;
|
||||
|
||||
BackgroundIcon(boolean isVersioned) {
|
||||
this(WIDTH, HEIGHT, isVersioned);
|
||||
}
|
||||
|
||||
BackgroundIcon(int width, int height, boolean isVersioned) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.isVersioned = isVersioned;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
if (isVersioned) {
|
||||
g.setColor(VERSION_ICON_COLOR_LIGHT);
|
||||
@ -63,7 +58,6 @@ class BackgroundIcon implements Icon {
|
||||
else {
|
||||
g.setColor(c.getBackground());
|
||||
g.fillRect(x, y, width, height);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -331,11 +331,15 @@ public class DataTypeArchiveGTree extends GTree {
|
||||
JLabel label = (JLabel) super.getTreeCellRendererComponent(tree, value, isSelected,
|
||||
expanded, leaf, row, focus);
|
||||
|
||||
// Background icon uses the label's color so set it to match the
|
||||
// tree's background. Otherwise the icon's in the tree might have a
|
||||
// different background and look odd.
|
||||
MultiIcon multiIcon = new MultiIcon(new BackgroundIcon(ICON_WIDTH, ICON_HEIGHT, false));
|
||||
if (!label.isOpaque()) {
|
||||
// work around an issue on some platforms where the label is painting a color that
|
||||
// does not match the tree
|
||||
label.setBackground(
|
||||
isSelected ? getBackgroundSelectionColor() : tree.getBackground());
|
||||
}
|
||||
|
||||
MultiIcon multiIcon = new MultiIcon(
|
||||
new BackgroundIcon(ICON_WIDTH, ICON_HEIGHT, false));
|
||||
Icon icon = getIcon();
|
||||
multiIcon.addIcon(new CenterVerticalIcon(icon, ICON_HEIGHT));
|
||||
|
||||
|
@ -52,7 +52,6 @@ public class GTreeRenderer extends DefaultTreeCellRenderer implements GComponent
|
||||
// paint the previously dragged-over node as the drop target.
|
||||
paintDropTarget = (value == dropTarget);
|
||||
|
||||
setOpaque(true);
|
||||
setBackground(selected1 ? getBackgroundSelectionColor() : getBackgroundNonSelectionColor());
|
||||
|
||||
if (!(value instanceof GTreeNode)) {
|
||||
|
@ -138,8 +138,8 @@ public class MultiIcon implements Icon {
|
||||
@Override
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
init();
|
||||
for (int i = 0; i < iconList.size(); i++) {
|
||||
Icon icon = iconList.get(i);
|
||||
|
||||
for (Icon icon : iconList) {
|
||||
icon.paintIcon(c, g, x, y);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user