javamacosswing

Java JFrame not refreshed on Mac OSX


I have a Java Application that consists of 2 JFrames. One is used only for a preview and houses a custom JComponent. The other Frame consists of several Input Fields which control the output of the preview.

I have action listeners for the various input fields that force a redraw of the custom JComponent using

previewRenderer.update(previewRenderer.getGraphics());

where the previewRenderer is the custom JComponent on the other JFrame.

This works well on Linux & Windows, however on Mac OSX the 2nd JFrame did not update at all.

I don't have an OSX Machine at hand for testing, but how can I force a redraw of the other Frame, respectively the custom JComponent?

Thanks in advance.


Solution

  • Try changing to

    previewRenderer.repaint()
    

    or maybe even

    previewRenderer.repaint()
    previewRenderer.revalidate()
    

    depending on what changes you are doing in the components of the preview frame.