当前位置: 首页>>代码示例>>Java>>正文


Java Frame.addWindowListener方法代码示例

本文整理汇总了Java中java.awt.Frame.addWindowListener方法的典型用法代码示例。如果您正苦于以下问题:Java Frame.addWindowListener方法的具体用法?Java Frame.addWindowListener怎么用?Java Frame.addWindowListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Frame的用法示例。


在下文中一共展示了Frame.addWindowListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Picking

import java.awt.Frame; //导入方法依赖的package包/类
Picking()
{
  Frame frame = new Frame("Picking Example");
  GLCapabilities capabilities = new GLCapabilities(null);
  GLCanvas drawable = new GLCanvas(capabilities);
  final Renderer renderer = new Renderer();
  drawable.addGLEventListener(renderer);
  drawable.addMouseListener(renderer);
  drawable.addMouseMotionListener(renderer);
  frame.add(drawable);
  frame.setSize(400, 400);
  final Animator animator = new Animator(drawable);
  frame.addWindowListener(new WindowAdapter()
    {
      public void windowClosing(WindowEvent e) 
      {
        animator.stop();
        System.exit(0);
      }
    });
  frame.setVisible(true);
  animator.start();	
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:24,代码来源:Picking.java

示例2: executeTest

import java.awt.Frame; //导入方法依赖的package包/类
private void executeTest() {

        GraphicsDevice defDev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        int x = 0;
        Frame f = null;
        for (x = 0; x < gd.length; x ++) {
            if (gd[x] != defDev) {
                secFrame = new Frame("Screen " + x + " - secondary", gd[x].getDefaultConfiguration());
                f = secFrame;
            } else {
                primaryFrame = new Frame("Screen " + x + " - primary", gd[x].getDefaultConfiguration());
                f = primaryFrame;
            }
            Button b = new Button("Print");
            b.addActionListener(this);
            f.add("South", b);
            f.addWindowListener (new WindowAdapter() {
                public void windowClosing(WindowEvent we) {
                    ((Window) we.getSource()).dispose();
                }
            });
            f.setSize(200, 200);
            f.setVisible(true);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:MultiMonPrintDlgTest.java

示例3: Unit

import java.awt.Frame; //导入方法依赖的package包/类
public Unit(){
    getBestSize();

    net = new Net(new int[]{4,5,4}, true);
    graph = new TimeGraph(net,0,GAME_HEIGHT-200,GAME_WIDTH, 200, "errorRate");

    frame = new Frame();
    canvas = new Canvas();

    canvas.setPreferredSize(new Dimension(canvasWidth, canvasHeight));
    canvas.addKeyListener(new InputHandler());
    canvas.addMouseListener(new InputHandler());
    canvas.addMouseMotionListener(new InputHandler());

    frame.add(canvas);

    frame.pack();
    frame.setResizable(false);
    frame.setLocationRelativeTo(null);

    frame.addWindowListener(new WindowAdapter(){
        @Override
        public void windowClosing(WindowEvent e){
            Test.quit(net);
        }
    });

    frame.setVisible(true);
    gc = canvas.getGraphicsConfiguration();
    vImage = gc.createCompatibleVolatileImage(GAME_WIDTH, GAME_HEIGHT);

}
 
开发者ID:dstallenberg,项目名称:SimpleRecurrentNetwork,代码行数:33,代码来源:Unit.java

示例4: Unit

import java.awt.Frame; //导入方法依赖的package包/类
public Unit(){
    getBestSize();

    net = new Net(new int[]{2,5,2});
    graph = new TimeGraph(net,0,GAME_HEIGHT-200,GAME_WIDTH, 200, "errorRate");

    frame = new Frame();
    canvas = new Canvas();

    canvas.setPreferredSize(new Dimension(canvasWidth, canvasHeight));
    canvas.addKeyListener(new InputHandler());
    canvas.addMouseListener(new InputHandler());
    canvas.addMouseMotionListener(new InputHandler());

    frame.add(canvas);

    frame.pack();
    frame.setResizable(false);
    frame.setLocationRelativeTo(null);

    frame.addWindowListener(new WindowAdapter(){
        @Override
        public void windowClosing(WindowEvent e){
            Test.quit(net);
        }
    });

    frame.setVisible(true);
    gc = canvas.getGraphicsConfiguration();
    vImage = gc.createCompatibleVolatileImage(GAME_WIDTH, GAME_HEIGHT);

}
 
开发者ID:dstallenberg,项目名称:NormalFeedForwardNeuralNet,代码行数:33,代码来源:Unit.java

示例5: main

import java.awt.Frame; //导入方法依赖的package包/类
/**
 * Method declaration
 *
 *
 * @param arg
 */
public static void main(String arg[]) {

    fMain = new Frame("Query Tool");

    QueryTool q = new QueryTool();

    q.bApplication = true;

    for (int i = 0; i < arg.length; i++) {
        String p = arg[i];

        if (p.equals("-?")) {
            printHelp();
        }

        if (p.charAt(0) == '-') {
            pProperties.put(p.substring(1), arg[i + 1]);

            i++;
        }
    }

    q.init();
    q.start();
    fMain.add("Center", q);

    MenuBar menu = new MenuBar();
    Menu    file = new Menu("File");

    file.add("Exit");
    file.addActionListener(q);
    menu.add(file);
    fMain.setMenuBar(menu);
    fMain.setSize(500, 400);
    fMain.show();
    fMain.addWindowListener(q);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:44,代码来源:QueryTool.java

示例6: main

import java.awt.Frame; //导入方法依赖的package包/类
/**
 * Method declaration
 *
 *
 * @param arg
 */
public static void main(String[] arg) {

    fMain = new Frame("Query Tool");

    QueryTool q = new QueryTool();

    q.bApplication = true;

    for (int i = 0; i < arg.length; i++) {
        String p = arg[i];

        if (p.equals("-?")) {
            printHelp();
        }

        if (p.charAt(0) == '-') {
            pProperties.put(p.substring(1), arg[i + 1]);

            i++;
        }
    }

    q.init();
    q.start();
    fMain.add("Center", q);

    MenuBar menu = new MenuBar();
    Menu    file = new Menu("File");

    file.add("Exit");
    file.addActionListener(q);
    menu.add(file);
    fMain.setMenuBar(menu);
    fMain.setSize(500, 400);
    fMain.show();
    fMain.addWindowListener(q);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:44,代码来源:QueryTool.java


注:本文中的java.awt.Frame.addWindowListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。