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

📄 labelaction.java

📁 Petri网分析工具PIPE is open-source
💻 JAVA
字号:
package pipe.gui;import java.awt.Component;import java.awt.Container;import java.awt.event.ActionEvent;import javax.swing.AbstractAction;import javax.swing.JOptionPane;import pipe.dataLayer.PetriNetObject;/** * Action object that can be used to effect labelling a component. */public class LabelAction extends AbstractAction {  private String label;  private Container contentPane;  private PetriNetObject selected;  public LabelAction(Container contentPane, Component component) {    this.contentPane = contentPane;    selected = (PetriNetObject)component;  }  /** Prompts the user for a label */  public void actionPerformed(ActionEvent e) {    // this isn't quite working to plan- might have to extend the bounds of the component for the text to bet visible, but this might adversely effect the arc snapping which may use the getBounds method    String text = "";    String currentName = selected.getName();    if ((currentName != null) && (currentName.length() > 0))      text = currentName;    String input = JOptionPane.showInputDialog("Edit label", text);    if (input != null)    	selected.setName(input);  }}

⌨️ 快捷键说明

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