So i have created a jscrollpane with a panel with an image as the background, it updates and changes the image size, but does upon an event trigger it reverts back to the original image size!, how do i stop this?, have i got the inheritance correct!? have i got the object hireachy right!?
What does a user do with the program to see the problem?
When I used it I got this error:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
It looks the the program should check for input before trying to parse empty input.
I don't know about inheritance and object hierarchy -- but they shouldn't have anything to do with drawing a background image anyway. You might want to have a look at our FAQ entry on just that topic: Background Image On JPanel, because it's a lot simpler than what you're trying to do there and from what you say, it's more reliable.
So i have created a jscrollpane with a panel with an image as the background
So what's with all the code? Post a proper SSCCE when you ask a question.
To test how to use a panel with an image all you need is a frame with the scroll pane, panel and image.
Get a simple version working first before trying to use it in your real program.
There are many things wrong with the code:
1. Variable names should NOT start with an upper case character
2. Method names should NOT start with an upper case character
3. Don't use static variables.
4. Don't use static methods
5. Don't use getGraphics() to do custom painting.
I suggest you start by reading the Swing tutorial on Custom Painting. The tutorial examples will show you how to:
1. do custom painting by overriding the paintComponent() method of a JPanel
2. better structure your code so you don't have static variables and methods (except for the initials creation of the frame)
I mean i have solved my problem, and as for Oracle documents, the basic stuff is good, because the examples are basic, but when going into advanced issues, the surround the example code with heaps of other code, camouflaging it!