mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fix for JToggleButton (we had no specific UI for Darcula/IntelliJ before)
This commit is contained in:
@@ -50,7 +50,7 @@ public class DarculaButtonUI extends BasicButtonUI {
|
||||
final Insets ins = border.getBorderInsets(c);
|
||||
final int yOff = (ins.top + ins.bottom) / 4;
|
||||
if (!square) {
|
||||
if (((JButton)c).isDefaultButton()) {
|
||||
if (c instanceof JButton && ((JButton)c).isDefaultButton()) {
|
||||
((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, getSelectedButtonColor1(), 0, c.getHeight(), getSelectedButtonColor2()));
|
||||
}
|
||||
else {
|
||||
@@ -100,7 +100,7 @@ public class DarculaButtonUI extends BasicButtonUI {
|
||||
@Override
|
||||
public void update(Graphics g, JComponent c) {
|
||||
super.update(g, c);
|
||||
if (((JButton)c).isDefaultButton() && !SystemInfo.isMac) {
|
||||
if (c instanceof JButton && ((JButton)c).isDefaultButton() && !SystemInfo.isMac) {
|
||||
if (!c.getFont().isBold()) {
|
||||
c.setFont(c.getFont().deriveFont(Font.BOLD));
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.darcula.ui;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
|
||||
public class DarculaToggleButtonUI extends DarculaButtonUI {
|
||||
@SuppressWarnings("MethodOverridesStaticMethodOfSuperclass")
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new DarculaToggleButtonUI();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user