Can anyone suggest me a simple way to add a background image to JFrame ?

I want to add a background image to JFrame in a simple way rather than overiding the paint method or paintComponent method. Just like adding an image to JButton or JLabel using two or three lines of code. Is it possible ? r there any methods for this purpose ? if so pls give the code.

JFrame as such does not provide an option to set a background image.
Extending JPanel, over-riding its paintComponent() and setting it as the contentPane of JFrame is one way of doing it. Though you have to do the overriding, it is not very complex though.

Similar Messages

  • What is the Proper Way to place a Background Image inside a Div?

    I have been searching Google and the Adobe forums for awhile now, and while there are very valid solutions to similar problems I found that none of them fixed the problem that I am facing. I blame myself and getting lost in this sloppy coding of mine, so part of my plan was to start my style sheet over from scratch.
    My question, what is the proper way to add a background image into a div? I currently have the top div following the "header" css style, here is what I have typed into that sections:
    <style type="text/css">
    @import url("../twoColLiqLtHdr.css");
    .header {
        width: 1000px;
        height: 300px;
        background-image: url(Assets/HeaderTemplate.png);
        background-repeat: no-repeat;
        background-position: center;
    The problem here is that the background image isn't even appearing. I would greatly appreciate any help, could anyone inform me on the proper way to doing this so that I can implement images in divs in the future without turning my coding in a down right mess?
    Thank you in advance.

    I apologize, I'm unable to post a link to the page just yet. This is a snip of coding for a website still in the making for the company I work for.
    Would any of the coding below help?:
    </script>
    <style type="text/css">
    <!--
    body {
        background-color: #760101;
    a:link {
        color: #FFF;
    a:visited {
        color: #690;
    .twoColLiqLtHdr #header table tr td {
        color: #400000;
        text-align: right;
    -->
    </style>
    <link href="../twoColLiqLtHdr.css" rel="stylesheet" type="text/css" />
    </head>
    <header class="twoColLiqLtHdr">
    <scmenu class="twoColLiqLtHdr">
    <tab class="twoColLiqLtHdr">
    <body class="twoColLiqLtHdr">
    <div class="header" align="" id="header">Content Goes Here</div>
    <div class="scmenu" align="" id="scmenu">Content Goes Here</div>
    <div class="tabs" align="" id="tabs">Content Goes Here</div>
    <div class="body" align="" id="body">Content Goes Here</div>
    <div class="footer" align="" id="footer">Content Goes Here</div>
    <script type="text/javascript">var TFN='';var TFA='';var TFI='0';var TFL='0';var tf_RetServer="rt.trafficfacts.com";var tf_SiteId="11773g197b36be92cde14c11fc77dacc3a2a4f1660eb17h9";var tf_ScrServer=document.location.protocol+"//rt.trafficfacts.com/tf.php?k=11773g197b36be92c de14c11fc77dacc3a2a4f1660eb17h9;c=s;v=5";document.write(unescape('%3Cscript type="text/JavaScript" src="'+tf_ScrServer+'">%3C/script>'));</script>
    </body>
    </html>
    That above is parts I added into the source code.

  • Can anyone suggest a simple system for backing up my MacBook?

    I have a MacBook 120G which runs Tiger. I also have an Aiport Extreme, which is connected to a printer via USB. I want to buy an external hard drive to create a safety back up of my whole system. I have been trawling the suppliers' websites, getting more and more confused. Can anyone suggest the simplest solution for a simple-minded user like me? These are my main confusions:
    a) Can anyone suggest what type / make of hard drive I should buy in order to be able to store my computer's contents and re-boot it in the event of disaster? Will a non-powered hard drive do the job or is it somehow better to get a powered one? It would sit near my desk so I am keen to avoid fan noise if at all possible! I believe I'll need to 'partition' the drive in order to make it bootable, or something - if this is correct, what kind of hard drive is easiest and idiotproof for this?
    b) I think I've concluded it's not worth binning my Airport Extreme and replacing it with a Time Capsule. But is it worth buying Leopard in order to get Time Machine? I believe I can still use the Airport Extreme to connect to the hard drive so that Time Machine would make backups regularly and wirelessly? If so, do I need to use a USB hub from the Airport Extreme so that I can still keep the printer connected? I can only find one HD which has a built in hub - the Iomega Minimax - but I have read reviews saying the fan is noisy. Any other suggestions?
    Any help and suggestions about this would be very gratefully received. Many thanks
    Steve

    Leopard is a nice upgrade (if your computer has 2GB of memory) and TimeMachine is convenient but it isn't the only way to create a reliable and simple backup system. If you decide TM is your solution buy a drive that has 2 to 3 times as much space as you are using on your computer now. If you are using 80GB of your drive now, buy a 160GB to 240GB drive for TimeMachine. It keeps multiple backups and eats up drive space pretty quickly.
    Lots of good backup programs exist but the one I really like is called SuperDuper! It will create an exact duplicate of your hard drive and you can set up a schedule so that automatically backs up new and modified files at specific times/days. With my MacBook I connect it to my external drive on Friday evening and let SuperDuper! do its work overnight. If you chose this router or another that doesn't use TimeMachine, get a drive at least as large as your computer's hard drive.
    The Western Digital MyBook series is a good choice and so is the Seagate FreeAgent series. I'd avoid self powered external drives like Western Digital's Passport series unless you intend to travel with the drive. They require special proprietary cables to power the drive which are easy to lose and expensive to replace, among other things. If you can afford a firewire drive that's generally preferable because firewire is faster than USB but the speed difference isn't blazing. If you do you backing up over night speed won't be an issue.
    Whether you use TimeMachine or another program, this is just once phase of a backup plan. If you experience a break-in, fire, or flood the backup drive is probably going to experience the same fate as your computer. You also need to think about taking a backup of your most important files off-site. This can be as simple as once a month burning a DVD of your documents, digital photos, and email to a DVD and taking it to work.

  • I have just updated my software on my iPhone 4S to IOS7.0.4 now I have lost many of my contacts.   Can anyone suggest an easy way to reinstate them.  (Without having to add them all again as I don't know what I have lost until I need it).

    I have just updated my software on my iPhone 4S to IOS7.0.4 now I have lost many of my contacts.   Can anyone suggest an easy way to reinstate them.  (Without having to add them all again as I don't know what I have lost until I need it).

    Try assigning Queen as the Album Artist on the compilations in iTunes on your computer.

  • Iphone 5 froxen on home screen, wont let me swipe.  tried home and sleep/wake botton to no avail still locked.  went to restore using itunes but dont want to loose photos on phone.  can anyone suggest a way to get photos before i restore

    iphone 5 frozen on home screen, wont let me swipe.  tried home and sleep/wake botton to no avail still locked.  went to restore using itunes but dont want to loose photos on phone.  can anyone suggest a way to get photos before i restore

    try moisturising your finger a bit if the skin is too dry it can give problems

  • Can anyone suggest a app or programme for creating a simple text based logo with a font I already own?

    Hi.
    I run my own company and would like to create my own simple text based logo using a font I've downloaded. Can anyone suggest an app or programme that will be simple enough for a dunce like me to create vectored graphics and reliable enough to create something professional and usable, please?
    Thanks.

    I believe if you copy the font into the font folder, any application should be able to use that font.

  • I need to throw an error message if the terms&conditions checkbox is not checked on click of Submit Button. Can anyone suggest.

    I need to throw an error message if the terms&conditions checkbox is not checked on click of Submit Button in webdynpro java. Can anyone suggest.

    My Apologies. The simplest way- write the following code in the action of the Submit button-
    if (<check box not checked>)
    wdComponentAPI.getMessageManager().reportException("Please accept Terms and Conditions to continue",false);
    else
         continueExecution();
    The exception message will be shown on top of the view.
    You may like to use Message Area UI element and place it at the bottom of the WD4J view to show our exception message at the bottom of the view.
    I hope this helps !
    Cheers,
    -Amol Gupta

  • Can anyone suggest a windows XP emulator that runs on OS 10.6 on my iMac?

    It would seem a simple request but I cannot find, and maybe it is me being a Mac-dufus, an emulator, that runs on my mac, such that I can run a 32 bit windows XP software application.   
    Can anyone suggest a solution?  thanks

    Sincerely, thanks for the amazingly quick reply/post.
    FYI - VMware fusion only works with 10.7 and higher, Virtualbox is clunky and I think you need a compute science degree to operate it.
    New virtual machine when I tried to ijnstall the trail version offers a migrate from PC or install windows from a DVD or image.......and I don't ewant to do that, I just want to run an emulator, install 2 XP 32 bit applications and be able to run them in the emulator is all.    AM I missing something?   thanks again for any help in advance

  • Can anyone suggest a good iTunes library Browser [Other than iTunes]

    Can anyone suggest a good iTunes library Browser [Other than iTunes]that wouldlet me compare the data [music] thats in my PC's itunes library to whats allready on my iPod. Any suggestions please?
    thanks!
    Intel Piii   Windows XP Pro  

    I use Do It by Jim McGowan. it is simple and really good.

  • Can anyone suggest a free fast VPN connection

    Can anyone suggest a free fast VPN connection.
    i want to access streaming video (ie hulu.com)that is blocked in canada. Hotspot Shield works but is way too slow and I get stuttering and frozen video.
    Any suggestions would be appreciated
    Thanks in advance
    Dave

    Fast and free? I'm surprised you can even find slow and free. I use StrongVPN. It is fast, but it isn't free at $15/month.

  • My iPad was logging me out so I have reset it - I cannot log into iCloud now and also my login for app updates defaults to an incorrect email address can anyone suggest how to re configure

    My iPad was logging me out so I have reset it - it retained all apps but I cannot now log into iCloud and when downloading apps it defaults to the wrong email details so the iPad doesn't recognise it to update - can anyone suggest how to resolve this

    Have you attempted to access your Apple ID through iforgot.apple.com ?
    If you have access to the internet, you should be able to go through the process of resetting your Apple ID password via security questions or email.
    Assuming that you use the same Apple ID for iCloud and the iTunes/App Stores, resetting your password may help you log back into iCloud and the iTunes/App Stores.

  • I'm travelling and trying to back up my new iPhone to iCloud. I have sufficient storage, am connected to wifi and it's plugged into a power source and yet it doesn't seem to work. Can anyone suggest what I'm doing wrong?

    I'm travelling and trying to back up my new iPhone to iCloud. I have sufficient storage, am connected to wifi and it's plugged into a power source and yet it doesn't seem to work at all. I'm currently in India. Could that be the cause or can anyone suggest any reason why this wouldn't work?

    "gets stuck" - are there any error messages?
    If you get the error "Backup not successful" and you've tried deleting the last backup and trying to back up manually without luck, try the following test:   Go to...
    Settings>iCloud>Storage & Backup>manage Storage, tap your device name in the Backups section, then look under Backup options.  Turn off all apps from backup and then do a manual backup.  If that doesn't work, then this post will not help.  If the backup works, then go back to the app list and turn some on and try another backup.  If successful, keep repeating these steps.  If it fails at some point, then try to zero in on the one app that seems to make the backup fail.  (I had this problem and found one app failing, probably due to a corrupt data file.)
    This process will take time, but if a backup works with no app data being used but clearly fails with the original settings, then somewhere in the mix of apps is a "bad" one.

  • HP deskjet 3520 ink cartridge problem...​Can anyone suggest another make of printer that is not HP?

    Hello...I have yet to receive an answer that resolves the problem. I regret buying the printer because now it doesn't work. The error message remains despite taking advice how to fix it. 
    We only use the black cartridge.
    Can anyone suggest another make of printer that is not HP?
    Thanks in advance. I am in the UK and need to print urgently.
    This question was solved.
    View Solution.

    Hello...problem resolved...many thanks.

  • My computer is shutting down before fully booting up.  I am running the disk utilities program and have this message: Error: Disk Utility can't repair this disk . . . disk, and restore your backed-up files.  Can anyone suggest what I should do next?

    My computer is shutting down before fully booting up.  I am running the disk utilities program and have this message: Error: Disk Utility can't repair this disk . . . disk, and restore your backed-up files.  Can anyone suggest what I should do next?

    So, you can't Install OSX to the external?
    Or you can't boot from it when you do?
    You're not the only one wondering... I'm reminded of the Goose that laid the Golden Egg story.

  • I stream Internet radio from my iPad air to Bluetooth speaker.  Can anyone suggest the best EQ app to use to enhance the sound.  Thanks

    I stream Internet raidiot from iPad air to Bluetooth speakers.  Can anyone suggest the best EQ app to use to enhance the sound.
    THanks

    Yeah, I know I can restore it, but I might as well go ahead and try. I just finished a backup for icloud and itunes to make sure, I'll go ahead and restore it and set it up as new and see how that works. Seems like I have no other options at this point, I'd still like to know what they did with the Download tab in itunes store, if they removed it or if I'm just overlooking it.

Maybe you are looking for