⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blurjbutton.java

📁 oraily的Swing hacks code
💻 JAVA
字号:
import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.awt.image.*;public class BlurJButton extends JButton {    public BlurJButton(String text) {        super(text);    }        public void paintComponent(Graphics g) {        if(isEnabled()) {            super.paintComponent(g);            return;        }                float[] my_kernel = {            0.10f, 0.10f, 0.10f,            0.10f, 0.20f, 0.10f,            0.10f, 0.10f, 0.10f };        ConvolveOp op = new ConvolveOp(new Kernel(3,3, my_kernel));        BufferedImage buf = new BufferedImage(getWidth(),getHeight(),            BufferedImage.TYPE_INT_RGB);        super.paintComponent(buf.getGraphics());        Image img = op.filter(buf,null);        g.drawImage(img,0,0,null);            }    public static void main(String[] args) {        JFrame frame = new JFrame("Blurred Button Hack");        final JButton button = new BlurJButton("A Blurred Button");        JButton control = new JButton("Switch");        control.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent evt) {                button.setEnabled(!button.isEnabled());            }        });                frame.getContentPane().add(button);        frame.getContentPane().add("South",control);        frame.pack();        frame.show();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -