Why doesn't my picture get shown?

I want a picture to show up on my GUI, but I have no idea how to go about it. This is what I've tryed so far, and it compiles. But it doesnt show the picture when I compile. What am I doing wrong?
import java.awt.*;
import javax.swing.*;
public class Piccy extends JFrame{
Image ball;
   public Piccy() {
   super();
   Toolkit kit = Toolkit.getDefaultToolkit();
   ball = kit.getImage("chaz.gif");
   public void paintComponent(Graphics comp) {
      JPanel north = new JPanel();
          Graphics2D comp2D = (Graphics2D) comp;
      comp2D.drawImage(ball, (int)100, (int)100, this);
      this.getContentPane().add(north, BorderLayout.SOUTH);
   public static void main(String[]args)
      JFrame f = new Piccy();
      f.setVisible(true);
      f.setSize(500,500);

'cause your code's kinda a mess!
You make a new JFrame in your main method, set its size and show it - which is what happens when you run this code.
You have your main class extend JFrame, but you never call its show method, and you do a bunch of work in a paintComponent method that, as near as I can tell, doesn't get called. Maybe you were wanting to override the method in some subclass of JComponent? Like your JPanel there? But even so, adding a component from within a paint method doesn't sound like a good idea to me.
Check tutorials - hit Google (I found this: http://cit.wta.swin.edu.au/cit/subjects/CITP0014/tutorials/netbeans/graphics/graphics.html )
Good Luck
Lee

Similar Messages

  • Why doesn't my pictures on my PC upload to my Ipad and Iphone.  Seems I have all my settings correct but none of my pictures are not showing up.

    Why doesn't my pictures show up on my Ipad and Iphone?  I have my pictures in the photostream upload folder but they do not seem to be uploading.
    Thanks.

    You will notice that in "My Pictures" folder you have a new folder called photostream. In photostream folder you will have another folder called "Upload" Anything you put in the "upload" folder will go to your phone and ipad. So just copy pics you want into that folder and they will go into photostream. I would not suggest moving them since I am not sure how it works on windows but there is a chance photostream might empty out the  folder after 30 days.
    On mac it automatically saves originals..

  • Why do my portrait pictures get rotated while making a book?

    I am making a book and everytime I place a picture which was takene as a prtrait, it gets rotated.

    I would suggest posting in the iPhoto section to get the best results

  • Why doesn't my RAM get utilized?

    I have a new MacPro with 32G of RAM, but when I look at the Activity Monitor, all my apps use up to 2000 times more Virtual Memory than Real Memory. What's the deal? I bought all this RAM, but the OS doesn't use it.
    Even running multiple apps, very little of my actual RAM is being used.
    Why not?
    Can the OS be forced to use more real RAM?

    What's the deal?
    That figure is overinflated due to the way it is calculated. The actual amount of VM in use can be determined by choosing Go to Folder from the Finder's Go menu, entering /private/var/vm/ as the path, and adding up the sizes of the swapfiles.
    (31049)

  • Why doesn't iPod 4g get ios7

    I'm really mad that iPod 4th gen doesn't get ios7

    Welcome to Apple Support Communities
    All iOS 7 devices have 512 or more of RAM, and the 4th generation iPod touch has got 256 MB of RAM

  • Why did all my pictures get lost i did not delete them?

    i cant seem to find where my pictures have gone i did not earse them i have no clue what happened help please!!!something anything will help i have not the slightest clue what happened?

    Is there a file/folder called iPhoto Library inside your Pictures folder?
    If so, open iPhoto with the option key held down and point the program to the iPhoto Library inside yur Pictures folder.

  • Why doesn't .mac email get pushed to iPhone?

    So I seet up a .mac account. But the email isn't pushed to my iPhone. I only get it if I chck mail on the iPhone.
    Is .mac email pushed?

    I access my .Mac account on my iPhone and a free Yahoo Push IMAP account and there isn't much difference except for the .Mac account having to be checked for new messages but there have been a number of reports here indicating that Yahoo's free Push account does not always Push or work properly. In addition, Yahoo's free Push IMAP account includes advertisements with sent messages - not good.
    There are a number of benefits included with a .Mac account - especially with the changes and improvements just announced so you may want to rethink using a Yahoo account instead just due to Push.
    http://www.apple.com/pr/library/2007/08/07dotmac.html

  • Why doesn't the i get automatically capitalized in emails?

    is there something i can do about this?
    Thanks in adavance.

    Entering text in an email composed on iCloud.com, just like text entered on any other site, is autocorrected by your device's software. Some operating systems (such as OS X) include built in autocorrection and spell checking, as do some browsers (such as Google Chrome).

  • Why doesn't my second generation ipod don't get wifi

    Why doesn't my ipod get wifi in my house but my sister's ipod gets wifi in the same house. Please help me

    Is wifi grayed out?
    Do you see the network(s)
    What happens when you try to connect?

  • Why doesn't the pwdchangedtime attribute get created?

    In OID, I set up a password policy where passwords never expire. Then I create some users. Then, I change the password policy so passwords expire in 30 days. But, the passwords never expire for the users I previously created. I think it's because the pwdchangedtime attribute never got created. But, if I change a user's password, then the pwdchangedtime attribute gets created. Why doesn't the attribute get created when I change the password policy?

    which version are you using?
    regards,
    --Olaf                                                                                                                                                                                                                   

  • Why when playing a film from iTunes through a digital av adapter on my ipad2 does the picture get pixelated

    Why when playing a film from iTunes through a digital av adapter on my ipad2 does the picture get pixelated

    iPad 3 does not have a lightning port, it's 30 pin.

  • Why doesn`t my webmail notifier from mozilla check a yahoo address? It always shown the verification window and even if i type the catcha it still doesnt work?

    Why doesn`t my webmail notifier from mozilla check a yahoo address? It always shown the verification window and even if i type the catcha it still doesnt work?

    The support forum for that extension is here: <br />
    http://webmailnotifier.mozdev.org/drupal/forum/

  • I have Elements 12 installed.  When I am in the catalog, click on a photo, then want to open the Editor, I get an error message.  If I click on Editor from the Welcome screen, I get the same error message.  Why doesn't Editor work?  Thanks.

    I have Elements 12 installed.  When I am in the catalog, click on a photo, then want to open the Editor, I get an error message.  If I click on Editor from the Welcome screen, I get the same error message.  Why doesn't Editor work?  Thanks.

    You'd better ask in the Elements forum.
    Photoshop Elements

  • HT1657 I had rented a movie on my IPhone5 and after downloading almost all of it, I get an error that there is no enough space. Why doesn't the store check to see if I have enough free space before proceeeding with the order?

    After downloading almost all of it, I get an error that there is no enough space. Why doesn't the store check to see if I have enough free space before proceeeding with the order?
    How do I get a refund?

    Well, with apps genneraly you do get told ahead of time. I'm not sure of the current algorithm with movies though.
    Why not just clear up some space? You can check your usage in your settings btw.

  • Using Windows 7 and LR 5  when I look at the Keyword List a certain keyword has 7 pictures but when I check the Library Filter with that keyword 350 pictures are shown which includes the 7 pictures that have the keyword.  Why does the Library Filter showi

    Using Windows 7 and LR 5,  when I look at the Keyword List a certain keyword has 7 pictures but when I check the Library Filter with that keyword 350 pictures are shown which includes the 7 pictures that have the keyword.  Why does the Library Filter showing pictures that do not match the query

    Dan,
    Here's what's going on in the catalog you sent me, "Joel & Caitlin's Wedding".  There is the keyword "gwenn", which is explicitly assigned to 7 pics. But keyword "schwartz" has a number of synonyms, including "gwenn", and it is assigned to 25 pics.  There is no overlap between the two sets of pics. 
    I discovered these two occurrences by doing Metadata > Export Keywords, opening the exported file in an editor, and then searching for "gwenn".  I found two occurrences of "gwenn":
    gwenn
    schwartz
        {gwenn}
    From this, you can see that the keyword "schwartz" has 9 synonyms, of which "gwenn" is one.
    The filter criterion "Keywords Contain gwenn" will match the 7 pics that are explicitly assigned the keyword "gwenn", and it will also match the 25 pics assigned the keyword "schwartz", because that keyword has a synonym "gwenn".
    This illustrates the behavior I mentioned above: The criterion "Keywords contains x" will match against any of a pic's assigned keywords, any of those keywords' ancestor keywords, and any of the synonyms of the assigned keywords and their ancestors.
    So LR is operating correctly here, if not in a way that's easy to understand. 
    It appears that you are using the synonyms of "schwartz" to represent individual members of the Schwartz family.  A better way of representing family relationships is to have a parent keyword "Schwartz", with subkeywords for each family member, e.g. "Gwenn Schwartz", "Joe Schwartz", "Jane Schwartz", etc.  Repeating the family name in the subkeywords has a couple of advantages. LR usually only displays the "leaf" name of a keyword, so instead of showing you just "Joe", it will show you "Joe Schwartz", helpful when there are a number of different people whose first name is "Joe".  Also, if you ever export your pics to other software, it may not understand the LR hierarchy and won't show the parent keywords, so again it's more informative to see a keyword named "Joe Schwartz" rather than "Joe".

Maybe you are looking for

  • Question marks at end of each line in messages sent with 10.4.6 mail

    Some Outlook users are finding ?s at the end of each line in my emails sent from 10.4.6. I did not have this problem in 10.3.9. The problem appears to be resolved when I choose UTF-8 message encoding. There appears to be no way to make Mail automatic

  • Unknown message

    Hi ! During a discusion with my girlfriend, I received a message from her : http://t.co/9SRvbLregR (it's french ..) But she sended that text : http://t.co/6BsC2uINmo She has got an iPhone 4s with iOS 7.0.3 I've an iPhone 4 with 7.0.2 So, it's too ***

  • Association Rule Tutorial Doesn't Work

    Dear All, I couldn't run Assocation Rules tutorial on my machine. I got the following error message Error Message: An abnormal failure was encountered. Exception Message: SHA1 digest error for oracle/dmt/jdm/task/apply/OraDataSetApplyTask.class class

  • Compositing doesn't seem to work in awessome-git

    When a compositing manager is started in awesome various things become transparent that shouldn't be like firefox. This problem is apparent with all the compositing managers I tried, xcompmgr, cairo-compmgr and unagi. Is there a fix? Last edited by t

  • Fireworks CS6 not opening files

    Hi, I installed the trial version of CS6 (Mountain Lion) the other day and created some files, the same files opened for me on another computer using CS5 (Mountain Lion) whilst I was waiting for the full version to get installed onto my Mac. For some