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

📄 editweightaction.java

📁 Petri网分析工具PIPE is open-source
💻 JAVA
字号:
package pipe.gui;import java.awt.Container;import java.awt.event.ActionEvent;import javax.swing.AbstractAction;import javax.swing.JOptionPane;import pipe.dataLayer.Arc;//import pipe.dataLayer.ArrowLabel;public class EditWeightAction extends AbstractAction{  private String label;  private Container contentPane;  private Arc myArc;  public EditWeightAction(Container contentPane, Arc a){    this.contentPane = contentPane;    myArc = a;  }  public void actionPerformed(ActionEvent e){    int currentWeighting = myArc.getWeight();    String input = JOptionPane.showInputDialog("Weighting:", String.valueOf(currentWeighting));    try {      int newWeighting = Integer.parseInt(input);      if(newWeighting < 1)        JOptionPane.showMessageDialog(contentPane, "Weighting cannot be less than 1.  Please re-enter");      else        myArc.setWeight(newWeighting);    } catch(Exception exc){      if(input!=null)        JOptionPane.showMessageDialog(contentPane, "Please enter a number.", "Invalid entry", JOptionPane.ERROR_MESSAGE);      System.err.println(exc.toString());    }  }}

⌨️ 快捷键说明

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