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

nake 2003-01-24 10:27:30
谁能解释一下frame.pack();frame.dispose();frame.repaint()的作用?
...全文
370 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
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
  • 打赏
  • 举报
回复 1
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():重绘

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