guiaction.java
来自「Petri网分析工具PIPE is open-source」· Java 代码 · 共 54 行
JAVA
54 行
/* * Created on 07-Mar-2004 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */package pipe.gui;import java.io.File;import javax.swing.AbstractAction;import javax.swing.ImageIcon;import javax.swing.KeyStroke;/** * GuiAction class * @author Maxim and others * * Handles loading icon based on action name and setting up other stuff * * Toggleable actions store the toggle state in a way that allows ChangeListeners * to be notified of changes */abstract class GuiAction extends AbstractAction { GuiAction (String name, String tooltip, String keystroke) { super(name); String iconFileName = CreateGui.imgPath+name+ ".png"; if(new File(iconFileName).exists()) putValue(SMALL_ICON, new ImageIcon(iconFileName)); if(tooltip != null) putValue(SHORT_DESCRIPTION, tooltip); if(keystroke != null) putValue(ACCELERATOR_KEY,KeyStroke.getKeyStroke(keystroke)); } GuiAction (String name, String tooltip, String keystroke, boolean toggleable) { this(name,tooltip,keystroke); this.putValue("selected",new Boolean(false)); } public boolean isSelected() { Boolean b=(Boolean)getValue("selected"); if(b!=null) return b.booleanValue(); return false; // default } public void setSelected(boolean selected) { Boolean b=(Boolean)getValue("selected"); if(b!=null) { this.putValue("selected",null); this.putValue("selected",new Boolean(selected)); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?