Skip to content

Commit

Permalink
fix(gui): use editor font in search node column
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Jan 23, 2019
1 parent 2931617 commit be509c7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions jadx-gui/src/main/java/jadx/gui/ui/CommonSearchDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,14 @@ public Object getValueAt(int rowIndex, int columnIndex) {

protected class ResultsTableCellRenderer implements TableCellRenderer {
private final JLabel emptyLabel = new JLabel();
private final Font font;
private final Color codeSelectedColor;
private final Color codeBackground;
private final Map<Integer, Component> componentCache = new HashMap<>();

public ResultsTableCellRenderer() {
RSyntaxTextArea area = CodeArea.getDefaultArea(mainWindow);
this.font = area.getFont();
this.codeSelectedColor = area.getSelectionColor();
this.codeBackground = area.getBackground();
}
Expand All @@ -414,7 +416,7 @@ public Component getTableCellRendererComponent(JTable table, Object obj, boolean
Component comp = componentCache.get(id);
if (comp == null) {
if (obj instanceof JNode) {
comp = makeCell(table, (JNode) obj, column);
comp = makeCell((JNode) obj, column);
componentCache.put(id, comp);
} else {
comp = emptyLabel;
Expand Down Expand Up @@ -442,10 +444,10 @@ private void updateSelection(JTable table, Component comp, boolean isSelected) {
}
}

private Component makeCell(JTable table, JNode node, int column) {
private Component makeCell(JNode node, int column) {
if (column == 0) {
JLabel label = new JLabel(node.makeLongString() + " ", node.getIcon(), SwingConstants.LEFT);
label.setFont(table.getFont());
label.setFont(font);
label.setOpaque(true);
label.setToolTipText(label.getText());
return label;
Expand Down

0 comments on commit be509c7

Please sign in to comment.