谁能解释一下frame.pack();frame.dispose();frame.repaint()的作用?

nake 2003-01-24 10:27:30
谁能解释一下frame.pack();frame.dispose();frame.repaint()的作用?
...全文
150 点赞 收藏 8
写回复
8 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
yunshiyu 2003-01-28
lkenshin(我来帮你up)的外语好好呀
羡慕!
回复
smalltalks 2003-01-28
学习
回复
xxycumt 2003-01-28
好!
回复
lkenshin 2003-01-28
yunshiyu(陨石雨)
呵呵,其实是copy java api里面的
回复
coolskeeter 2003-01-28
呵呵:)
回复
iamqqmyheart 2003-01-24
frame.pack():自适应大小
frame.dispose():销毁frame 的全部窗口
frame.repaint():重绘
回复
lkenshin 2003-01-24
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 modifcations between those actions).

public void pack()

Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. If the window and/or its owner are not yet displayable, both are made displayable before calculating the preferred size. The Window will be validated after the preferredSize is calculated.


public void repaint()
Repaints this component.
This method causes a call to this component's update method as soon as possible.


回复
litt 2003-01-24
frame.pack():自适应大小
frame.dispose():销毁
frame.repaint():重绘
回复
发帖
Java SE
创建于2007-09-28

6.1w+

社区成员

Java 2 Standard Edition
申请成为版主
帖子事件
创建了帖子
2003-01-24 10:27
社区公告
暂无公告