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

📄 button.java

📁 定要上载质量高而定要上载质量高而定要上载质量高而定要上载质量高而定要上载质量高而
💻 JAVA
字号:
/*
 * Created on Mar 1, 2005
 */
package org.flexdock.view;

import javax.swing.Action;
import javax.swing.ButtonModel;
import javax.swing.JToggleButton;
import javax.swing.SwingUtilities;

import org.flexdock.plaf.PlafManager;
import org.flexdock.view.model.ViewButtonModel;

/**
 * @author Christopher Butler
 */
public class Button extends JToggleButton {

  public static final String uiClassID = "Flexdock.titlebar.button";
	
	public Button(Action action) {
		setAction(action);
		setModel(new ViewButtonModel());
	}
	
	public void setModel(ButtonModel newModel) {
		ButtonModel oldModel = getModel();
		if(newModel!=null && oldModel!=null)
			newModel.setSelected(oldModel.isSelected());
		super.setModel(newModel);
	}
	
    public void updateUI() {             
        setUI(PlafManager.getUI(this));
    }

    public String getUIClassID()
    {
      return uiClassID;
    }
    
	public View getView() {
		return (View)SwingUtilities.getAncestorOfClass(View.class, this);
	}
	
	public String getActionName() {
		Action action = getAction();
		if(action==null)
			return null;
		return (String)action.getValue(Action.NAME);
	}
}

⌨️ 快捷键说明

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