Try filling it with a transparent color before drawing the text.
Type: Posts; User: Norm
Try filling it with a transparent color before drawing the text.
If the images are displayed in the same area of the GUI, the top/upper layers need to have transparent backgrounds so the images displayed first will show through the later ones.
If you have an image (the bottom layer) and draw a String on that image, then the resultant image will have the original image with a String drawn on it.
Can you explain what the problem is? I executed the last version: after a mouse event, a line of text was drawn. ????
The posted code looks like it has a lot more lines of code than are needed for what you are trying to test. Can you make a smaller, simpler program that shows the problem?
What is supposed to happen when the code is executed?
I used my images. When I click on the frame it displays:vone large image in the middle, two much smaller images in lower left and lower right...
Can you post the code in a small, complete program that compiles, executes and shows the problem.
The steps:
1) create a BufferedImage
2) get a graphics for that BI
3) use that graphics to draw on that image
4) draw that image on the GUI using the graphics passed to the paintComponent() method
Its the other way. You create BufferedImage and get a Graphics object that goes with it that can be used to draw on that BufferedImage. Use the graphcs object given to the component to drawn that...
Create a BufferedImage, get its graphics, draw on it and then draw that image on the screen.
Some of the Swing classes have a way of using layers:
How to Use Layered Panes (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
To save old drawings when a component...
Can you explain what "individual layers" are? If you were using pencil and paper to make a drawing, what would be a layer?
Resizing the component will remove what was drawn before.
Can you explain what the problem is? What does the code do or not do when it is executed?