本文整理汇总了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();
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}