mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-92112 Antialising issue on Before launch component
This commit is contained in:
@@ -59,6 +59,7 @@ public final class IdeaLaf extends MetalLookAndFeel {
|
||||
defaults.put("ScrollPane.border", BegBorders.getScrollPaneBorder());
|
||||
|
||||
defaults.put("ButtonUI", BegButtonUI.class.getName());
|
||||
defaults.put("ToggleButtonUI", BegToggleButtonUI.class.getName());
|
||||
defaults.put("ComboBoxUI", BegComboBoxUI.class.getName());
|
||||
defaults.put("RadioButtonUI", BegRadioButtonUI.class.getName());
|
||||
defaults.put("CheckBoxUI", BegCheckBoxUI.class.getName());
|
||||
|
||||
@@ -142,8 +142,8 @@ public class DropDownPanel extends JPanel {
|
||||
myButton.setSelectedIcon(ICONS[1]);
|
||||
myButton.setBorderPainted(false);
|
||||
myButton.setContentAreaFilled(false);
|
||||
myButton.setFocusPainted(true);
|
||||
myButton.setMargin(new Insets(0,0,0,0));
|
||||
myButton.setFocusPainted(false);
|
||||
myButton.setMargin(new Insets(0, 0, 0, 0));
|
||||
setLayout(new MigLayout("fill, ins 0 0 0 5, gap 2, align left"));
|
||||
add(myButton);
|
||||
add(new JSeparator(), "pushx, growx");
|
||||
|
||||
@@ -89,27 +89,6 @@ public class BegButtonUI extends MetalButtonUI {
|
||||
}
|
||||
|
||||
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
|
||||
Rectangle focusRect = new Rectangle();
|
||||
String text = b.getText();
|
||||
boolean isIcon = b.getIcon() != null;
|
||||
|
||||
// If there is text
|
||||
if (text != null && !text.equals("")){
|
||||
if (!isIcon){
|
||||
focusRect.setBounds(textRect);
|
||||
}
|
||||
else{
|
||||
focusRect.setBounds(iconRect.union(textRect));
|
||||
}
|
||||
}
|
||||
// If there is an icon and no text
|
||||
else
|
||||
if (isIcon){
|
||||
focusRect.setBounds(iconRect);
|
||||
}
|
||||
|
||||
g.setColor(getFocusColor());
|
||||
// g.drawRect(focusRect.x - 1, focusRect.y - 1, focusRect.width + 1, focusRect.height + 1);
|
||||
UIUtil.drawDottedRectangle(g, viewRect.x, viewRect.y, viewRect.x + viewRect.width, viewRect.y + viewRect.height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.ui.plaf.beg;
|
||||
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.metal.MetalToggleButtonUI;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* User: Vassiliy.Kudryashov
|
||||
*/
|
||||
public class BegToggleButtonUI extends MetalToggleButtonUI{
|
||||
private final static BegToggleButtonUI begToggleButtonUI = new BegToggleButtonUI();
|
||||
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return begToggleButtonUI;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {
|
||||
g.setColor(getFocusColor());
|
||||
UIUtil.drawDottedRectangle(g, viewRect.x, viewRect.y, viewRect.x + viewRect.width, viewRect.y + viewRect.height);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user