开发者

Force repaint after button click

开发者 https://www.devze.com 2022-12-24 06:55 出处:网络
consider this piece of scala swing code de开发者_C百科tail.reactions += { case ButtonClicked(but) =>

consider this piece of scala swing code

de开发者_C百科tail.reactions += {
  case ButtonClicked(but) =>
    detail.contents += new Label(but.text)
    detail.background = new java.awt.Color(0,255,0)
}

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?


In Java, the answer would normally be to call repaint(). Did you try detail.repaint()?

0

精彩评论

暂无评论...
验证码 换一张
取 消