Fix minor in JBUI.insets, leverage right insets in Darcula checkbox/radiobutton borders.

This commit is contained in:
Kirill Kirichenko
2018-05-17 10:17:13 +03:00
parent aaccc70d35
commit a72bee3df9
4 changed files with 13 additions and 7 deletions
@@ -744,15 +744,15 @@ public class FindPopupPanel extends JBPanel implements FindUI {
myTitlePanel.add(myTitleLabel);
myTitlePanel.add(myLoadingDecorator.getComponent(), "w 24, wmin 24");
myTitlePanel.add(Box.createHorizontalGlue(), "growx, pushx");
int gap = JBUI.scale(16);
int gap = 16;
JPanel regexpPanel = new JPanel(new BorderLayout(JBUI.scale(4), 0));
regexpPanel.add(myCbRegularExpressions, BorderLayout.CENTER);
regexpPanel.add(RegExHelpPopup.createRegExLink("<html><body><b>?</b></body></html>", myCbRegularExpressions, LOG), BorderLayout.EAST);
AnAction[] actions = {
new DefaultCustomComponentAction(() -> JBUI.Borders.emptyRight(gap).wrap(myCbCaseSensitive)),
new DefaultCustomComponentAction(() -> JBUI.Borders.emptyRight(gap).wrap(myCbPreserveCase)),
new DefaultCustomComponentAction(() -> JBUI.Borders.emptyRight(gap).wrap(myCbWholeWordsOnly)),
new DefaultCustomComponentAction(() -> regexpPanel),
new DefaultCustomComponentAction(() -> myCbCaseSensitive),
new DefaultCustomComponentAction(() -> JBUI.Borders.emptyLeft(gap).wrap(myCbPreserveCase)),
new DefaultCustomComponentAction(() -> JBUI.Borders.emptyLeft(gap).wrap(myCbWholeWordsOnly)),
new DefaultCustomComponentAction(() -> JBUI.Borders.emptyLeft(gap).wrap(regexpPanel)),
};
@SuppressWarnings("InspectionUniqueToolbarId")
@@ -71,6 +71,9 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
}
protected Rectangle updateViewRect(AbstractButton b, Rectangle viewRect) {
if (!(b.getBorder() instanceof DarculaCheckBoxBorder)) {
JBInsets.removeFrom(viewRect, b.getInsets());
}
return viewRect;
}
@@ -65,6 +65,9 @@ public class DarculaRadioButtonUI extends MetalRadioButtonUI {
}
protected Rectangle updateViewRect(AbstractButton b, Rectangle viewRect) {
if (!(b.getBorder() instanceof DarculaRadioButtonBorder)) {
JBInsets.removeFrom(viewRect, b.getInsets());
}
return viewRect;
}
@@ -519,8 +519,8 @@ public class JBUI {
@NotNull
public static JBInsets insets(String propName, JBInsets defaultValue) {
JBInsets i = (JBInsets)UIManager.getInsets(propName);
return i != null ? i : defaultValue;
Insets i = UIManager.getInsets(propName);
return i != null ? JBInsets.create(i) : defaultValue;
}
@NotNull