simdialog.java

来自「一个小型网络仿真器的实现」· Java 代码 · 共 50 行

JAVA
50
字号
/*
   JaNetSim  ---  Java Network Simulator
   -------------------------------------

   This software was developed at the Network Research Lab, Faculty of
   Computer Science and Information Technology (FCSIT), University of Malaya.
   This software may be used and distributed freely. FCSIT assumes no responsibility
   whatsoever for its use by other parties, and makes no guarantees, expressed or
   implied, about its quality, reliability, or any other characteristic.

   We would appreciate acknowledgement if the software is used.

   FCSIT ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION AND
   DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING
   FROM THE USE OF THIS SOFTWARE.
*/

package janetsim;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class SimDialog extends JDialog {
  protected Sim theSim=null; 
  protected SimGUI theGUI=null;

  //overrider MUST call this constructor passing all 4 parameters here
  public SimDialog(JFrame aFrame,String name,Sim aSim,SimGUI aGUI) {
    super(aFrame,name);

    theSim=aSim;
    theGUI=aGUI;

    addWindowListener(new WindowAdapter() {
        public void windowClosed(WindowEvent e) {
          theGUI.removeCustomDialog(me());
        }
      });
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    theGUI.addCustomDialog(this);
  }
  private final SimDialog me() { return this; }
  
  public void componentsChanged() {}
  public void connectionsChanged() {}
  public void GUIChanged() {}
}

⌨️ 快捷键说明

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