|
|
|
@ -1,13 +1,11 @@
|
|
|
|
|
package com.fr.design.gui.icheckbox; |
|
|
|
|
|
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
|
import com.fine.theme.icon.LazyIcon; |
|
|
|
|
import com.fr.design.event.GlobalNameListener; |
|
|
|
|
import com.fr.design.event.GlobalNameObserver; |
|
|
|
|
import com.fr.design.event.UIObserver; |
|
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
|
|
import com.fr.design.gui.core.UITextComponent; |
|
|
|
|
import com.fr.design.utils.gui.GUIPaintUtils; |
|
|
|
|
import com.fr.stable.Constants; |
|
|
|
|
import sun.swing.SwingUtilities2; |
|
|
|
|
|
|
|
|
|
import javax.swing.AbstractButton; |
|
|
|
@ -144,7 +142,7 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
|
|
|
|
|
* |
|
|
|
|
* @return UICheckBoxUI |
|
|
|
|
*/ |
|
|
|
|
public UICheckBoxUI getUICheckBoxUI(){ |
|
|
|
|
public UICheckBoxUI getUICheckBoxUI() { |
|
|
|
|
return new UICheckBoxUI(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -176,28 +174,15 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
|
|
|
|
|
b.getVerticalTextPosition(), b.getHorizontalTextPosition(), |
|
|
|
|
viewRect, iconRect, textRect, b.getIconTextGap()); |
|
|
|
|
|
|
|
|
|
// fill background
|
|
|
|
|
if (c.isOpaque()) { |
|
|
|
|
g.setColor(b.getBackground()); |
|
|
|
|
g.fillRect(0, 0, size.width, size.height); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
|
|
|
|
if (model.isSelected()) { |
|
|
|
|
GUIPaintUtils.fillPaint(g2d, iconRect.x, iconRect.y, iconRect.width, iconRect.height, false, Constants.NULL, |
|
|
|
|
model.isEnabled() ? UIConstants.CHECKBOX_HOVER_SELECTED : UIConstants.DISABLED_ICON_COLOR, 0); |
|
|
|
|
} else if (model.isRollover() && !model.isSelected()) { |
|
|
|
|
g.setColor(UIConstants.CHECKBOX_HOVER_SELECTED); |
|
|
|
|
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC); |
|
|
|
|
new LazyIcon("checkbox_checked").paintIcon(c, g, iconRect.x, iconRect.y); |
|
|
|
|
} else if (model.isRollover()) { |
|
|
|
|
new LazyIcon("checkbox_hovered").paintIcon(c, g, iconRect.x, iconRect.y); |
|
|
|
|
} else { |
|
|
|
|
g.setColor(UIConstants.LINE_COLOR); |
|
|
|
|
g2d.drawRoundRect(iconRect.x, iconRect.y, iconRect.width - 1, iconRect.height - 1, UIConstants.ARC, UIConstants.ARC); |
|
|
|
|
new LazyIcon("checkbox_unchecked").paintIcon(c, g, iconRect.x, iconRect.y); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (model.isSelected()) { |
|
|
|
|
UIConstants.YES_ICON.paintIcon(c, g, iconRect.x + 2, iconRect.y + 2); |
|
|
|
|
} |
|
|
|
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); |
|
|
|
|
|
|
|
|
|
// Draw the Text
|
|
|
|
|