specialuibutton.java

来自「Swing Windows XP 外观和感觉 BeanSoft 修改版, 20」· Java 代码 · 共 26 行

JAVA
26
字号
package com.stefankrause.xplookandfeel;

import javax.swing.JButton;
import javax.swing.plaf.ButtonUI;

/**
 * This Button uses the given ButtonUI to paint itself. Useful if a button should have
 * a different look than the standard button. It refuses to change the UI delegate of the button. 
 */
public class SpecialUIButton extends JButton {
    
    ButtonUI myUI;
    
    public SpecialUIButton(ButtonUI ui) {
        this.ui=ui;
        myUI=ui;         
        ui.installUI(this);
    }
    
    /**
     * refuses to change the UI delegate. It keeps the one set in the constructor.
     * @see javax.swing.AbstractButton#setUI(ButtonUI)
     */
    public void setUI(ButtonUI ui) {            
    }       
}

⌨️ 快捷键说明

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