use of com.github.weisj.swingdsl.visualpadding.VisualPaddingProvider in project darklaf by weisJ.
the class ThemeSettingsPanel method createMonitorSettings.
private Component createMonitorSettings(final GroupLayout.Alignment alignment, final Insets insets) {
TristateCheckBox enabledSystemPreferences = settingsUI.getSystemPreferencesTristateCheckBox();
Insets ins = new Insets(insets.top, insets.left, insets.bottom, insets.right);
if (alignment == GroupLayout.Alignment.LEADING) {
Insets padding = ((VisualPaddingProvider) enabledSystemPreferences.getBorder()).getVisualPaddings(enabledSystemPreferences);
ins = DarkUIUtil.addInsets(ins, DarkUIUtil.invert(padding));
}
JPanel panel = DynamicUI.withDynamic(new JPanel(new BorderLayout()), c -> c.setBorder(BorderFactory.createTitledBorder(UIManager.getString(ThemeSettingsUI.MONITORING_LABEL_KEY, getLocale()))));
JComponent c = LayoutHelper.createTwoColumnPanel(new JComponent[] { enabledSystemPreferences, settingsUI.getThemeFollowsSystemCheckBox(), settingsUI.getAccentColorFollowsSystemCheckBox() }, new JComponent[] { new JLabel(), settingsUI.getFontSizeFollowsSystemCheckBox(), settingsUI.getSelectionColorFollowsSystemCheckBox() }, GroupLayout.Alignment.LEADING, GroupLayout.Alignment.LEADING);
c.setBorder(LayoutHelper.createEmptyBorder(ins));
panel.add(c);
return panel;
}
use of com.github.weisj.swingdsl.visualpadding.VisualPaddingProvider in project darklaf by weisJ.
the class DarkSliderUI method getBaseline.
@Override
public int getBaseline(JComponent c, int width, int height) {
if (isHorizontal() && PropertyUtil.getBooleanProperty(c, KEY_USE_TRACK_AS_BASELINE)) {
int thumbY = focusInsets.top + trackBuffer;
if (isPlainThumb()) {
Dimension thumbSize = getThumbSize();
return thumbY + thumbSize.height - focusBorderSize;
} else {
Icon icon = getThumbIcon();
int baseline = thumbY + icon.getIconHeight();
if (icon instanceof RotatableIcon) {
icon = ((RotatableIcon) icon).getIcon();
}
if (icon instanceof VisualPaddingProvider) {
baseline -= ((VisualPaddingProvider) icon).getVisualPaddings(slider).bottom;
}
return baseline;
}
} else {
return super.getBaseline(c, width, height);
}
}
Aggregations