Why to I have to specify a Component for MediaTracker?

Hi,
I've an application which loads some images. I use a MediaTracker to load the images.
The problem is, that I've to specify a component when creating the MediaTracker.
I tried to create a MediaTracker with
new MediaTracker(null);
but then I get a NullPointerException when I call .waitForID(0);
So I create a MediaTracker like:
new MediaTracker(new Panel());
even tough I don't need the panel.
Do I have to use this workaround to load the images? Or is there a smarter way of doing this??
thx,
dani

ok here is my code, I use a JPanel to be able to use the MediaTracker
Image img = Toolkit.getDefaultToolkit().createImage(imgURL);
// load the image with media tracker class
MediaTracker tracker = new MediaTracker(new Panel());
tracker.addImage(img, 0);       
tracker.waitForID(0);       
// width and height of the course image
w = img.getWidth(null);
h = img.getHeight(null);
System.out.println("w="+w+", h="+h);If I use this code, the image is loaded properly. If I try to take out the MediaTracker stuff then I get w=-1, h=-1.
The imgURL is something like maps/something.gif. The directory where the "maps/xyz.gif"'s are located is in the classpath.
thx
dani

Similar Messages

  • HT201250 Why do i have to use the password for time capsule every time i start my computer

    Why do I have to use thr password for time capsuel every time I start my imac?

    With hindsight, the previous response I got from Apple was just a way of shelving the problem.
    Having just had to reset my password after another 3 months, I contacted Apple again, and it happened that the senior advisor whom the phone agent consulted had had exactly the same problem as me, and had found that iTunes could fix it.  However when I spoke to iTunes they told me I needed to speak to Apple ID account security.  The Apple ID account security representative spoke to a senior adviser, then told me that it would be fixed after I reset my password.  However I am not convinced that anything was actually done, so I may be back here in another 3 months ...
    To modify Roger's advice, the solution I was given is: go to https://expresslane.apple.com ; select 'All Products and Services' in the first column, 'iTunes' in the second column, 'iTunes Store' in the third column, then "Account Management" and "Apple ID account security", then "Talk to Apple support now". A complication is that the "Talk to Apple support now" option only appears when UK English is selected.  So you either need to select UK at the top, or find another way of making phone contact (the email link just went back to the person in iTunes)!

  • Why do i have to wait 24 hrs. for serial number on acrobat pro

    why do i have to wait 24 hrs. for serial number for acrobat pro

    jjaeckel wrote:
    When i Select .. Into a VARCHAR bind variable, i have to initialize the variable before, otherwise i get an ORA-1458.A bind variable in a SQL is simply a place holder. The SQL engine has no idea what data type the value for that placeholder will be. When itself needs to return a value via that placeholder to the caller, it needs to know what the limits/size of the caller's variable is that will be receiving the value from it.
    The way that the SQL engine knows what the data type and size are of a placeholder/bindvar, is by you the caller, telling it.. by binding the variable you will be using, to this placeholder.
    This bind process "exposes" the data type and size of the variable that will be used for binding (sending/receiving data).

  • HT204053 If I purchased Sling Player app for my IPAd, why do I have to buy it again for my Iphone?

    If I purchased Sling Player App for my Ipad, why do I have to purchase it again for my new Iphone?

    1. Yes.
    2. No.
    3. Log into the Mac App Store with the Apple ID you used to purchase it and download it again, or if you still have the installer application, move it to the iMac.
    (68980)

  • Why do I have to use security code for wifi router each time I turn on iPad 3?

    Why do I have to enter wifi security code for my router each time I turn on ipad3?  I have checked all the settings I could but is this a router problem?

    If you're hiding your network SSID and/or using WEP security, I think these can cause this problem.  If you're hiding your SSID, there's really no point in doing that since there are ways people can easily see it if they're looking to do harm anyway.  If you're using WEP security, consider changing to WPA2 which is much more secure than WEP.

  • Why do i have to keep reinstalling Itunes for my Iphone 3gs and Ipad 1 to be detected

    I have to keep reinstalling Itunes for it to recognize my I products,every few days i go to connect my iphone 3gs or my ipad 1 to my pc which is running windows 7 64 bit and they are not detected, so i uninstall itunes,the reinstall itunes and then my I products are then detected... i can then do things.
    But a few days later  the same thing happens,i have had to do this about 8 times so far.. why is this happening and how can i get in tunes to detect my iphone and ipad  without reinstalling itunes..thanks

    Please ignore this post, being that I just discovered the fix action for this problem, which involved installing the software download" iPhone SDK update. Thank God!

  • TS1702 why do i have to put in password for free apps

    why do i have to put a password in for free apps

    That's how it is.  But really, do you want anyone who happens to get his hands on your iPad to download whatever? It's your account, and entering a password insures you are in control.

  • Why do I have to specify a rate when using an external Sample Clock?

    Set the approximate Rate of the external clock. This allows the internal characteristics of the acquisition to be as efficient as possible.
    How to understand?
    帖子被sillyball在02-25-2007 01:48 AM时编辑过了

    I think it is for optimization of the buffer.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Why do i have to init a VARCHAR for a SELECT in a Pro*C PL/SQL block?

    Hi,
    i use PL/SQL Block in a Embedded C Programm and compile with the PRO*C Compiler. Oracle 10gR2.
    When i Select .. Into a VARCHAR bind variable, i have to initialize the variable before, otherwise i get an ORA-1458.
    Same problem with assignments to VARCHAR variables.
    Question: why do i need to initialize the variable?
    Tnx for your help!
    The following test program shows my issue:
    #include <stdio.h>
    #include <string.h>
    #include "oraca.h"
    #include "sqlca.h"
    #define USER "scott"
    #define PASSWORD "tiger"
    int main()
    EXEC SQL BEGIN DECLARE SECTION;
    char *db_user   = USER;
    char *db_passw  = PASSWORD;
    VARCHAR sysdate_str[64];
    EXEC SQL END DECLARE SECTION;
    EXEC SQL CONNECT :db_user identified by :db_passw;
    /* this works */
    sysdate_str.len = 1000; /* invalid length */
    EXEC SQL SELECT
    to_char( sysdate, 'dd.mm.yy hh24:mi:ss' )
    into :sysdate_str
    from DUAL
    printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
    /* following code does not work, sqlcode = - 1458 */
    /* 01458, 00000, "invalid length inside variable character string" */
    sysdate_str.len = 1000; /* invalid length */
    EXEC SQL EXECUTE
    BEGIN
    select to_char( SYSDATE, 'dd.mm.yy hh24:mi:ss')
    into :sysdate_str
    from dual;
    END;
    END-EXEC;
    printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
    /* following code does not work, sqlcode = - 1458 */
    /* 01458, 00000, "invalid length inside variable character string" */
    sysdate_str.len = 1000; /* invalid length */
    EXEC SQL EXECUTE
    BEGIN
    :sysdate_str := to_char( SYSDATE, 'dd.mm.yy hh24:mi:ss');
    END;
    END-EXEC;
    printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
    return(0);
    Edited by: jjaeckel on May 5, 2010 8:37 PM

    jjaeckel wrote:
    When i Select .. Into a VARCHAR bind variable, i have to initialize the variable before, otherwise i get an ORA-1458.A bind variable in a SQL is simply a place holder. The SQL engine has no idea what data type the value for that placeholder will be. When itself needs to return a value via that placeholder to the caller, it needs to know what the limits/size of the caller's variable is that will be receiving the value from it.
    The way that the SQL engine knows what the data type and size are of a placeholder/bindvar, is by you the caller, telling it.. by binding the variable you will be using, to this placeholder.
    This bind process "exposes" the data type and size of the variable that will be used for binding (sending/receiving data).

  • Why do I have to change the password for my Apple ID every 3 months?

    Until recently I assummed that everyone had to change their password every 3 months, but on searching the web I found only a couple of mentions of other people who have to do this.
    My Apple ID was originally set up when I bought a Mac through my company (which was not a developer) from AppleStore Small & Medium Businesses in 2002.  Perhaps all accounts set up that way in 2002 work like this?
    The only solutions I can think of are:
    a) Change something in my Password and Security settings, but I can't see anything relevant.
    b) Move to a new Apple ID, but I think I would lose access to existing apps I have purchased?
    c) Ask Apple to change my settings, but the response a developer with this problem got from Apple was: "I am unable to change the password requirements and restrictions for your Developer Account".
    Anyone else have to keep changing their password?

    With hindsight, the previous response I got from Apple was just a way of shelving the problem.
    Having just had to reset my password after another 3 months, I contacted Apple again, and it happened that the senior advisor whom the phone agent consulted had had exactly the same problem as me, and had found that iTunes could fix it.  However when I spoke to iTunes they told me I needed to speak to Apple ID account security.  The Apple ID account security representative spoke to a senior adviser, then told me that it would be fixed after I reset my password.  However I am not convinced that anything was actually done, so I may be back here in another 3 months ...
    To modify Roger's advice, the solution I was given is: go to https://expresslane.apple.com ; select 'All Products and Services' in the first column, 'iTunes' in the second column, 'iTunes Store' in the third column, then "Account Management" and "Apple ID account security", then "Talk to Apple support now". A complication is that the "Talk to Apple support now" option only appears when UK English is selected.  So you either need to select UK at the top, or find another way of making phone contact (the email link just went back to the person in iTunes)!

  • Why do i have to download a program for my IPod Nano?

    I purchased a IPod nano today and was very disappointed to find out I cannot just plug in the cord to the usb and drag and drop my music from any of my computers. I have to go online and download a file that take 3 hours and put it on every computer that I want to transfer music from. This doesn't sound right. I waited 40 minutes for tech support on the phone and no one ever came to the line. This is terrible. Does anyone have any suggestions?
    xp Windows XP

    It is hard to download iTunes if you only have a dialup internet connection. Do you know anyone with a broadband connection that would be willing to download this program for you?
    I helped my daughter's friend do this--she gave up trying to download iTunes after 90 minutes.
    If your friend can download the program from the Apple Website (not inside itunes), a CD can be burned containing the installation files.
    Have your friend save the installation file to the computer desktop and then burn a data CD for you.

  • Why do you have to use security questions for purchasing stuff from itunes

    please make all apple products not use security questions to purchase  stuff in the itunes store

    If you mean that you've forgotten the answers to your security questions, then if youhave a rescue email address (which is not the same thing as an alternate email address) set up on your account then you can go to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you should see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address (you won't be able to add one until you can answer 2 of your questions) then see if this user tip helps : https://discussions.apple.com/docs/DOC-4551
    e.g. you can try contacting iTunes Support : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management , and then try Apple ID Account Security
    or try ringing Apple in your country and ask to talk to the Accounts Security Team : http://support.apple.com/kb/HE57

  • Why do I have to turn bluetooth off for the cameras on the iPad to work?

    On this doggone iPad 2, neither of the cameras will work until I turn off bluetooth.  Even that is not entirely reliable, though, as I just had both cameras working, switched out to another application, came back to the camera app, and it was locked again...no still mode, no video mode with either camera.  Bluetooth was NOT on.  Doesn't seem right in any case.  If I'm trying to use the iPad for a video chat, do I have to choose between being able to use the camera and being able to use a bluetooth headset?

    I am having the same airport issue.Should i just wait for a possible update or just assume its a hardware problem and try to get my mac fixed?
    If your wireless connection fails in both Mac OS X and Windows like the other poster, you should have your machine checked out at the Genius Bar of your local Apple Store.
    If it's a matter of dropped connections in Mac OS X, call AppleCare and open a ticket so they can track the issue. The more calls they get, the more data they have and the faster engineering can track down what may be causing your issue.

  • Why do I have a bunch of birthdays for people I don't know in my icalendar?

    I recently paired my college online course, Canvas, and it's calendar to my icalendar. I thought it would be great to have all my deadlines on my ipad. But suddenly I have hundreds of birthdays cluttering up my calendar of people I've never heard of. None of them are in my college courses, none of them are facebook friends. Where did they come from and how do I get rid of them? I turned of the birthday function in the settings of icalendar and nothing happened. Help!

    Mac's are generally not 3D gaming computers and laptops especially are not because 3D games require a upgraded video card to take advantage of newer games and more feature rich updates.
    Only the Mac Pro can one change the video card, if one can find a upgrade for it.
    If you really love 3D gaming, a Windows 7 3D gaming tower is your machine.
    http://www.cbscores.com/index.php?sort=ogl&order=desc
    3D gaming on a Mac is sort of a second hobby, it's rather short lived as one can't replace the video card once a year, only with a new machine purchase.
    Most 3D games are for Windows anyway and Apple almost demands OS X be upgraded to newer verisons annually now, so that sort of throws a monkey wrench into a Mac gaming rig with software upgrades and all. On the other hand Windows 7 is supported for a decade.
    Mac's just don't work well with 3D gaming, perhaps a Win 7 tower and a iPad or something.

  • Why do I have 7 Plug-In files for Quick Time

               I have 7 Quick Time plug-in files, some appear to be duplicates....do I need them all or can I delete the copys?

    Best not to delete any. Seven sounds right, from memory. Different plugins handle different file formats in Firefox, Chrome, safari and other non-ActiveX-based browsers.

Maybe you are looking for

  • How can I get iTunes Match to download songs on new iphone5s?

    Hi, I just exchanged the iphone4 for for the iphone 5s. For five days now it says 'Loading iTunes Match' on the display of the new phone when I go to 'Music'. Same thing for photographs. What can I do? So far I've checked that all the right things ar

  • Help with importing library and how to authorize music to play

    Recently I had to reformat my hard drive. As a result I am trying to transfer my itunes library back to the computer from the backup device. There doesn't seem to be a simple way to do this. I found an article online that suggested I could import the

  • Supertrooper19

    How do I convert a word document (resume) to a pdf file/format? Grant

  • Playing games

    I was wondering if you could play the "Total War" series on a macbook with the GMA x3100 graphics card? Thats the only system requirement I'm not sure on, the rest of my system specs are here... http://support.apple.com/kb/SP12 ... I have the black o

  • Reset Password for login in design center OWB 11g

    Dear Gurus, I have Oracle Warehouse Builder 11g which I get from my colleague, I got problem when going to login, my colleague has give me the user name but he also forgot the password. How I can know where is file/folder/etc to keep information abou