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

📄 custommenuitemui.java

📁 oraily的Swing hacks code
💻 JAVA
字号:
import java.awt.*;import java.awt.image.*;import javax.swing.*;import javax.swing.plaf.*;import javax.swing.plaf.metal.*;import javax.swing.plaf.basic.*;public class CustomMenuItemUI extends BasicMenuItemUI {    public static ComponentUI createUI(JComponent c) {        return new CustomMenuItemUI();    }        public void paint(Graphics g, JComponent comp) {        // paint to the buffered image        BufferedImage bufimg = new BufferedImage(comp.getWidth(),comp.getHeight(),            BufferedImage.TYPE_INT_ARGB);        Graphics2D g2 = bufimg.createGraphics();                // restore the foreground color in case the super class needs it        g2.setColor(g.getColor());        super.paint(g2,comp);        // do an alpha composite        Graphics2D gx = (Graphics2D) g;        gx.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.8f));        gx.drawImage(bufimg,0,0,null);    }    }

⌨️ 快捷键说明

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