Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java IDE » Eclipse  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Eclipse3.2中如何关闭frame窗口
helloyxw





发贴: 2
积分: 0
于 2008-02-20 01:22 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在Eclipse中写了一段代码,运行后出现一个窗口,如何关闭这个窗口呢?谢谢高人指点.
import java.awt.*;
public class MyFrame {

  /**
   * @param args
   */
  
  public static void main(String[] args) {
    Frame f = new Frame("yxw");
    f.setSize(600, 400);
    f.setLocation(100, 100);
    f.setBackground(Color.blue);
    f.show();
  }

}



作者 Re:Eclipse3.2中如何关闭frame窗口 [Re:helloyxw]
jeff_jian





发贴: 2
积分: 0
于 2008-02-25 12:56 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
给f添加个事件监听器,还有建议不要用show()方法,改用setVisible(boolean);
代码如下:

import java.awt.Color;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class tmp {

  /**
   * @param args
   */

  public static void main(String[] args) {
    Frame f = new Frame("yxw");
    f.setSize(600, 400);
    f.setLocation(100, 100);
    f.setBackground(Color.blue);
    f.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    });
    f.setVisible(true);
    // f.show();
  }

}



作者 Re:Eclipse3.2中如何关闭frame窗口 [Re:helloyxw]
Joffeec





发贴: 47
积分: 3
于 2008-05-28 10:27 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在Eclipse3.2的控制台窗口中,点击右上角的红色方块就行了。


作者 Re:Eclipse3.2中如何关闭frame窗口 [Re:Joffeec]
JiafanZhou



版主


发贴: 736
积分: 61
于 2008-05-30 17:36 user profilesend a private message to usersend email to JiafanZhousearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Joffeec wrote:
在Eclipse3.2的控制台窗口中,点击右上角的红色方块就行了。

haha... this is totally a hacking method.



When I was a kid I used to pray every night for a new bike. Then I realized that The Lord doesn't work that way, so I stole one and asked him to forgive me.
作者 Re:Eclipse3.2中如何关闭frame窗口 [Re:helloyxw]
黑骏马





发贴: 14
积分: 0
于 2008-06-28 10:14 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
添加个事件监听器,不要用show()方法,另外,把引入的接口写的简练点。
import java.awt.*;
import java.awt.event.*;
public class MyFrame {
public static void main(String[] args) {
Frame f = new Frame("yxw");
f.setSize(600, 400);
f.setLocation(100, 100);
f.setBackground(Color.blue);
f.setVisible(true);
f.addWindowListener(new WindowAdapter()
{
  public void windowClosing(WindowEvent e)
  {
    System.exit(0);
  }
});
}
}



作者 Re:Eclipse3.2中如何关闭frame窗口 [Re:HenryShanley]
Joffeec





发贴: 47
积分: 3
于 2008-07-01 07:55 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Joffeec wrote:
在Eclipse3.2的控制台窗口中,点击右上角的红色方块就行了。


HenryShanley wrote:
haha... this is totally a hacking method.


呵呵………对于还没有学到事件处理的,这样做是没有办法中的办法……




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923