| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package org.pushingpixels.substance.swingx; |
| 20 |
|
| 21 |
import javax.swing.*; |
| 22 |
import javax.swing.plaf.ComponentUI; |
| 23 |
|
| 24 |
import org.jdesktop.swingx.JXErrorPane; |
| 25 |
import org.jdesktop.swingx.plaf.basic.BasicErrorPaneUI; |
| 26 |
import org.pushingpixels.lafwidget.animation.AnimationConfigurationManager; |
| 27 |
import org.pushingpixels.lafwidget.animation.AnimationFacet; |
| 28 |
import org.pushingpixels.substance.internal.animation.IconGlowTracker; |
| 29 |
import org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities; |
| 30 |
import org.pushingpixels.substance.internal.utils.icon.GlowingIcon; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public class SubstanceErrorPaneUI extends BasicErrorPaneUI { |
| 38 |
protected IconGlowTracker iconGlowTracker; |
| 39 |
|
| 40 |
static { |
| 41 |
AnimationConfigurationManager.getInstance().allowAnimations( |
| 42 |
AnimationFacet.ICON_GLOW, JXErrorPane.class); |
| 43 |
} |
| 44 |
|
| 45 |
public static ComponentUI createUI(JComponent comp) { |
| 46 |
SubstanceCoreUtilities.testComponentCreationThreadingViolation(comp); |
| 47 |
return new SubstanceErrorPaneUI(); |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
@Override |
| 56 |
protected void installComponents() { |
| 57 |
super.installComponents(); |
| 58 |
|
| 59 |
this.errorMessage.setBorder(null); |
| 60 |
this.errorScrollPane.setOpaque(false); |
| 61 |
this.errorScrollPane.getViewport().setOpaque(false); |
| 62 |
|
| 63 |
this.iconGlowTracker = new IconGlowTracker(this.iconLabel); |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
@Override |
| 73 |
protected Icon getDefaultErrorIcon() { |
| 74 |
Icon errorIcon = UIManager.getIcon("OptionPane.errorIcon"); |
| 75 |
return new GlowingIcon(errorIcon, this.iconGlowTracker); |
| 76 |
} |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
@Override |
| 85 |
protected Icon getDefaultWarningIcon() { |
| 86 |
Icon errorIcon = UIManager.getIcon("OptionPane.warningIcon"); |
| 87 |
return new GlowingIcon(errorIcon, this.iconGlowTracker); |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
@Override |
| 96 |
protected void reinit() { |
| 97 |
super.reinit(); |
| 98 |
|
| 99 |
if (this.iconLabel.getIcon() != null) { |
| 100 |
this.iconGlowTracker.play(3); |
| 101 |
} |
| 102 |
} |
| 103 |
} |