📄 kunststoffarrowbutton.java
字号:
/** Copyright (c) 2003 Martin Newstead (mseries@brundell.fsnet.co.uk). All Rights Reserved.** The author makes no representations or warranties about the suitability of the* software, either express or implied, including but not limited to the* implied warranties of merchantability, fitness for a particular* purpose, or non-infringement. The author shall not be liable for any damages* suffered by licensee as a result of using, modifying or distributing* this software or its derivatives.** The author requests that he be notified of any application, applet, or other binary that* makes use of this code and that some acknowedgement is given. Comments, questions and* requests for change will be welcomed.** Created on 07-Mar-2004 at 12:53:29 by martin*/package mseries.plaf.Kunststoff;import com.incors.plaf.kunststoff.KunststoffLookAndFeel;import com.incors.plaf.kunststoff.KunststoffUtilities;import javax.swing.*;import java.awt.*;import mseries.plaf.Metal.MetalArrowButton;public class KunststoffArrowButton extends MetalArrowButton{ public KunststoffArrowButton(int direction) { super(direction); setRequestFocusEnabled(false); setDirection(direction); } public void paint(Graphics g) { super.paint(g); int w, h, size; Color origColor; boolean isEnabled; w = getSize().width; h = getSize().height; origColor = g.getColor(); isEnabled = isEnabled(); // paint upper gradient Color colorReflection = KunststoffLookAndFeel.getComponentGradientColorReflection(); if (colorReflection != null) { Color colorReflectionFaded = KunststoffUtilities.getTranslucentColor(colorReflection, 0); Rectangle rect = new Rectangle(0, 0, w, h / 2); KunststoffUtilities.drawGradient(g, colorReflection, colorReflectionFaded, rect, true); } // paint lower gradient Color colorShadow = KunststoffLookAndFeel.getComponentGradientColorShadow(); if (colorShadow != null) { Color colorShadowFaded = KunststoffUtilities.getTranslucentColor(colorShadow, 0); Rectangle rect = new Rectangle(0, h / 2, w, h / 2); KunststoffUtilities.drawGradient(g, colorShadowFaded, colorShadow, rect, true); } // Draw the arrow size = Math.min((h - 4) / 3, (w - 4) / 3); size = Math.max(size, 2) + 2; paintTriangle(g, (w - size) / 2, (h - size) / 2, size, direction, isEnabled); // Reset the Graphics back to it's original settings g.setColor(origColor); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -