IDEA-185006 Update radioButton and checkBox icons for Mac Default LaF

This commit is contained in:
Kirill Kirichenko
2018-01-16 16:08:58 +03:00
parent 9ac1de6b44
commit 860ee24826
74 changed files with 102 additions and 170 deletions

View File

@@ -89,7 +89,7 @@ public class InspectionsConfigTreeTable extends TreeTable {
severitiesColumn.setMaxWidth(JBUI.scale(20));
TableColumn isEnabledColumn = getColumnModel().getColumn(IS_ENABLED_COLUMN);
isEnabledColumn.setMaxWidth(JBUI.scale(20 + getAdditionalPadding()));
isEnabledColumn.setMaxWidth(JBUI.scale(22 + getAdditionalPadding()));
ThreeStateCheckBoxRenderer boxRenderer = new ThreeStateCheckBoxRenderer();
boxRenderer.setOpaque(true);
isEnabledColumn.setCellRenderer(boxRenderer);

View File

@@ -15,7 +15,6 @@
*/
package com.intellij.ide.ui.laf.darcula.ui;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
@@ -33,8 +32,7 @@ public class DarculaCheckBoxBorder implements Border, UIResource {
@Override
public Insets getBorderInsets(Component c) {
int a = SystemInfo.isMac || UIUtil.getParentOfType(CellRendererPane.class, c) != null ? 0 : 2;
return JBUI.insets(a).asUIResource();
return JBUI.insets(UIUtil.getParentOfType(CellRendererPane.class, c) != null ? 0 : 2, 0).asUIResource();
}
@Override

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 703 B

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 B

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 466 B

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 565 B

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 730 B

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 662 B

After

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 989 B

After

Width:  |  Height:  |  Size: 994 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 689 B

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 435 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 906 B

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 B

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 730 B

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 630 B

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

After

Width:  |  Height:  |  Size: 917 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 B

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 468 B

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 899 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 688 B

After

Width:  |  Height:  |  Size: 703 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

After

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 B

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 753 B

After

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 998 B

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 B

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 899 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 B

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 573 B

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 825 B

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,30 +0,0 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide.ui.laf.intellij;
import com.intellij.util.ui.JBUI;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.UIResource;
/**
* @author Konstantin Bulenkov
*/
public class MacCheckBoxBorder extends EmptyBorder implements UIResource {
public MacCheckBoxBorder() {
super(JBUI.insets(0, 7));
}
}

View File

@@ -26,7 +26,7 @@ import java.awt.*;
* @author Konstantin Bulenkov
*/
public class MacIntelliJCheckBoxUI extends IntelliJCheckBoxUI {
public static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(20));
public static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(22));
public MacIntelliJCheckBoxUI(JCheckBox c) {
c.setOpaque(false);

View File

@@ -27,7 +27,7 @@ import java.awt.*;
* @author Konstantin Bulenkov
*/
public class MacIntelliJRadioButtonUI extends DarculaRadioButtonUI {
private static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(26));
private static final Icon DEFAULT_ICON = JBUI.scale(EmptyIcon.create(22));
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
public static ComponentUI createUI(JComponent c) {

View File

@@ -1,30 +0,0 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide.ui.laf.intellij;
import com.intellij.util.ui.JBUI;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.UIResource;
/**
* @author Konstantin Bulenkov
*/
public class MacRadioButtonBorder extends EmptyBorder implements UIResource {
public MacRadioButtonBorder() {
super(JBUI.insets(0, 7));
}
}

View File

@@ -9,7 +9,7 @@ intellijlaf.selectionForegroundInactive=000000
window=ececec
CheckBoxUI=com.intellij.ide.ui.laf.intellij.MacIntelliJCheckBoxUI
CheckBox.border=com.intellij.ide.ui.laf.intellij.MacCheckBoxBorder
CheckBox.border=com.intellij.ide.ui.laf.darcula.ui.DarculaCheckBoxBorder
Panel.background=ececec
PopupMenu.translucentBackground=ececec
@@ -31,7 +31,7 @@ SpinnerUI=com.intellij.ide.ui.laf.intellij.MacIntelliJSpinnerUI
Spinner.border=com.intellij.ide.ui.laf.intellij.MacIntelliJSpinnerBorder
RadioButtonUI=com.intellij.ide.ui.laf.intellij.MacIntelliJRadioButtonUI
RadioButton.border=com.intellij.ide.ui.laf.intellij.MacRadioButtonBorder
RadioButton.border=com.intellij.ide.ui.laf.darcula.ui.DarculaCheckBoxBorder
ComboBoxUI=com.intellij.ide.ui.laf.intellij.MacIntelliJComboBoxUI
ComboBox.background=ffffff
ComboBox.border=com.intellij.ide.ui.laf.intellij.MacComboBoxBorder
@@ -49,3 +49,4 @@ TabbedPane.selectedTabTitlePressedColor=dcdcdc
TabbedPane.selectedTabTitleNormalColor=dcdcdc
TableHeader.cellBorder=2,2,2,2
Tree.rowHeight=20

View File

@@ -12,6 +12,7 @@ import com.intellij.openapi.ui.panel.JBPanelFactory;
import com.intellij.openapi.ui.panel.ProgressPanel;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.ui.ComboboxWithBrowseButton;
import com.intellij.ui.SideBorder;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.ui.table.JBTable;
import com.intellij.ui.tabs.TabInfo;
@@ -20,6 +21,7 @@ import com.intellij.ui.tabs.impl.JBEditorTabs;
import com.intellij.util.Alarm;
import com.intellij.util.ObjectUtils;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -60,7 +62,7 @@ public class ComponentPanelTestAction extends DumbAwareAction {
tabs.addTab(new TabInfo(createComponentPanel()).setText("Component"));
tabs.addTab(new TabInfo(createComponentGridPanel()).setText("Component Grid"));
TabInfo progressTab = new TabInfo(createProgressPanel()).setText("Progress");
TabInfo progressTab = new TabInfo(createProgressGridPanel()).setText("Progress Grid");
tabs.addTab(progressTab);
tabs.addListener(new TabsListener.Adapter(){
@@ -76,8 +78,6 @@ public class ComponentPanelTestAction extends DumbAwareAction {
}
});
tabs.addTab(new TabInfo(createProgressGridPanel()).setText("Progress Grid"));
return tabs;
}
@@ -128,6 +128,8 @@ public class ComponentPanelTestAction extends DumbAwareAction {
JBScrollPane pane = new JBScrollPane(table);
pane.setPreferredSize(JBUI.size(200, 100));
pane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.ALL);
panel.add(JBPanelFactory.panel(pane).
withLabel("Table label:").moveLabelOnTop().withComment("Table comment").createPanel());
@@ -139,34 +141,37 @@ public class ComponentPanelTestAction extends DumbAwareAction {
ComponentWithBrowseButton cbb = new ComboboxWithBrowseButton(new JComboBox<>(new String[]{"One", "Two", "Three", "Four"}));
cbb.addActionListener((e) -> System.out.println("Browse for combobox"));
JBScrollPane pane = new JBScrollPane(new JTextArea(3, 40));
pane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.ALL);
JPanel p1 = JBPanelFactory.grid().
add(JBPanelFactory.panel(new JTextField()).
withLabel("&Port:").withComment("Port comment")).
add(JBPanelFactory.panel(new JTextField()).
withLabel("&Port:").withComment("Port comment")).
add(JBPanelFactory.panel(new JTextField()).
withLabel("&Host:").withComment("Host comment")).
add(JBPanelFactory.panel(new JTextField()).
withLabel("&Host:").withComment("Host comment")).
add(JBPanelFactory.panel(new JComboBox<>(new String[]{"HTTP", "HTTPS", "FTP", "SSL"})).
withLabel("P&rotocol:").withComment("Protocol comment").withTooltip("Protocol selection").
withTooltipLink("Check here for more info", ()-> System.out.println("More info"))).
add(JBPanelFactory.panel(new JComboBox<>(new String[]{"HTTP", "HTTPS", "FTP", "SSL"})).
withLabel("P&rotocol:").withComment("Protocol comment").withTooltip("Protocol selection").
withTooltipLink("Check here for more info", ()-> System.out.println("More info"))).
add(JBPanelFactory.panel(new ComponentWithBrowseButton<>(new JTextField(), (e) -> System.out.println("Browse for text"))).
withLabel("&Text field:").withComment("Text field comment")).
add(JBPanelFactory.panel(new ComponentWithBrowseButton<>(new JTextField(), (e) -> System.out.println("Browse for text"))).
withLabel("&Text field:").withComment("Text field comment")).
add(JBPanelFactory.panel(cbb).
withLabel("&Combobox selection:")).
add(JBPanelFactory.panel(cbb).
withLabel("&Combobox selection:")).
add(JBPanelFactory.panel(new JCheckBox("Checkbox")).withComment("Checkbox comment text")).
add(JBPanelFactory.panel(new JCheckBox("Checkbox")).withComment("Checkbox comment text")).
add(JBPanelFactory.panel(new JTextArea(3, 40)).
withLabel("Text area:").withComment("Text area comment").moveLabelOnTop()).
add(JBPanelFactory.panel(pane).
withLabel("Text area:").withComment("Text area comment").moveLabelOnTop()).
createPanel();
createPanel();
ButtonGroup bg = new ButtonGroup();
JRadioButton rb1 = new JRadioButton("RadioButton 1");
JRadioButton rb2 = new JRadioButton("RadioButton 1");
JRadioButton rb3 = new JRadioButton("RadioButton 1");
JRadioButton rb2 = new JRadioButton("RadioButton 2");
JRadioButton rb3 = new JRadioButton("RadioButton 3");
bg.add(rb1);
bg.add(rb2);
bg.add(rb3);
@@ -221,28 +226,6 @@ public class ComponentPanelTestAction extends DumbAwareAction {
}
}
private JComponent createProgressPanel() {
JProgressBar progressBar = new JProgressBar(0, 100);
JPanel innerPanel = JBPanelFactory.panel(progressBar).
withLabel("Process").withCancel(() -> myAlarm.cancelRequest(timerRequest)).
createPanel();
timerRequest = new ProgressTimerRequest(progressBar);
myAlarm.addRequest(timerRequest, 200, ModalityState.any());
ProgressPanel progressPanel = ProgressPanel.forComponent(progressBar);
if (progressPanel != null) {
progressPanel.setCommentText(Integer.toString(0));
}
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(JBUI.Borders.emptyTop(5));
panel.add(innerPanel, BorderLayout.NORTH);
return panel;
}
private JComponent createProgressGridPanel() {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
@@ -250,14 +233,25 @@ public class ComponentPanelTestAction extends DumbAwareAction {
JProgressBar pb1 = new JProgressBar(0, 100);
JProgressBar pb2 = new JProgressBar(0, 100);
timerRequest = new ProgressTimerRequest(pb1);
myAlarm.addRequest(timerRequest, 200, ModalityState.any());
ProgressPanel progressPanel = ProgressPanel.forComponent(pb1);
if (progressPanel != null) {
progressPanel.setCommentText(Integer.toString(0));
}
panel.add(JBPanelFactory.grid().
add(JBPanelFactory.panel(pb1).
withLabel("Label 1.1").
withCancel(()-> System.out.println("Cancel action #1"))).
withLabel("Label ygp 1.1").
withCancel(()-> myAlarm.cancelRequest(timerRequest))).
add(JBPanelFactory.panel(pb2).
withLabel("Label 1.2").
withTopSeparator().
withLabel("Label ygp 1.2").
withPause(()-> System.out.println("Pause action #2")).
withResume(()-> System.out.println("Resume action #2"))).
expandVertically().
createPanel());
ObjectUtils.assertNotNull(ProgressPanel.forComponent(pb1)).setCommentText("Long long long long long long long text");
@@ -271,50 +265,16 @@ public class ComponentPanelTestAction extends DumbAwareAction {
withLabel("Label 2.1").moveLabelLeft().
withCancel(()-> System.out.println("Cancel action #3"))).
add(JBPanelFactory.panel(pb4).
withTopSeparator().
withLabel("Label 2.2").moveLabelLeft().
withPause(()-> System.out.println("Pause action #4")).
withResume(()-> System.out.println("Resume action #4"))).
expandVertically().
createPanel());
ObjectUtils.assertNotNull(ProgressPanel.forComponent(pb3)).setCommentText("Long long long long long long text");
ObjectUtils.assertNotNull(ProgressPanel.forComponent(pb4)).setCommentText("Short text");
JProgressBar pb5 = new JProgressBar(0, 100);
JProgressBar pb6 = new JProgressBar(0, 100);
panel.add(JBPanelFactory.grid().
add(JBPanelFactory.panel(pb5).
withTopSeparator().withLabel("Label 3.1").
withCancel(()-> System.out.println("Cancel action #5")).
andSmallIcons()).
add(JBPanelFactory.panel(pb6).
withLabel("Label 3.2").
withPause(()-> System.out.println("Pause action #6")).
withResume(()-> System.out.println("Resume action #6")).
andSmallIcons()).createPanel());
ObjectUtils.assertNotNull(ProgressPanel.forComponent(pb5)).setCommentText("Long long long long long long text");
ObjectUtils.assertNotNull(ProgressPanel.forComponent(pb6)).setCommentText("Short text");
panel.add(JBPanelFactory.grid().
add(JBPanelFactory.panel(new JProgressBar(0, 100)).
withTopSeparator().withLabel("Label 4.1").withoutComment().
withCancel(()-> System.out.println("Cancel action #7")).
andSmallIcons()).
add(JBPanelFactory.panel(new JProgressBar(0, 100)).
withLabel("Label 4.2").withoutComment().
withPause(()-> System.out.println("Pause action #8")).
withResume(()-> System.out.println("Resume action #8")).
andSmallIcons()).
createPanel());
panel.add(JBPanelFactory.grid().
add(JBPanelFactory.panel(new JProgressBar(0, 100)).
withTopSeparator().withoutComment().
withCancel(()-> System.out.println("Cancel action #9")).
andSmallIcons()).
createPanel());
panel.add(JBPanelFactory.grid().
add(JBPanelFactory.panel(new JProgressBar(0, 100)).
withTopSeparator().withoutComment().
@@ -322,8 +282,7 @@ public class ComponentPanelTestAction extends DumbAwareAction {
withCancel(()-> System.out.println("Cancel action #11"))).
createPanel());
panel.add(Box.createVerticalBox());
return panel;
return JBUI.Panels.simplePanel().addToTop(panel);
}
}
}

