Okay, I have a Jpanel which is shown as white in the below image using an overlay layout. It holds a ScrollPane holding an image (“No Image Available”) and a JButton (“Comment”).

I want to position this button in the bottom right hand corner of the JPanel. I have tried multiple layout approaches and I cant seem to get it to work. At most the button moves about 3/4 of the way South-East and I have no idea why.
Any help is greatly appreciated..
There are a lot of possible solutions using different layout managers. I don’t know the OverlayLayout, but I like WindowBuilder Pro (free): https://developers.google.com/java-dev-tools/wbpro/ for help with Swing design.
Using it, I wrote a SpringLayout implementation of your question (SpringLayout seems like a pain to deal with without a GUI-builder).
Here’s a picture of the code running:
You can see the button (mine, not the picture of yours…) is floating above the scroll-pane in the bottom. We could adjust the margins above so the button wasn’t floating on top of the scroll-bars, but this is just to show you where it is on the z-axis.