Some things to consider:
Also, your logic won't scale too well as your game grows... Let's say you want 3 images side by side? Or 30? That will lead to a lot of if statements and bounds checking. It would be easier to render all background images in a loop side by side, and use g.translate to scroll. If
any images are < 0 or > screenWidth, push/pop them around the stack as necessary.
I don't have the time to debug your code any further, but I suspect it's a problem with logic or lack of delta values.