I am using a splash screen at the start of my program:
It is simply a small image with the name of the software. I want to include a variable tagline underneath the software logo (e.g. an image of the windows logo with text below reading "Crushing competition since 1983" or something like that). This tag line will be randomly selected at runtime. I would prefer not to have to generate multiple images, since that will take up a lot of memory. How can I do this? Can I overlay a transparent slpash screen with the text? Can I add text to the image dynamically? Can I embed the image in a headless window and overlay a glass pane with text? Any other ideas? --Mark
I think what you can do is override the paintComponent method of your Window or Panel (depending on where you want your image). Then, when you add your JLabel it will display on top of your image. And you can dynamically choose your JLabel text at runtime if you wish.
Something like that for the overridden painComponent method. Where yourImage is an Image object. Hope that helps.
This depends on the JCSplashScreen class... is this your class, do you have the source, can you extend it? If any of these are the case, either modify or extend the class to allow you to set a String and also modify the paintComponent() method to draw a string over the image using the drawString() method of Graphics.
Even if you don't have the code to the class, and can't override it, you can make a BufferedImage of your image and draw the string on that, then send the buffered image to the splash screen class.
If you need any help on either of these approaches, just post your questions!
Write once, run anywhere, because there's nowhere to hide! - /. A.C.