mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed Win10 radioButtons/checkboxes and comment alignment in Component panels
This commit is contained in:
+3
-1
@@ -33,6 +33,8 @@ import java.awt.*;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class DarculaCheckBoxUI extends MetalCheckBoxUI {
|
||||
private static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(20)).asUIResource();
|
||||
|
||||
@SuppressWarnings("MethodOverridesStaticMethodOfSuperclass")
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
if (UIUtil.getParentOfType(CellRendererPane.class, c) != null) {
|
||||
@@ -269,7 +271,7 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
|
||||
|
||||
@Override
|
||||
public Icon getDefaultIcon() {
|
||||
return EmptyIcon.create(JBUI.scale(20)).asUIResource();
|
||||
return DEFAULT_ICON;
|
||||
}
|
||||
|
||||
protected boolean isIndeterminate(AbstractButton checkBox) {
|
||||
|
||||
+3
-1
@@ -39,6 +39,8 @@ import java.awt.geom.Path2D;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class DarculaRadioButtonUI extends MetalRadioButtonUI {
|
||||
private static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(20)).asUIResource();
|
||||
|
||||
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new DarculaRadioButtonUI();
|
||||
@@ -214,6 +216,6 @@ public class DarculaRadioButtonUI extends MetalRadioButtonUI {
|
||||
|
||||
@Override
|
||||
public Icon getDefaultIcon() {
|
||||
return JBUI.scale(EmptyIcon.create(20)).asUIResource();
|
||||
return DEFAULT_ICON;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -27,6 +27,7 @@ import java.awt.*;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class WinIntelliJCheckBoxUI extends IntelliJCheckBoxUI {
|
||||
private static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(13)).asUIResource();
|
||||
|
||||
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
@@ -45,9 +46,7 @@ public class WinIntelliJCheckBoxUI extends IntelliJCheckBoxUI {
|
||||
Icon icon = MacIntelliJIconCache.getIcon(iconName, false, selected || isIndeterminate(b), focused, enabled, pressed);
|
||||
|
||||
if (icon != null) {
|
||||
int x = (iconRect.width - icon.getIconWidth()) / 2 + iconRect.x;
|
||||
int y = (iconRect.height - icon.getIconHeight()) / 2 + iconRect.y + JBUI.scale(1);
|
||||
icon.paintIcon(c, g, x, y);
|
||||
icon.paintIcon(c, g, iconRect.x, iconRect.y + JBUI.scale(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +62,7 @@ public class WinIntelliJCheckBoxUI extends IntelliJCheckBoxUI {
|
||||
|
||||
@Override
|
||||
public Icon getDefaultIcon() {
|
||||
return JBUI.scale(EmptyIcon.create(18)).asUIResource();
|
||||
return DEFAULT_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+11
-4
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ide.ui.laf.intellij;
|
||||
|
||||
import com.intellij.ide.ui.laf.darcula.ui.DarculaRadioButtonUI;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -26,6 +27,8 @@ import java.awt.*;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class WinIntelliJRadioButtonUI extends DarculaRadioButtonUI {
|
||||
private static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(13)).asUIResource();
|
||||
|
||||
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
AbstractButton b = (AbstractButton)c;
|
||||
@@ -40,9 +43,13 @@ public class WinIntelliJRadioButtonUI extends DarculaRadioButtonUI {
|
||||
boolean focused = c.hasFocus() || bm.isRollover();
|
||||
Icon icon = MacIntelliJIconCache.getIcon("radio", false, bm.isSelected(), focused, bm.isEnabled(), bm.isPressed());
|
||||
|
||||
// Paint the radio button
|
||||
int x = (iconRect.width - icon.getIconWidth()) / 2 + iconRect.x;
|
||||
int y = (iconRect.height - icon.getIconHeight()) / 2 + iconRect.y + JBUI.scale(1);
|
||||
icon.paintIcon(c, g, x, y);
|
||||
if (icon != null) {
|
||||
icon.paintIcon(c, g, iconRect.x, iconRect.y + JBUI.scale(1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getDefaultIcon() {
|
||||
return DEFAULT_ICON;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,18 +186,18 @@ public class ComponentPanelBuilderImpl implements ComponentPanelBuilder, GridBag
|
||||
|
||||
if (myComponent instanceof JRadioButton || myComponent instanceof JCheckBox) {
|
||||
top = 0;
|
||||
left = isMacDefault ? 27 : 24;
|
||||
left = isMacDefault ? 27 : isWin10 ? 17 : 24;
|
||||
bottom = isWin10 ? 10 : isMacDefault ? 8 : 9;
|
||||
}
|
||||
else if (myComponent instanceof JTextField || myComponent instanceof EditorTextField ||
|
||||
myComponent instanceof JComboBox || myComponent instanceof ComponentWithBrowseButton) {
|
||||
top = isWin10 ? 3 : 4;
|
||||
left = isWin10 ? 1 : isMacDefault ? 5 : 4;
|
||||
left = isWin10 ? 2 : isMacDefault ? 5 : 4;
|
||||
bottom = isWin10 ? 10 : isMacDefault ? 8 : 9;
|
||||
}
|
||||
else if (myComponent instanceof JButton) {
|
||||
top = isWin10 ? 2 : 4;
|
||||
left = isWin10 ? 1 : isMacDefault ? 5 : 6;
|
||||
left = isWin10 ? 2 : isMacDefault ? 5 : 6;
|
||||
bottom = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -266,7 +267,9 @@ public class ProgressPanelBuilderImpl implements ProgressPanelBuilder, GridBagPa
|
||||
myProgressBar.putClientProperty(LABELED_PANEL_PROPERTY, this);
|
||||
|
||||
gc.weightx = 0.0;
|
||||
gc.insets = JBUI.insets(labelAbove || topSeparatorEnabled || smallVariant ? 1 : 14, 10, 0, 13);
|
||||
gc.insets = JBUI.insets(labelAbove || topSeparatorEnabled || smallVariant ? 1 : 14,
|
||||
UIUtil.isUnderWin10LookAndFeel() ? 9 : 10,
|
||||
0, 13);
|
||||
|
||||
if (cancelAction != null) {
|
||||
if (cancelAsButton) {
|
||||
|
||||
Reference in New Issue
Block a user