按下按钮后强制重画 [英] Force repaint after button click

查看:115
本文介绍了按下按钮后强制重画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑这个scala swing代码

consider this piece of scala swing code

detail.reactions += {
  case ButtonClicked(but) =>
    detail.contents += new Label(but.text)
    detail.background = new java.awt.Color(0,255,0)
}


细节 FlowPanel 类型。
当单击按钮时,颜色立即重画,但标签不是。当我点击该区域时它会显示。

the detail is of FlowPanel type. When the button is clicked, the color is instantly repainted, but the Label is not. It gets visible as I click the area. How can I force the detail to repaint its contents after a click?

推荐答案

这篇关于按下按钮后强制重画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