73321

Force repaint after button click

Question:

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) }

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?

Answer1:

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

Recommend

  • Tabbing behavior in WebForms
  • Adding multiple files with JFileChooser
  • How to best utilize Kubernetes/minikube DNS for local development [closed]
  • Display message in a toastr after controller method finish
  • Latency Time in Load Testing
  • How to set imageview over imageview?
  • Arrow is not drawn correctly on fabricJS canvas
  • Code Map Missing in Visual Studio 15 - Preview 4
  • How to generate a SHA256 hash of 32 bytes using nodejs (crypto) in order to avoid bad key size error
  • Creating Neural Network for un-encountered inputs
  • Exception in thread “main” java.awt.AWTError: Assistive Technology not found: com.sun.java.accessibi
  • Define a symbol for an assembly (.s) source file in Android.mk?
  • Open default mail app from within Qt with some html
  • Show QMainwindow in the middle of the screen
  • -(void)viewWillAppear:(BOOL)animated doesn't called
  • Eloquent Javascript: Can't understand how the number value is determined in the sum function
  • Failure to Read Updated AnyLogic DB Values
  • CameraPreviewImageSource empty preview frame
  • Copy Row if Cell Contains X to Different Sheet then delete row.
  • Pass multiple lines of stdin input to interactive Java command line program, non-interactively
  • Implementing type equation generator in OCaml
  • connect.cookieParser and connect.session
  • Threads and Concurrent Modification Exception working with a list
  • can you use embedded ruby in custom javascript files in rails?
  • $this->a->b->c->d calling methods from a superclass in php
  • Validating my form with Jquery
  • Why do you need 2 Javascript files for cross-platform Cordova plugin?
  • What does “T extends Junk” mean in a generic class in Java?
  • How to select multiple items from a List view - JavaFX 8
  • Query takes almost two seconds but matches only two rows - why isn't the index helping?
  • How do I use libcurl to printf a remote FTP directory listing?
  • PHPMailer return to AJAX
  • How to clear a browser cache in Protractor
  • `$http:badreq Bad Request Configuration` - from angular post method, what is wrong here?
  • Call Microservice from another Microservice within Docker
  • PHP Permalinks.. how to change?
  • media foundation H264 decoder not working properly
  • Running R's aov() mixed effects model from Python using rpy2
  • Access to a Matlab gui from the web
  • ReferenceError: TextEncoder is not defined