diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaProgressBarUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaProgressBarUI.java index 97644dd91fc0..e191f809509b 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaProgressBarUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaProgressBarUI.java @@ -69,7 +69,9 @@ public class DarculaProgressBarUI extends BasicProgressBarUI { int x = -offset; final float R = JBUI.scale(8f); final float R2 = JBUI.scale(9f); - final Area containingRoundRect = new Area(new RoundRectangle2D.Float(1f, 1f, w - 2f, h - 2f, R, R)); + final float off = JBUI.scale(1f); + + final Area containingRoundRect = new Area(new RoundRectangle2D.Float(2f * off, 2f * off, w - 4f * off, h - 4f * off, R, R)); while (x < Math.max(c.getWidth(), c.getHeight())) { Path2D.Double path = new Path2D.Double(); float ww = getPeriodLength() / 2f; @@ -87,17 +89,17 @@ public class DarculaProgressBarUI extends BasicProgressBarUI { } offset = (offset + 1) % getPeriodLength(); Area area = new Area(new Rectangle2D.Float(0, 0, w, h)); - area.subtract(new Area(new RoundRectangle2D.Float(1f, 1f, w - 2f, h - 2f, R, R))); - g.setPaint(Gray._128); + area.subtract(new Area(new RoundRectangle2D.Float(off, off, w - 2f * off, h - 2f * off, R, R))); + g.setColor(Gray._128); if (c.isOpaque()) { g.fill(area); } area.subtract(new Area(new RoundRectangle2D.Float(0, 0, w, h, R2, R2))); - g.setPaint(c.getParent().getBackground()); + g.setColor(c.getParent().getBackground()); if (c.isOpaque()) { g.fill(area); } - g.draw(new RoundRectangle2D.Float(1f, 1f, w - 2f - 1f, h - 2f -1f, R, R)); + g.draw(new RoundRectangle2D.Float(off, off, w - 2f * off - off, h - 2f * off - off, R, R)); g.translate(0, -(c.getHeight() - h) / 2); // Deal with possible text painting diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ShowProgressTestDialogAction.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ShowProgressTestDialogAction.java new file mode 100644 index 000000000000..cb40fde82239 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/ShowProgressTestDialogAction.java @@ -0,0 +1,78 @@ +/* + * Copyright 2000-2016 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.openapi.wm.impl.status; + +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.project.DumbAware; +import com.intellij.openapi.ui.DialogWrapper; +import com.intellij.ui.JBProgressBar; +import com.intellij.ui.LightColors; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; +import java.awt.*; + +@SuppressWarnings({"HardCodedStringLiteral"}) +public class ShowProgressTestDialogAction extends AnAction implements DumbAware { + public ShowProgressTestDialogAction() { + super("Show Progress Test Dialog"); + } + + public void actionPerformed(AnActionEvent e) { + new DialogWrapper(e.getProject()) { + { + init(); + } + + @Nullable + @Override + protected JComponent createCenterPanel() { + JPanel panel = new JPanel(); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + + panel.add(createPanel(false, false)); + panel.add(createPanel(false, true)); + panel.add(createPanel(true, false)); + panel.add(createPanel(true, true)); + return panel; + } + }.show(); + } + + private static JComponent createPanel(boolean indeterminate, boolean opaque) { + String text = (indeterminate ? "indeterminate" : "determinate") + + (opaque ? "; opaque" : "; non opaque"); + JLabel label = new JLabel(text); + + JBProgressBar progress = new JBProgressBar(); + progress.setIndeterminate(indeterminate); + progress.setValue(30); + progress.setOpaque(opaque); + + JPanel wrapper = new JPanel(new BorderLayout()); + wrapper.add(progress); + wrapper.setBackground(LightColors.BLUE); + + JPanel panel = new JPanel(); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + panel.add(label); + panel.add(wrapper); + panel.add(Box.createVerticalStrut(5)); + + return panel; + } +} diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 1a01c39658b2..59352461aac1 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -740,6 +740,7 @@ +