2

I'm changing the centre area on a Scala Swing Border Panel. The old component disappears, but the new component does not appear, until I resize the window manually with the mouse. I've tried using different components and repainting, but nothing makes the new component appear except manually resizing the window with the mouse.

def splitDisp(mapCanv: VistaIn): Unit =
{
  val canv2 = newMapCanv         
  panel.layout(canv2) = BorderPanel.Position.Center
  canv2.repaint         
  thisScn.repaint //ref to the Frame instance
  panel.repaint 
  thisScn.repaint
  canv2.repaint
}

I'm using 2.10.0M5 in Windows 7.

Rich Oliver
  • 6,001
  • 4
  • 34
  • 57

1 Answers1

3

Try calling revalidate() and then repaint().

Donald.McLean
  • 869
  • 12
  • 18
  • Thanks. Revalidate on the BorderPanel seems sufficient, no need for repaint. I missed the revalidate because I looked in Frame which only has repaint. – Rich Oliver Aug 17 '12 at 19:18