Commit be509c71 authored by Skylot's avatar Skylot

fix(gui): use editor font in search node column

parent 29316172
...@@ -397,12 +397,14 @@ public abstract class CommonSearchDialog extends JDialog { ...@@ -397,12 +397,14 @@ public abstract class CommonSearchDialog extends JDialog {
protected class ResultsTableCellRenderer implements TableCellRenderer { protected class ResultsTableCellRenderer implements TableCellRenderer {
private final JLabel emptyLabel = new JLabel(); private final JLabel emptyLabel = new JLabel();
private final Font font;
private final Color codeSelectedColor; private final Color codeSelectedColor;
private final Color codeBackground; private final Color codeBackground;
private final Map<Integer, Component> componentCache = new HashMap<>(); private final Map<Integer, Component> componentCache = new HashMap<>();
public ResultsTableCellRenderer() { public ResultsTableCellRenderer() {
RSyntaxTextArea area = CodeArea.getDefaultArea(mainWindow); RSyntaxTextArea area = CodeArea.getDefaultArea(mainWindow);
this.font = area.getFont();
this.codeSelectedColor = area.getSelectionColor(); this.codeSelectedColor = area.getSelectionColor();
this.codeBackground = area.getBackground(); this.codeBackground = area.getBackground();
} }
...@@ -414,7 +416,7 @@ public abstract class CommonSearchDialog extends JDialog { ...@@ -414,7 +416,7 @@ public abstract class CommonSearchDialog extends JDialog {
Component comp = componentCache.get(id); Component comp = componentCache.get(id);
if (comp == null) { if (comp == null) {
if (obj instanceof JNode) { if (obj instanceof JNode) {
comp = makeCell(table, (JNode) obj, column); comp = makeCell((JNode) obj, column);
componentCache.put(id, comp); componentCache.put(id, comp);
} else { } else {
comp = emptyLabel; comp = emptyLabel;
...@@ -442,10 +444,10 @@ public abstract class CommonSearchDialog extends JDialog { ...@@ -442,10 +444,10 @@ public abstract class CommonSearchDialog extends JDialog {
} }
} }
private Component makeCell(JTable table, JNode node, int column) { private Component makeCell(JNode node, int column) {
if (column == 0) { if (column == 0) {
JLabel label = new JLabel(node.makeLongString() + " ", node.getIcon(), SwingConstants.LEFT); JLabel label = new JLabel(node.makeLongString() + " ", node.getIcon(), SwingConstants.LEFT);
label.setFont(table.getFont()); label.setFont(font);
label.setOpaque(true); label.setOpaque(true);
label.setToolTipText(label.getText()); label.setToolTipText(label.getText());
return label; return label;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment