Why there are nothing after I used drawImage()?

Hello guys, I got a problem in drawImage(), and hoping that sombody can help me out.
The code blew is copied from a Java book, it can run in my computer, without any error message, but why the image "mypc01_64.png" can not be drawn on the JPanel?
package TwoD;
import java.awt.*;
import javax.swing.*;
* @author Jack
public class DisplayImage extends JFrame{
    /** Creates a new instance of DisplayImage */
    public DisplayImage() {
        add(new ImageCanvas());
     * @param args the command line arguments
    public static void main(String[] args) {
        // TODO code application logic here
        JFrame frame = new DisplayImage();
        frame.setTitle("DisplayDemo");
        frame.setSize(300,300);
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);       
class ImageCanvas extends JPanel{
    ImageIcon imageIcon = new ImageIcon("/TwoD/mypc01_64.png");
    Image image = imageIcon.getImage();
    public void paintComponent(Graphics g){
        super.paintComponent(g);
        if(image!=null){
            g.drawImage(image,0,0,getWidth(), getHeight(), this);
}the source code and the image are in the same folder named "TwoD".

hi,
the same code is just working fine with me. i have just changes the image to a physical image that is present in my machine, and i have tried with absolute path. make sure you can see the image. it has got something. i have tried with Sunset.jpg provided with xp.
ImageIcon     imageIcon     = new ImageIcon("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Sunset.jpg");regards
Aniruddha

Similar Messages

  • I bought a new ipad3 packed but after opening its box there are no headsets in it and iphone headsets wont work with iphone so is it normal I mean why there are no heas sets with ipad3 ?

    I bought a new ipad3 packed but after opening its box there are no headsets in it and iphone headsets wont work with iphone so is it normal I mean why there are no heas sets with ipad3 ?

    Headsets don't come with the iPad. All you get is the iPad, USB cable and wall charger.
    Since you're new to iPad ...
    You can download a complete iPad User Guide here: http://manuals.info.apple.com/en/ipad_user_guide.pdf
    Also, Good Instructions http://www.tcgeeks.com/how-to-use-ipad-2/
    Apple - iPad - Guided Tours
    http://www.apple.com/ipad/videos/
    Watch the videos see all the amazing iPad apps in action. Learn how to use FaceTime, Mail, Safari, Videos, Maps, iBooks, App Store, and more.
    How to - Articles & User Guides & Tutorials
    http://www.iphone-mac.com/index.php/Index/howto/id/4/type/select
    iPad How-Tos  http://ipod.about.com/lr/ipad_how-tos/903396/1/
    You can download this guide to your iPad.
    iPad User Guide for iOS 5
    http://itunes.apple.com/us/book/ipad-user-guide-for-ios-5/id470308101?mt=11
     Cheers, Tom

  • When I go into Libary in Encore CS6 there are nothing in it. How can I get it to Work?

    When I go into Libary in Encore CS6 there are nothing in it. How can I get it to Work?
    Operating System: Windows 7
    Has it ever worked? No If so, what's changed? : Nothing
    Recent System Hardware or Software change?: No

    Pasting the Content from the above link :
    Issue
    When you access the Library panel in Adobe Encore, the panel contains no content. Additionally, there is no subfolder named Library within the Adobe Encore application folder on your hard disk.
    When you access the title templates in Adobe Premiere Pro, the title templates are missing.
    When you access the template projects in After Effects, the template projects are missing.
    To the topSolution: Install the CS6 Functional Content
    Creative Cloud and disc product customersDownload and install the functional content for Adobe Premiere Pro and Encore.
    After Effects template projects were migrated to the After Effects Exchange.
    Adobe Premiere Pro and Encore Functional Content is available here:
    Mac OS (1.1 GB)
    Windows (734 MB)Installation instructionsMac OS
    Double-click the .dmg file to mount a disk image containing the installers.
    Choose to install Encore, or Adobe Premiere Pro functional content, or both packages. Open the folder for each package and locate the installer.
    Run "Install.app" to begin the installation process.
    After installing the first package of functional content, the installer ejects the disk image. Remount the disk image to run the second installer.
    Windows
    Note:If you installed the previous functional content packages, it's possible that you have Templates and Textures folders in the Program Files\Adobe\Adobe Premiere Pro CS6\Presets folder. Delete these folders before installing.
    Extract the contents of the downloaded zip file to a convenient location (for example, the Desktop).
    Run the .exe file to create install folders for the Encore and Adobe Premiere functional content installers.
    Navigate to the folder for the content you want to install and execute the installer.
    Electronic Software Delivery (ESD) customers only
    Download and install functional content for Encore, After Effects, and Adobe Premiere Pro. Note: Skip steps 1-6 if you have already downloaded functional content for Encore, After Effects, and Adobe Premiere Pro.
    In a web browser, go to www.adobe.com/membership.
    Sign in with your Adobe ID and password.
    Click View Order History.
    Look at the row with your order number and click Download.
    On the download page, look at the row with the description for function content. For example, for CS5, look for “Adobe Premiere Pro CS5: Download contains additional ReadMe files plus content (menus, buttons, and backgrounds) for Adobe Encore CS5.”
    Download this content using Akamai Download Manager or Alternate Download Method.
    Close Encore and Adobe Premiere Pro.
    (Mac OS) Double-click the .dmg file that you downloaded. On the Adobe Premiere Pro CS5 Content disk image, open the Encore Functional Content folder. Double-click Setup.
    (Windows) There are two files that you downloaded (for CS5, these files are PremierePro_5_Content_LS7.exe and PremierePro_5_Content_LS7.7z). Double-click the.exe file to extract the folders and files. Browse to the Encore functional content folder within the extracted folders. Double-click Setup. Following are detailed steps for Windows: 
    Go to the folder where you have downloaded files from the download page. For example, Desktop\Premiere. 
    Double-click PremierePro_5_Content_LS7.exe. The installation files are extracted to a folder named Adobe CS5. For example, Desktop\Adobe CS5.
    Go to the Adobe CS5\Premiere Pro Family Content Installers\Adobe Encore CS5 Functional Content folder.
    Double-click Set-up.exe. Installation starts. Follow the instructions to complete installation.
    To the topAdditional solution: Install the Resource Central library content
    Download the extra library content
    Choose your language to begin the download:
    English French German Japanese Italian Spanish Korean
    Extract the Library content to the Library folder
    Extract the zip file that you just downloaded to create a .7z file (for example, en-US.7z).
    Extract the .7z file to any convenient location (for example, the Desktop). This step creates a folder based on the language you selected.
    7-zip for Windows (available for download at http://www.7-zip.org/download.html)
    The Unarchiver for Mac OS (available for download at http://wakaba.c3.cx/s/apps/unarchiver.html)
    Copy the contents of the language folder (for example, en-US) to the following location:Windows: C:/Program Files/Adobe/Adobe Encore CS6/
    Mac OS: Applications/Adobe Encore CS6/
    If you choose a custom Library folder location other than the default location, launch Adobe Encore and browse to your custom Library folder location.Windows: Edit > Preferences > MediaMac OS: Encore > Preferences > Media

  • Why there are overloaded create methods in Statful bean?

    Hi all,
    I have a question ...!
    Why there are overloaded create methods for Statefule beans? and why not for Stateless bean?
    because any way these create methods are for giving referneces of EJB objects.hence, what is use of overloaded methods in stateful bean?
    Thanks in advance.
    Regards,
    Rahul

    Hi Rahul,
    Each stateful session bean is tied to a particular client. That means whatever state is passed in during create() is guaranteed
    to be available on subsequent invocations. Allowing multiple create methods is a convenience.
    For stateless session beans there is no prescribed relationship between the caller and which bean instance is used to handle
    an invocation. It wouldn't make sense to allow creation parameters since there would be no guarantee that a subsequent
    invocation is handled by an instance containing that particular initialization state.
    All of this only applies to the EJB 2.1 and earlier API. Starting in EJB 3.0, there are no longer explicit create() methods.
    As you've seen there isn't any benefit to having them in the stateless case. For stateful session beans in EJB 3.0, the
    developer can perform initialization by just declaring a particular business method and calling that after first acquiring a
    new stateful session bean reference.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Why there are no layout in number 3.0 ????????

    why there are no layout in number 3.0 ????????
    I need to export the number file to PDF file , I don't want all of the pages are together , I need to seperate the pages in PDF file , I need the PDF file with layout function , just like previous version .
    why are this useful function missing in new version ????????????????????????????????????????????????????????????

    All we know here is that the new version of Numbers is significantly different than the old version of Numbers. We didn't write the specifucation nor do we know what the objectives were for the redesign, other than Apple's stated desire to make the three platform versions of Numbers as compatible as possible across platforms. That's the best "why" we can give you.
    Thanks for using only one exclamation point in your last post.
    Jerry

  • Why there are differences in error table definitions?

    Why there are differences in error table definitions?
    We are using OWB repository 10.2.0.3.0 and OWB client 10.2.0.3.33. The Oracle version is 10 G (10.2.0.3.0). OWB is installed on Linux.
    I created a error table using DBMS_ERRLOG.CREATE_ERROR_LOG in databse.
    Here is the layout.
    =========
    ORA_ERR_NUMBER$
    ORA_ERR_MESG$
    ORA_ERR_ROWID$
    ORA_ERR_OPTYP$
    ORA_ERR_TAG$
    PROJECT_ID
    DESCRIPTION
    PROJECT_TYPE
    CREATION_DATE
    ===========
    I imported the table metadata into OWB. As I used the table in mapping using table operator, I am not able to see ERR group in table object of mapping.
    How do we bring manually created error table metadata into OWB? Is it feasible?
    I specified data rule/shadow table for imported table using object editor. I deployed the table via CC.
    Here is the layout from deployed ERROR table from DB
    +++++++++++++
    ORA_ERR_NUMBER$
    ORA_ERR_MESG$
    ORA_ERR_ROWID$
    ORA_ERR_OPTYP$
    ORA_ERR_TAG$
    ERR$$$_AUDIT_RUN_ID
    ERR$$$_AUDIT_DETAIL_ID
    ERR$$$_ERROR_ID
    ERR$$$_ERROR_REASON
    ERR$$$_SEVERITY
    ERR$$$_OPERATOR_NAME
    ERR$$$_ERROR_OBJECT_NAME
    PROJECT_ID
    DESCRIPTION
    PROJECT_TYPE
    CREATION_DATE
    ++++++++++++
    Why there are differences in error table definitions?
    As I used the table in mapping using table operator, I am not able to see ORA_ERR_NUMBER$ , ORA_ERR_MESG$ , ORA_ERR_ROWID$ , ORA_ERR_OPTYP$ , ORA_ERR_TAG$ in ERR group in table object of mapping.
    Are there any additional steps/process?
    Any idea ?
    Thanks in advance.
    RI

    There are columns for data rule errors (logical errors) and DML errors (physical errors), I think you probably have data rules on the table..?
    To process DML errors you will have to add the error table into a map you may have to reverse engineer it). The error group behavior is only available for processing errors from tables with data rules. Ensure your table operator is synchronized with your design table.
    http://blogs.oracle.com/warehousebuilder/newsItems/viewFullItem$184
    Cheers
    David

  • Why there are big differences in the prices of spare parts (hinge) ..?? particular egypt ibm

    I have Lenovo 3000 N200 0769 with problem in left hinge lcd , the number of it i think (41W5214) 15.4 lcd.
    lenove egypt (IBM) was told to me cost 100 $ but in Many sites (hinge) cost betwen 19 $ , 30$ , 80 $
    i want to understand why there are a big difference betwen prices , and why the ibm egypt is  Highest price...!!!
    i was asked  ibm egypt can replace (Repair) it , if I bought one by my self from internet , but refuse my Request and told to me you must bought it from egypt ibm !!!
    thank you 

    it`s hinge!!!! just Metal hinge !!??
    not hardware like ram or H.d or vga.....etc
    original or not it`s nothing important like other hardware must be original
    if you see the hinge pic (41W5214) you will know what i mean about 80$ differences in the prices
    and
    why lenovo Egypt refuse my Request to replace (Repair) it , if I bought one by my self ??
    the answer is Forced to purchase an Expensive one from lenovo Egypt "kind of business" and customers not important to agree or disagree
    I hope Lenovo tighten the control of the Egypt Branch, with some simplification
    Message Edited by sadzaglol on 03-07-2009 06:40 AM
     I hope Lenovo tighten the control of the Egypt Branch, with some simplification
    Message Edited by sadzaglol on 03-07-2009 06:41 AM

  • Why there are no choices of none in payment info?

    In payment info why there are only 3choices visa, mastercard, and amex? what if i already don't have a credit card. How can i choose none if  it is not in the choices? I cannot download free games because need to verify my credit card account. Which i already don't have it. Pls help.

    You can create an iTune and App Store account without credit card details
    1. Sign out of current Apple ID if you are sign-in to one (important)
    2. Go to App Store and select a free app
    3. Tap INSTALL APP
    4. Create New Apple ID
    5. Confirm Your Country
    6. Agree with Terms and Conditions
    7. Fill in your Apple ID and Password (you must create a new Apple ID; don't use your old Apple ID)
    8. Create and answer your secret question
    9. Select NONE for Payment Method
    10. Fill in Billing Address
    11. Submit application for new Apple ID
    12. Wait for verification email
    13. When email arrive, verify your account
    14. Start downloading your free apps

  • Why there are two IMG steps provided for Home Page configuration?

    Dear experts,
    I wonder why there are two IMG steps provided for configuring ESS home page.
    1. Cross Application Components --> Employee Self Service --> General Settings
    2. Personnel Management --> Employee Self-Service --> General Settings
    Both tables contents are also similar.
    Why SAP has provided same configuration steps in two areas?

    Your first one is wrong. It is under Cross App. Components but not in an ESS node....I am sure it is a typo on your part. Anyways......
    It's NOT two steps. It's just the same configuration in two places. It makes it easier to locate for instance if you are in ESS to just have it there. BUT the Homepage Framework is used elsewhere (MSS for example) as well as you can use it for whatever else you like (building an easier interface for other things) therefore, it has it's "true" place up as a "cross application component".
    This is very similar to say Benefits. If you look under the Benefits config area in the IMG, you will actually see a lot of ESS settings there that are the exact same ones you see under the ESS node too.
    Don't let it confuse you.

  • Why there are restrictions on EJB, but not on Servlet?

    Hi,
    There are some restrictions on EJB, for example,
    * use the java.lang.reflect Java Reflection API to access information.
    * listen on, accept connections on, or multicast from a network socket
    * define a class in a package
    But I can not find similar restrictions for Servlet. Why?

    I understand why there are restrictions for EJB, for example:
    * For security: it does not allow "java.lang.reflect Java Reflection API"
    * For thread management: user thread in not allowed.
    * For portability from machine to machine: file system access is not allowed.
    The same issues exist for servlet. But no restrictions.

  • Anyone knows how to get the photos after IMG_9999 from iphone? :-(ps:... i got them all in my camera roll but when i connected to the computer there's nothing after IMG_9999..

    anyone knows how to get the photos after IMG_9999 from iphone? :-(ps:... i got them all in my camera roll but when i connected to the computer there's nothing after IMG_9999.. many thanks :-)

    They show in the camera roll, just not your computer?
    Have you checked every folder that is in the DCIM folder?

  • Why there are N169.3 things when i right click my desktop ?

    i think my macbook pro is having an error. this morning, when i right click on my desktop and then there are "new folder", "get info", "change desktop background", "N169.3", "N148", "N35". Why there are those N-number words? and also I can't open some of the applications that i downloaded before. do anyone knows why?

    yeah i am having the same problem!!!!!!! its really annoying just done a software update and its done nothig either!
    sounds like we arent the only tho.
    might be just one of thos glitches in the software that has activated at a certain time!
    im running snow leopard?
    also my skype has been down for about a week now wont let me open it at all so messed up.
    i hope they read this and fix it soon

  • Does anyone know why there are no football apps for the iPhone for 2011

    does anyone know why there are no football apprs for the iphone for 2011
    I had apps last year for NFL schedules and also for college
    can't find even one this year
    anybody know

    If this is true, then it is because no one is making these apps.
    Why else would it be?

  • Why there are no books for sale in iBooks?

    Hej,
    I just want to ask everyone why there are no books for sale in iBooks in Sweden. I mean this is really disappointing because I want to buy and read new books and there are no books for sale. If anyone has an answer to my query please reply. Thank you

    It's unfortunately an issue of sorting out all of the legalities for apple to sell books in your country and unfortunately haven't been able to do that for Sweeden as of yet. And so your iBooks store will only have the out of copyright (or free) books available for download. I can only assume apple is working to bring the bookstore to more countries, if you really need books you can make iTunes account for a different country but to do so you would need either a credit card or an iTunes gift card from that country.
    Otherwise hold tight till they open they iBook store in your country

  • TS1367 Is there are a way to use my imac as a display for my macbook pro? I have a thunderbolt cable but it doesnt seem to do anything

    Is there are a way to use my imac as a display for my macbook pro? I have a thunderbolt cable but it doesnt seem to do anything

    Hello eassic,
    Thanks for the question, and welcome to Apple Support Communities.
    It sounds like Target Display Mode may be what you are looking for:
    Target Display Mode lets you use a Mac as the external display for another “primary” Mac. In some cases, you can also play the sound from your primary Mac on the speakers of the external Mac. For example, a MacBook Pro could use a 27-inch iMac as the display and play its audio on the iMac as well.
    OS X Mountain Lion: Use another Mac as a display
    http://support.apple.com/kb/PH11302
    Use an iMac with Thunderbolt as a display
    If you have an iMac with Thunderbolt, any other Mac with Thunderbolt can use it as a display. The iMac will play both the video and audio from the other Mac.
    1. Connect the Thunderbolt cable to the Thunderbolt ports on each computer.
    2. Make sure both Mac computers are turned on and awake.
    3. Press Command (⌘)-F2 on the keyboard of the external display Mac.
    4. If you want the external display Mac to play audio as well as video from the primary Mac, choose Apple menu > System Preferences, click Sound, and then click Output. Select the external display Mac from the list of devices.
    Thanks,
    Matt M.

Maybe you are looking for

  • IPhoto Libary cannot be open

    I have recently returned from a trip and tried to organise my photos in order to publish, print, etc. My MBP has a 256Gb SSD and the MacOS partition is pretty small (dumb choice from me, I know) so I created a new library on the NTFS partition. After

  • ECC PR's header level attachment transfer

    Dear Experts, We are on SRM 7.0 SP10 , currently using ECS with PDP scenario and for transfer of PR's using BBP_EXTREQ_TRANSFER report. However found issue with the header level attachments transfer's since Purchase requistions have Header but not Sh

  • Inspection plan not found

    Hi, no inspection plan is found for inspection lots created with origin 04 or 08; but they are found for 89. I already checked: - task list usage assigned to i type in customizing - material set up for 08 and 04 with i plans - validity date changed i

  • Permissions Change on startup normal or wrong?

    Hello MacPeople... I've had a battle with Tiger after I loaded it a few months ago. To make this short, I ultimately found ONE bad block with TT 4.5.2., erased, zeroed the internal drive, cloned back from my FW. Now all seems hunky-dorey.... Here's t

  • After Effects CS5 rendering with 48 cores and 96 GB of RAM

    My company is trying to put together some new machines for our render farm. Currently we are considering building a system with 4 12-core CPUs and 96 GB of RAM. Theoretically this would mean that After Effects could render 48 frames simultaneously, b