?? toolaction.java
字號:
package com.sunking.tp.tool;import javax.swing.*;import java.beans.*;import java.awt.event.*;import com.sunking.tp.tool.*;import com.sunking.tp.framework.*;/** * * <p>Title: </p> * <p>Description: 工具動作</p> * <p>Copyright: Copyright (c) 2003</p> * <p>Company: </p> * @author <a href="mailto:sunkingxie@hotmail.com">SunKing</a> * @version 1.0 */public class ToolAction extends AbstractAction implements PropertyChangeListener{ Desktop desk; Tool tool; /** * * @param desk * @param tool */ public ToolAction(Desktop desk,Tool tool) { this.desk = desk; this.tool = tool; init(tool); tool.addPropertyChangeListener(this); } void init(Tool tool){ putValue(Action.NAME,tool.getLabel()); putValue(Action.SHORT_DESCRIPTION,tool.getToolTip()); putValue(Action.SMALL_ICON,tool.getIcon()); setEnabled(tool.isEnabled()); } public void actionPerformed(ActionEvent e) { desk.setTool(tool); } /** *屬性改變 * @param e */ public void propertyChange(PropertyChangeEvent e){ String property = e.getPropertyName(); Object newValue = e.getNewValue(); if(property.equals(Tool.ENABLED_PROPERTY)){ if(!newValue.equals(Tool.NULL_VALUE)){ setEnabled(((Boolean)newValue).booleanValue()); } }else if(property.equals(Tool.ICON_PROPERTY)){ if(!newValue.equals(Tool.NULL_VALUE)){ putValue(Action.SMALL_ICON,(Icon)e.getNewValue()); }else{ putValue(Action.SMALL_ICON,null); } }else if(property.equals(Tool.LABEL_PROPERTY)){ if(!newValue.equals(Tool.NULL_VALUE)){ putValue(Action.NAME,e.getNewValue().toString()); }else{ putValue(Action.NAME,null); } }else if(property.equals(Tool.TOOLTIP_PROPERTY)){ if(!newValue.equals(Tool.NULL_VALUE)){ putValue(Action.SHORT_DESCRIPTION,e.getNewValue().toString()); }else{ putValue(Action.SHORT_DESCRIPTION,null); } }else if(property.equals(Tool.SELECT_PROPERTY)){ } }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -