Browse Source

Added missing UI for JToggleButton.

master
Hendrik Schreiber 8 years ago
parent
commit
50136dd4c6
  1. BIN
      build/darcula.jar
  2. 2
      src/com/bulenkov/darcula/darcula.properties
  3. 6
      src/com/bulenkov/darcula/ui/DarculaButtonUI.java
  4. 30
      src/com/bulenkov/darcula/ui/DarculaToggleButtonUI.java

BIN
build/darcula.jar

Binary file not shown.

2
src/com/bulenkov/darcula/darcula.properties

@ -144,6 +144,8 @@ Button.darcula.selection.color2=233143
Button.darcula.selectedButtonForeground=bbbbbb
Button.darcula.disabledText.shadow=00000000
ToggleButtonUI=com.bulenkov.darcula.ui.DarculaToggleButtonUI
MenuItem.acceleratorForeground=eeeeee
PopupMenu.translucentBackground=3c3f41

6
src/com/bulenkov/darcula/ui/DarculaButtonUI.java

@ -45,11 +45,11 @@ public class DarculaButtonUI extends BasicButtonUI {
final Border border = c.getBorder();
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
final boolean square = isSquare(c);
if (c.isEnabled() && border != null && ((JButton)c).isContentAreaFilled()) {
if (c.isEnabled() && border != null && ((AbstractButton)c).isContentAreaFilled()) {
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() || c instanceof JToggleButton && ((JToggleButton)c).isSelected()) {
((Graphics2D)g).setPaint(new GradientPaint(0, 0, getSelectedButtonColor1(), 0, c.getHeight(), getSelectedButtonColor2()));
}
else {
@ -99,7 +99,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));
}

30
src/com/bulenkov/darcula/ui/DarculaToggleButtonUI.java

@ -0,0 +1,30 @@
/*
* 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.bulenkov.darcula.ui;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
/**
* @author Konstantin Bulenkov
*/
public class DarculaToggleButtonUI extends DarculaButtonUI {
@SuppressWarnings("MethodOverridesStaticMethodOfSuperclass")
public static ComponentUI createUI(JComponent c) {
return new DarculaToggleButtonUI();
}
}
Loading…
Cancel
Save