Skip to content

Commit

Permalink
Only add margin size to preferred size if current size is insufficient.
Browse files Browse the repository at this point in the history
Fixes #201
  • Loading branch information
weisJ committed Aug 5, 2020
1 parent 5af510e commit 4597251
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,6 @@ public int getNextMatch(final String prefix, final int startIndex, final Positio
}
return -1;
}

@Override
protected void paintComponent(final Graphics g) {
super.paintComponent(g);
// for (Component c = this; c != null; c = c.getParent()) {
// System.out.println(c);
// System.out.println(c.getBackground());
// System.out.println(c.isOpaque());
// }
}
};
list.setCellRenderer(new DarkFileRenderer());
list.setLayoutOrientation(JList.VERTICAL_WRAP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,9 @@ public Dimension getPreferredSize(final JComponent c) {
dim.height = Math.max(dim.height, prefSize.height);
}
}
dim.width += getCaretWidth();
if (c.getSize().width < dim.width) {
dim.width += getCaretWidth();
}
return dim;
}

Expand Down

0 comments on commit 4597251

Please sign in to comment.