View File

@@ -11,6 +11,7 @@ import com.intellij.ui.ContextHelpLabel;
import com.intellij.ui.EditorTextField;
import com.intellij.ui.Gray;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -146,7 +147,7 @@ public class ComponentPanelBuilderImpl implements ComponentPanelBuilder, GridBag
componentPanel.add(lbl);
}
else if (comment != null && !myCommentBelow) {
componentPanel.add(Box.createRigidArea(JBUI.size(14, 0)));
componentPanel.add(Box.createRigidArea(JBUI.size(getCommentOffset(), 0)));
componentPanel.add(comment);
}
@@ -164,19 +165,42 @@ public class ComponentPanelBuilderImpl implements ComponentPanelBuilder, GridBag
gc.gridy++;
}
private Insets getCommentInsets() {
private int getCommentOffset() {
boolean isMacDefault = UIUtil.isUnderDefaultMacTheme();
if (myComponent instanceof JRadioButton || myComponent instanceof JCheckBox) {
return JBUI.insets(0, 24, 0, 0);
return isMacDefault ? 8 : 13;
}
else if (myComponent instanceof JTextField || myComponent instanceof EditorTextField ||
myComponent instanceof JComboBox || myComponent instanceof ComponentWithBrowseButton) {
return JBUI.insets(2, 6, 0, 0);
}
else if (myComponent instanceof JButton) {
return JBUI.insets(0, 8, 0, 0);
}
else {
return JBUI.insetsTop(9);
return isMacDefault ? 13 : 14;
} else {
return 14;
}
}
private Insets getCommentInsets() {
boolean isMacDefault = UIUtil.isUnderDefaultMacTheme();
boolean isWin10 = UIUtil.isUnderWin10LookAndFeel();
int top = 8, left = 2, bottom = 0;
if (myComponent instanceof JRadioButton || myComponent instanceof JCheckBox) {
top = 0;
left = isMacDefault ? 27 : 22;
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 : 2;
bottom = isWin10 ? 10 : isMacDefault ? 8 : 9;
}
else if (myComponent instanceof JButton) {
top = isWin10 ? 2 : 4;
left = isWin10 ? 1 : isMacDefault ? 5 : 4;
bottom = 0;
}
return JBUI.insets(top, left, bottom, 0);
}
}

