Visual artefacts when changing to full screen

Hello,

In my app I have a simple button that resizes with the screen.
On the component constructor I have fixed sized with

button.setSize(150, 30); 

On the component resized function I call the following so it sits right on the bottom right corner.

button.setCentrePosition(getBounds().getWidth() - button.getWidth()/2 - offset, 
        getBounds().getHeight() - button.getHeight()/2 - offset);

The problem is: when I press full-screen and while the window is resizing the button goes veeery big for a very short period of time and then resizes to the correct position. I’m assuming this is because setting to full-screen resizes first on one direction and then the other.

Alt Text

Has anyone else found this? any solution?

I don’t know what you want to achieve. But the common way to do such things is to use button. setBounds(x, y, width, height) in the resized() function of your parent. You can Just use getWidth() and getHeigth() if you want to know the new size of your parent window and easily calculate the position and size of your button.

I don’t think so. Setting the bounds is one action.
I think there is a backing mechanism at work. Either your project is using setBufferedToImage(true) somewhere, which results in scaling the image before resized() and a subsequent paint() is executed.
Or that could even be an optimisation of the OS a layer below.

Thanks for the reply!
Hmmmm… I’m not setting setBufferedToImage(true)… I tried to set it to false and still get the artefact.

Also… run it on a mac and it looks fine, it’s a way smoother transition. So it might be just an OS problem.