作者TonyQ (骨头)
看板java
标题Re: [问题] 请问Frame关闭的功能
时间Sat Jun 24 22:33:13 2006
※ 引述《PsMonkey (痞子军团团长)》之铭言:
: ※ 引述《Egriawei (断背山狼与羊)》之铭言:
: : 我在一个Frame上
: : 加入了若干元件用来输入帐号密码
: : 输入完毕会传出所需字串去找database
: : 然後这些资料是另外一个主Frame需要的
: : 之後我想让程式自动关闭这个输入帐密的子Frame
: : 请问应该用Frame的什麽方法?Frame方法太多我试了好几个都不对orz
: 基本做法...
: 先 setVisible(false)
: 然後再来把他 set null
: ====
: 是不知道有没有进阶做法啦...
dispose() 是window(frame的父类别)的标准抛去用法
不过我实测过,
对於frame的用处好像也只是serVisible(false)而已
因为我dispose以後再setVisible(true)还是又冒出来了XD
----
public void dispose()
Releases all of the native screen resources used by this
Window, its subcomponents, and all of its owned children. That is, the
resources for these Components will be destroyed, any memory they consume
will be returned to the OS, and they will be marked as undisplayable.
The Window and its subcomponents can be made displayable again by rebuilding
the native resources with a subsequent call to pack or show. The states of
the recreated Window and its subcomponents will be identical to the states of
these objects at the point where the Window was disposed (not accounting for
additional modifications between those actions).
Note: When the last displayable window within the Java virtual machine (VM)
is disposed of, the VM may terminate. See AWT Threading Issues for more
information.
See Also:
Component.isDisplayable(), pack(), show()
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the complier will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.pratice()); | Bone
everything
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.138.240.58