home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.metal;
-
- import com.sun.java.swing.AbstractButton;
- import com.sun.java.swing.ButtonModel;
- import com.sun.java.swing.Icon;
- import com.sun.java.swing.JComponent;
- import com.sun.java.swing.SwingUtilities;
- import com.sun.java.swing.UIManager;
- import com.sun.java.swing.plaf.ComponentUI;
- import com.sun.java.swing.plaf.basic.BasicGraphicsUtils;
- import com.sun.java.swing.plaf.basic.BasicRadioButtonUI;
- import com.sun.java.swing.plaf.basic.BasicToggleButtonUI;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Rectangle;
-
- public class MetalRadioButtonUI extends BasicRadioButtonUI {
- private static final MetalRadioButtonUI metalRadioButtonUI = new MetalRadioButtonUI();
- protected ButtonModel model;
- // $FF: renamed from: f java.awt.Font
- Font field_0;
- // $FF: renamed from: fm java.awt.FontMetrics
- FontMetrics field_1;
- Rectangle viewRect;
- Rectangle iconRect;
- Rectangle textRect;
- Icon altIcon;
- Icon selectedIcon;
- Icon disabledIcon;
-
- public static ComponentUI createUI(JComponent var0) {
- return metalRadioButtonUI;
- }
-
- public synchronized void paint(Graphics var1, JComponent var2) {
- AbstractButton var3 = (AbstractButton)var2;
- this.model = var3.getModel();
- Dimension var4 = ((Component)var2).getSize();
- this.field_0 = ((Component)var2).getFont();
- var1.setFont(this.field_0);
- this.field_1 = var1.getFontMetrics();
- this.viewRect = new Rectangle(var4);
- this.iconRect = new Rectangle();
- this.textRect = new Rectangle();
- this.altIcon = var3.getIcon();
- this.selectedIcon = null;
- this.disabledIcon = null;
- String var5 = SwingUtilities.layoutCompoundLabel(this.field_1, var3.getText(), this.altIcon != null ? this.altIcon : super.icon, var3.getVerticalAlignment(), var3.getHorizontalAlignment(), var3.getVerticalTextPosition(), var3.getHorizontalTextPosition(), this.viewRect, this.iconRect, this.textRect, ((BasicToggleButtonUI)this).getDefaultTextIconGap(var3));
- if (var2.isOpaque()) {
- var1.setColor(((Component)var3).getBackground());
- var1.fillRect(0, 0, var4.width, var4.height);
- }
-
- if (this.altIcon != null) {
- if (!this.model.isEnabled()) {
- this.altIcon = var3.getDisabledIcon();
- } else if (this.model.isPressed() && this.model.isArmed()) {
- this.altIcon = var3.getPressedIcon();
- if (this.altIcon == null) {
- this.altIcon = var3.getSelectedIcon();
- }
- } else if (this.model.isSelected()) {
- this.altIcon = var3.getSelectedIcon();
- } else if (var3.isRolloverEnabled() && this.model.isRollover()) {
- this.altIcon = var3.getRolloverIcon();
- }
-
- if (this.altIcon == null) {
- this.altIcon = var3.getIcon();
- }
-
- this.altIcon.paintIcon(var2, var1, this.iconRect.x, this.iconRect.y);
- } else {
- super.icon.paintIcon(var2, var1, this.iconRect.x, this.iconRect.y);
- }
-
- if (var5 != null) {
- if (this.model.isEnabled()) {
- var1.setColor(((Component)var3).getForeground());
- BasicGraphicsUtils.drawString(var1, var5, this.model.getMnemonic(), this.textRect.x, this.textRect.y + this.field_1.getAscent());
- } else {
- var1.setColor(((Component)var3).getBackground().darker());
- BasicGraphicsUtils.drawString(var1, var5, this.model.getMnemonic(), this.textRect.x, this.textRect.y + this.field_1.getAscent());
- }
-
- if (((JComponent)var3).hasFocus() && var3.isFocusPainted() && this.textRect.width > 0 && this.textRect.height > 0) {
- this.paintFocus(var1, this.textRect, var4);
- }
- }
-
- }
-
- protected void paintFocus(Graphics var1, Rectangle var2, Dimension var3) {
- var1.setColor(UIManager.getColor("RadioButton.focus"));
- var1.drawRect(var2.x, var2.y - 1, var2.width + 1, var2.height + 1);
- }
- }
-