From 2a23aeecddc3399596b68c154fd452e5f9069379 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Thu, 18 Apr 2019 13:28:50 +0200 Subject: [PATCH] remove BegButtonUI --- .../src/com/intellij/ide/ui/laf/IdeaLaf.java | 1 - .../com/intellij/ui/plaf/beg/BegButtonUI.java | 82 ------------------- 2 files changed, 83 deletions(-) delete mode 100644 platform/platform-impl/src/com/intellij/ui/plaf/beg/BegButtonUI.java diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/IdeaLaf.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/IdeaLaf.java index 24f746d0301d..02cca63ecf29 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/IdeaLaf.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/IdeaLaf.java @@ -54,7 +54,6 @@ public final class IdeaLaf extends MetalLookAndFeel { defaults.put("PopupMenu.border", popupMenuBorder); defaults.put("ScrollPane.border", BegBorders.getScrollPaneBorder()); - defaults.put("ButtonUI", BegButtonUI.class.getName()); defaults.put("ToggleButtonUI", BegToggleButtonUI.class.getName()); defaults.put("RadioButtonUI", BegRadioButtonUI.class.getName()); defaults.put("CheckBoxUI", BegCheckBoxUI.class.getName()); diff --git a/platform/platform-impl/src/com/intellij/ui/plaf/beg/BegButtonUI.java b/platform/platform-impl/src/com/intellij/ui/plaf/beg/BegButtonUI.java deleted file mode 100644 index 9d9d98a004d6..000000000000 --- a/platform/platform-impl/src/com/intellij/ui/plaf/beg/BegButtonUI.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.ui.plaf.beg; - -import com.intellij.util.ui.UIUtil; - -import javax.swing.*; -import javax.swing.plaf.ComponentUI; -import javax.swing.plaf.metal.MetalButtonUI; -import java.awt.*; - -public class BegButtonUI extends MetalButtonUI { - private final static BegButtonUI begButtonUI = new BegButtonUI(); - private final Rectangle viewRect = new Rectangle(); - private final Rectangle textRect = new Rectangle(); - private final Rectangle iconRect = new Rectangle(); - - public static ComponentUI createUI(JComponent c) { - return begButtonUI; - } - -/* - protected BasicButtonListener createButtonListener(AbstractButton b) { - return new BasicButtonListener(b); - } -*/ - - @Override - public void paint(Graphics g, JComponent c) { - AbstractButton b = (AbstractButton)c; - ButtonModel model = b.getModel(); - - FontMetrics fm = g.getFontMetrics(); - - Insets i = c.getInsets(); - - viewRect.x = i.left; - viewRect.y = i.top; - viewRect.width = b.getWidth() - (i.right + viewRect.x); - viewRect.height = b.getHeight() - (i.bottom + viewRect.y); - - textRect.x = textRect.y = textRect.width = textRect.height = 0; - iconRect.x = iconRect.y = iconRect.width = iconRect.height = 0; - - Font f = c.getFont(); - g.setFont(f); - - // layout the text and icon - String text = SwingUtilities.layoutCompoundLabel( - c, fm, b.getText(), b.getIcon(), - b.getVerticalAlignment(), b.getHorizontalAlignment(), - b.getVerticalTextPosition(), b.getHorizontalTextPosition(), - viewRect, iconRect, textRect, - b.getText() == null ? 0 : b.getIconTextGap() - ); - - clearTextShiftOffset(); - - // perform UI specific press action, e.g. Windows L&F shifts text - if (model.isArmed() && model.isPressed()){ - paintButtonPressed(g, b); - } - - // Paint the Icon - if (b.getIcon() != null){ - paintIcon(g, c, iconRect); - } - - if (text != null && !text.equals("")){ - paintText(g, c, textRect, text); - } - - if (b.isFocusPainted() && b.hasFocus()){ - // paint UI specific focus - paintFocus(g, b, viewRect, textRect, iconRect); - } - } - - @Override - protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) { - UIUtil.drawDottedRectangle(g, viewRect.x, viewRect.y, viewRect.x + viewRect.width, viewRect.y + viewRect.height); - } -}