View File

@@ -231,7 +231,7 @@ public class ProgressPanelBuilderImpl implements ProgressPanelBuilder, GridBagPa
gc.fill = GridBagConstraints.HORIZONTAL;
if (topSeparatorEnabled) {
gc.insets = JBUI.insetsBottom(13);
gc.insets = JBUI.insets(8, 0);
gc.gridwidth = gridWidth();
gc.weightx = 1.0;
panel.add(mySeparatorComponent, gc);
@@ -240,15 +240,15 @@ public class ProgressPanelBuilderImpl implements ProgressPanelBuilder, GridBagPa
gc.weightx = 0.0;
gc.gridwidth = 1;
gc.insets = JBUI.insets(topSeparatorEnabled || smallVariant ? 0 : 13, 13, 0, labelAbove ? 13 : 0);
gc.insets = JBUI.insets(topSeparatorEnabled || smallVariant ? 0 : 12, 13, 0, labelAbove ? 13 : 0);
panel.add(label, gc);
if (labelAbove) {
gc.insets = JBUI.insets(5, 13, 7, 0);
gc.insets = JBUI.insets(4, 13, 4, 0);
gc.gridy++;
}
else {
gc.insets = JBUI.insets(topSeparatorEnabled || smallVariant ? 0 : 13, 12, 0, 0);
gc.insets = JBUI.insets(topSeparatorEnabled || smallVariant ? 2 : 14, 12, 0, 0);
gc.gridx++;
}
@@ -259,7 +259,7 @@ public class ProgressPanelBuilderImpl implements ProgressPanelBuilder, GridBagPa
myProgressBar.putClientProperty(LABELED_PANEL_PROPERTY, this);
gc.weightx = 0.0;
gc.insets = JBUI.insets(labelAbove || topSeparatorEnabled || smallVariant ? 0 : 13, 10, 0, 13);
gc.insets = JBUI.insets(labelAbove || topSeparatorEnabled || smallVariant ? 0 : 14, 10, 0, 13);
if (cancelAction != null) {
if (cancelAsButton) {
@@ -280,11 +280,13 @@ public class ProgressPanelBuilderImpl implements ProgressPanelBuilder, GridBagPa
if (state == State.PLAYING) {
button.setIcons(resumeIcon);
state = State.PAUSED;
setCommentText("Paused", true);
pauseAction.run();
}
else {
button.setIcons(pauseIcon);
state = State.PLAYING;
setCommentText("Pause", true);
resumeAction.run();
}
}).setFillBg(false);
@@ -305,7 +307,7 @@ public class ProgressPanelBuilderImpl implements ProgressPanelBuilder, GridBagPa
if (commentEnabled) {
gc.gridy++;
gc.gridx = labelAbove ? 0 : 1;
gc.insets = labelAbove ? JBUI.insets(0, 13) : JBUI.insets(-4, 13, 0, 13);
gc.insets = labelAbove ? JBUI.insets(-1, 13, 0, 13) : JBUI.insets(-1, 12, 0, 13);
gc.weightx = 1.0;
gc.anchor = GridBagConstraints.LINE_START;
gc.fill = GridBagConstraints.HORIZONTAL;
@@ -331,7 +333,7 @@ public class ProgressPanelBuilderImpl implements ProgressPanelBuilder, GridBagPa
@Override
public void mouseExited(MouseEvent e) {
setCommentText(null, true);
setCommentText(state != State.PAUSED ? null : "Paused", true);
}
}
}

