This commit is contained in:
honfika@gmail.com
2015-04-18 20:45:29 +02:00
parent 5e6d59a5a8
commit fdbffc4a43
11 changed files with 158 additions and 166 deletions

View File

@@ -16,7 +16,6 @@
*/
package com.jpexs.decompiler.flash.gui;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
@@ -62,6 +61,7 @@ public class MyRibbonApplicationMenuButtonUI extends BasicRibbonApplicationMenuB
private MyResizableIcon clickIcon = null;
private MyResizableIcon normalIcon = null;
private MyResizableIcon clearIcon = null;
private final boolean buttonResized = false;
@@ -70,89 +70,88 @@ public class MyRibbonApplicationMenuButtonUI extends BasicRibbonApplicationMenuB
return clickIcon;
}
public static MyResizableIcon[] getIcons(){
public static MyResizableIcon[] getIcons() {
MyResizableIcon clearIcon = View.getMyResizableIcon("buttonicon_clear_256");
return new MyResizableIcon[]{
clearIcon,
//normal
new MyResizableIcon(clearIcon.originalImage) {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(new RadialGradientPaint(getIconWidth() / 2, getIconHeight() / 2, getIconWidth() / 2, new float[]{0.32f, 0.84f, 1f}, new Color[]{
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.HIGHLIGHT, ComponentState.ENABLED).shiftBackground(Color.white, 0.5).getUltraLightColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getMidColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED).getUltraDarkColor()
}, MultipleGradientPaint.CycleMethod.NO_CYCLE));
Shape s = new Ellipse2D.Double(x, y, getIconWidth(), getIconHeight());
g2.fill(s);
g2.setPaint(SubstanceLookAndFeel.getCurrentSkin().getEnabledColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE).getMidColor());
super.paintIcon(c, g, x, y);
}
},
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(new RadialGradientPaint(getIconWidth() / 2, getIconHeight() / 2, getIconWidth() / 2, new float[]{0.32f, 0.84f, 1f}, new Color[]{
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.HIGHLIGHT, ComponentState.ENABLED).shiftBackground(Color.white, 0.5).getUltraLightColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ENABLED).getMidColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED).getUltraDarkColor()
}, MultipleGradientPaint.CycleMethod.NO_CYCLE));
Shape s = new Ellipse2D.Double(x, y, getIconWidth(), getIconHeight());
g2.fill(s);
g2.setPaint(SubstanceLookAndFeel.getCurrentSkin().getEnabledColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE).getMidColor());
super.paintIcon(c, g, x, y);
}
},
//hover
new MyResizableIcon(clearIcon.originalImage) {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(new RadialGradientPaint(getIconWidth() / 2, getIconHeight() / 2, getIconWidth() / 2, new float[]{0.32f, 0.84f, 1f}, new Color[]{
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.HIGHLIGHT, ComponentState.ROLLOVER_UNSELECTED)/*.shiftBackground(Color.white, 0.8)*/.getUltraLightColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_UNSELECTED).getMidColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.BORDER, ComponentState.ROLLOVER_UNSELECTED)/*.shiftBackground(new Color(0x7c, 0x7c, 0x7c), 0.8)*/.getUltraDarkColor()
}, MultipleGradientPaint.CycleMethod.NO_CYCLE));
Shape s = new Ellipse2D.Double(x, y, getIconWidth(), getIconHeight());
g2.fill(s);
super.paintIcon(c, g, x, y);
}
},
//click
new MyResizableIcon(clearIcon.originalImage) {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(new RadialGradientPaint(getIconWidth() / 2, getIconHeight() / 2, getIconWidth() / 2, new float[]{0.32f, 0.84f, 1f}, new Color[]{
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.HIGHLIGHT, ComponentState.ROLLOVER_UNSELECTED)/*.shiftBackground(Color.white, 0.8)*/.getUltraLightColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_UNSELECTED).getMidColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.BORDER, ComponentState.ROLLOVER_UNSELECTED)/*.shiftBackground(new Color(0x7c, 0x7c, 0x7c), 0.8)*/.getUltraDarkColor()
}, MultipleGradientPaint.CycleMethod.NO_CYCLE));
Shape s = new Ellipse2D.Double(x, y, getIconWidth(), getIconHeight());
g2.fill(s);
super.paintIcon(c, g, x, y);
}
},
//click
new MyResizableIcon(clearIcon.originalImage) {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(new RadialGradientPaint(getIconWidth() / 2, getIconHeight() / 2, getIconWidth() / 2, new float[]{0.2f, 0.5f, 0.8f}, new Color[]{
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getUltraLightColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getMidColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).shiftBackground(Color.black, 0.7).getUltraDarkColor()
}, MultipleGradientPaint.CycleMethod.NO_CYCLE));
Shape s = new Ellipse2D.Double(x, y, getIconWidth(), getIconHeight());
g2.fill(s);
AffineTransform origt = g2.getTransform();
AffineTransform t = (AffineTransform) origt.clone();
t.translate(-getIconWidth() / 2, -getIconHeight() / 2);
t.scale(0.8, 0.8);
t.translate(getIconWidth() / 2 + getIconWidth() / 4, getIconHeight() / 2 + getIconHeight() / 4);
g2.setTransform(t);
g2.setPaint(Color.BLACK);
super.paintIcon(c, g, x, y);
g2.setTransform(origt);
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setPaint(new RadialGradientPaint(getIconWidth() / 2, getIconHeight() / 2, getIconWidth() / 2, new float[]{0.2f, 0.5f, 0.8f}, new Color[]{
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getUltraLightColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).getMidColor(),
SubstanceLookAndFeel.getCurrentSkin().getColorScheme(DecorationAreaType.SECONDARY_TITLE_PANE, ColorSchemeAssociationKind.FILL, ComponentState.ROLLOVER_SELECTED).shiftBackground(Color.black, 0.7).getUltraDarkColor()
}, MultipleGradientPaint.CycleMethod.NO_CYCLE));
Shape s = new Ellipse2D.Double(x, y, getIconWidth(), getIconHeight());
g2.fill(s);
AffineTransform origt = g2.getTransform();
AffineTransform t = (AffineTransform) origt.clone();
t.translate(-getIconWidth() / 2, -getIconHeight() / 2);
t.scale(0.8, 0.8);
t.translate(getIconWidth() / 2 + getIconWidth() / 4, getIconHeight() / 2 + getIconHeight() / 4);
g2.setTransform(t);
g2.setPaint(Color.BLACK);
super.paintIcon(c, g, x, y);
g2.setTransform(origt);
}
}
}
};
}
public MyRibbonApplicationMenuButtonUI() {
super();
MyResizableIcon[] icons=getIcons();
MyResizableIcon[] icons = getIcons();
clearIcon = icons[0];
normalIcon = icons[1];
hoverIcon = icons[2];
clickIcon = icons[3];
}
/**