View File

@@ -25,6 +25,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
import java.awt.*;
import java.util.ArrayList;
@@ -229,9 +230,16 @@ public class TableUtil {
}
public static void setupCheckboxColumn(@NotNull JTable table, int columnIndex) {
setupCheckboxColumn(table.getColumnModel().getColumn(columnIndex));
TableColumnModel cModel = table.getColumnModel();
setupCheckboxColumn(cModel.getColumn(columnIndex), cModel.getColumnMargin());
}
/**
* Deprecated because doesn't take into account column margin.
* Use {@link #setupCheckboxColumn(JTable, int)} instead.
* Or use {@link #setupCheckboxColumn(TableColumn, int)} with {@link TableColumnModel#getColumnMargin()} accounted for.
*/
@Deprecated
public static void setupCheckboxColumn(@NotNull TableColumn column) {
setupCheckboxColumn(column, 0);
}

View File

@@ -486,7 +486,7 @@ public class InjectionsSettingsUI extends SearchableConfigurable.Parent.Abstract
setShowGrid(false);
setShowVerticalLines(false);
setGridColor(getForeground());
TableUtil.setupCheckboxColumn(getColumnModel().getColumn(0));
TableUtil.setupCheckboxColumn(this, 0);
new DoubleClickListener() {
@Override