Please help! Image only shows when i use Applets instead of Frame/JFrame

The following classes don't work because the Canvas shows just background colour. However, when I let my class "MyContainer" extend Applet instead(and running the Applet instead of the StartUp class that creates a JFrame) of Frame/JFrame i get my Image on the Canvas showing, WHY?
code:
public class StartUp {
public static void main(String[] arg) {
MyContainer my = new MyContainer();
     my.setSize(500, 400);
     my.setVisible(true);
public class MyContainer extends JFrame {
MyCanvas m;
public void MyContainer() {
     m=new MyCanvas();
     this.setSize(320, 320);
this.setLayout(new GridLayout(1, 1, 0, 0));
this.add(m);
this.setVisible(true);
public class MyCanvas extends Canvas {
Image im;
public MyCanvas() {
im=Toolkit.getDefaultToolkit().createImage("c:\\miniferrari.jpg");
try {
jbInit();
catch(Exception e) {
e.printStackTrace();
public void paint(Graphics g) {
g.drawImage(im, 0, 0, this);
private void jbInit() throws Exception {
this.setBackground(Color.darkGray);

as you are using a JFrame, you should refer to it's contentpane:
this.getContentPane().setLayout(new GridLayout(1, 1, 0, 0));
this.getContentPane().add(m);

Similar Messages

  • Photos in album are only a hash-marked outline the image only shows when scrolling how can I see the image and open the photo?

    Photos in iPhoto album are only a hash-marked outline the image only shows when scrolling how can I see the image and open the photo?

    Make a temporary, backup copy (if you don't already have a backup copy) of the library and apply the two fixes below in order as needed:
    Fix #1
    Launch iPhoto with the Command+Option keys held down and rebuild the library.
    Select the options identified in the screenshot. 
    Fix #2
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    Download iPhoto Library Manager and launch.
    Click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
    Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu option
    In the next  window name the new library and select the location you want it to be placed.
    Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    OT

  • My macbook wont start the screen turn blue and stay like that for hrs. It only work when i use safe mode, i try to use disk utilities to fix it but the disk utilities keep saying error and a bunch of other stuff. I dont the cds the comp came with, help.

    my macbook wont start the screen turn blue and stay like that for hrs. It only work when i use safe mode, i try to use disk utilities to fix it but the disk utilities keep saying error and a bunch of other stuff. I dont the cds the comp came with, help. i've tried the command s command p command v but nothing i've tried to the safe mode then a quick restart but nothing
    disk utility give me this:
    Process:         Disk Utility [371]
    Path:            /Applications/Utilities/Disk Utility.app/Contents/MacOS/Disk Utility
    Identifier:      com.apple.DiskUtility
    Version:         11.5.2 (298.4)
    Build Info:      DiskUtility-2980400~60
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [86]
    Date/Time:       2013-11-05 03:29:41.247 -0500
    OS Version:      Mac OS X 10.6.8 (10K549)
    Report Version:  6
    Interval Since Last Report:          9522 sec
    Crashes Since Last Report:           29
    Per-App Interval Since Last Report:  981 sec
    Per-App Crashes Since Last Report:   25
    Anonymous UUID:                      F6B8E263-76C8-4C7D-AA58-48134BF4BA78
    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000020
    Crashed Thread:  0  Dispatch queue: com.apple.main-thread
    Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
    0   libobjc.A.dylib                         0x0000000100c62fbc _read_images + 312
    1   libobjc.A.dylib                         0x0000000100c79721 map_images_nolock + 1266
    2   libobjc.A.dylib                         0x0000000100c62761 map_images + 115
    3   dyld                                    0x00007fff5fc039c5 dyld::notifyBatchPartial(dyld_image_states, bool, char const* (*)(dyld_image_states, unsigned int, dyld_image_info const*)) + 853
    4   dyld                                    0x00007fff5fc0c849 ImageLoader::link(ImageLoader::LinkContext const&, bool, bool, ImageLoader::RPathChain const&) + 201
    5   dyld                                    0x00007fff5fc04d54 dyld::link(ImageLoader*, bool, ImageLoader::RPathChain const&) + 118
    6   dyld                                    0x00007fff5fc08f7c dlopen + 490
    7   libSystem.B.dylib                       0x0000000100a14e40 dlopen + 61
    8   com.apple.CoreFoundation                0x0000000100d78ef7 _CFBundleDlfcnLoadBundle + 231
    9   com.apple.CoreFoundation                0x0000000100d77e97 _CFBundleLoadExecutableAndReturnError + 1191
    10  com.apple.Foundation                    0x0000000101008355 _NSBundleLoadCode + 638
    11  com.apple.Foundation                    0x0000000101007c78 -[NSBundle loadAndReturnError:] + 742
    12  com.apple.Foundation                    0x000000010101960c -[NSBundle principalClass] + 38
    13  com.apple.framework.DUSupport           0x0000000100082080 -[DUModuleManager(_private) findDUModules:] + 405
    14  com.apple.framework.DUSupport           0x0000000100081ed9 -[DUModuleManager orderedModuleListOfModules] + 40
    15  com.apple.DiskUtility                   0x0000000100006082 0x100000000 + 24706
    16  com.apple.DiskUtility                   0x0000000100005f59 0x100000000 + 24409
    17  com.apple.AppKit                        0x0000000101444625 -[NSWindowController _windowDidLoad] + 538
    18  com.apple.AppKit                        0x00000001013e1f77 -[NSWindowController window] + 112
    19  com.apple.AppKit                        0x00000001015f61d9 -[NSWindowController showWindow:] + 47
    20  com.apple.AppKit                        0x00000001015c7c5c -[NSDocument showWindows] + 98
    21  com.apple.AppKit                        0x00000001015c64bb -[NSDocumentController openUntitledDocumentAndDisplay:error:] + 340
    22  com.apple.AppKit                        0x00000001014f7b44 -[NSDocumentController(NSInternal) _openUntitled] + 111
    23  com.apple.AppKit                        0x00000001014f79ab -[NSApplication _doOpenUntitled] + 257
    24  com.apple.AppKit                        0x00000001014f733b -[NSApplication(NSAppleEventHandling) _handleAEOpen:] + 185
    25  com.apple.AppKit                        0x00000001014f6fd9 -[NSApplication(NSAppleEventHandling) _handleCoreEvent:withReplyEvent:] + 77
    26  com.apple.Foundation                    0x0000000100ffd0d6 -[NSAppleEventManager dispatchRawAppleEvent:withRawReply:handlerRefCon:] + 360
    27  com.apple.Foundation                    0x0000000100ffcf06 _NSAppleEventManagerGenericHandler + 114
    28  com.apple.AE                            0x0000000104d7332b aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned int, unsigned char*) + 162
    29  com.apple.AE                            0x0000000104d73224 dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 32
    30  com.apple.AE                            0x0000000104d7312b aeProcessAppleEvent + 210
    31  com.apple.HIToolbox                     0x00000001028a0619 AEProcessAppleEvent + 48
    32  com.apple.AppKit                        0x00000001013fc095 _DPSNextEvent + 1191
    33  com.apple.AppKit                        0x00000001013fb801 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155
    34  com.apple.AppKit                        0x00000001013c168f -[NSApplication run] + 395
    35  com.apple.AppKit                        0x00000001013ba3b0 NSApplicationMain + 364
    36  com.apple.DiskUtility                   0x0000000100002009 0x100000000 + 8201
    37  com.apple.DiskUtility                   0x0000000100001db8 0x100000000 + 7608
    Thread 1:  Dispatch queue: com.apple.libdispatch-manager
    0   libSystem.B.dylib                       0x0000000100a27c0a kevent + 10
    1   libSystem.B.dylib                       0x0000000100a29add _dispatch_mgr_invoke + 154
    2   libSystem.B.dylib                       0x0000000100a297b4 _dispatch_queue_invoke + 185
    3   libSystem.B.dylib                       0x0000000100a292de _dispatch_worker_thread2 + 252
    4   libSystem.B.dylib                       0x0000000100a28c08 _pthread_wqthread + 353
    5   libSystem.B.dylib                       0x0000000100a28aa5 start_wqthread + 13
    AND MORE TOO MUCH TO COPY N PASTE HELP PLEASE!!!!!

    Reset the PRAM
    Reinstall the operating system from the dvd (you will not loose your data)

  • My sound has recently gone on my Iphone4s, this only happens when I use my phone myself. The sound works when I receive calls and texts but I am unable to watch videos, listen to music etc it seems like my volume button has gone! Can anyone help??

    My sound has recently gone on my iphone4s, this only happens when I use my phone myself. The sound works when i receive a call or a message etc but I am unable to watch videos or play music, the sound also doesn't work on games. Please can anyone help with this issue or let me know how to fix it if experienced the same problem?

    Remove all apps from multitasking bar. Double click Home button then tap and hold an icon and tap on little x on every app. Then reset. Hold down Home and Power button until Apple logo appears.

  • I have lost sound on my iPad in apps unless I use headphones ,does anyone know how to get sound back without them .I have used the mute volume on the bar at bottom of screen and the slider volume control there only shows when headphones are plugged in !

    I have lost sound on my iPad in apps unless I use headphones ,does anyone know how to get sound back without them .I have used the mute volume on the bar at bottom of screen and the slider volume control there only shows when headphones are plugged in !
    I also tried resetting settings all to no avail ...I looked up some advice and watched utube video advice on how to fix without success..
    The volume control button on side does not work ,I got the iPad last August and wonder if it is a fault that means I must return it for replacement from where it was purchased ?

    The Retrospect you used way back when is no longer around. The company was sold and that company produced a new version of Retrospect - Retrospect 8.x
    So, as you've been told, you would have to be running a Tiger system with an old version of Retrospect software (5.x or 6.x - you would need to know) assuming you can find the software.
    As best I can remember you cannot extract files from a Retrospect backup except using the software since Retrospect did not normally make a file by file backup rather it created an archive of the files in the backup. I'm assuming that the EMC/Retrospect people have told you that old Retrospect backups are not accessible by Retrospect 8.x?

  • Occasionally,  some of the image borders turn dark grey (medium grey is the default) and then random other  images cannot be opened with a double click.  They only open when selected using the arrows on the keyboard.  They also cannot be moved to collecti

    Occasionally,  some of the image borders turn dark grey (medium grey is the default) and then random other  images cannot be opened with a double click.  They only open when selected using the arrows on the keyboard.  They also cannot be moved to collections.  Anyone have a solution for this?

    When you say  "could not be opened"- what are you referring to?  A double click of the mouse should view the clicked image in Loupe view- the same as pressing [E] on the keyboard for an enlarged view. (And a second double-click will take you back to library grid view.)
    To "open" an image in the Development module requires you to select the image then press [D] or click on the [Develop] button.
    When you say "could not be ...moved" -what are you referring to?  Are you trying to move an image file from its place in a folder to another folder? Are you just wanting it in a collection? When you drag an image to a collection you are only placing a link to the image in the collection- not actually moving any file. The image will stay exactly where it is in its original folder and will remain as a thumbnail preview in the Library Grid view.
    Are you having any "mouse" problems that may be changing its actions in LR ?
    Do you see an exclamation mark on any image borders ?
    Let's keep working on this. I am curious to see you find an answer.
    Rob

  • My keynote seems to be misbehaving. Me, a teacher was preparing a ppt on keynote.all of a sudden, the navigator column to my left goes black and nothing seems to move. Please help! Only 12 hours before I take class.

    My keynote seems to be misbehaving. Me, a teacher was preparing a ppt on keynote.all of a sudden, the navigator column to my left goes black and nothing seems to move. Please help! Only 12 hours before I take class.

    Hi KRKabutoZero,
    Welcome to Apple Discussions
    You may want to look at Knowledge Base Document #58042 on A flashing question mark appears when you start your Mac.
    Do you have access to another Mac? You may want to backing up your files via Target Disk Mode (TDM) as well as running some utilities (Knowledge Base Document #58583 on How to use FireWire target disk mode.
    You may want to invest in a utility like DiskWarrior from Alsoft. It is great for troubleshooting drive malfunctions.
    As said before, you may also want to bring your iBook to your local Apple Store/Reseller.
    Jon
    Mac Mini 1.42Ghz, iPod (All), Airport (Graphite & Express), G4 1.33Ghz iBook, G4 iMac 1Ghz, G3 500Mhz, iBook iMac 233Mhz, eMate, Power Mac 5400 LC, PowerBook 540c, Macintosh 128K, Apple //e, Apple //, and some more...  Mac OS X (10.4.5) Moto Razr, iLife '06, SmartDisk 160Gb, Apple BT Mouse, Sight..

  • Image to show when drop down menu is visible

    Hi all,
    Just a CSS problem I can't work out. The horz menu has drop down sub menu and I'm trying to get a arrow image to show when you hover over the main mene items, please see image.
    Thanks for any advise.

    It's often easier to use an HTML symbol for arrows instead of images:
    Down triangle:
    <li><a href="services.html"> SERVICES &#9660;</a>
    Right triangle:
    <li>a<href="graphic-design.html" >Graphic Design&#9658;</a>
    More Special Characters
    ikwebdesigner.com/special-characters/
    Nancy O.

  • TS3297 i can no longer connect to itunes. a message comes up "we could not complete your itunes request. The itunes store is temporarily unavailable. please try again later. but when i use a different acct. it goes through right away . why did this start

    i can no longer connect to itunes. a message comes up "we could not complete your itunes request. The itunes store is temporarily unavailable. please try again later. but when i use a different acct. it goes through right away . why did this start happening?

    I don't know - but I am having the same problem and have not had any useful help from Apple Support.  Everything they told be to do has been done and it hasn't fixed the problem.

  • Please help to re-write this query using exists or with

    Hi please help to re-write this query using exists or with, i need to write same code for 45 day , 90 days and so on but sub query condition is same for all
    SELECT SUM (DECODE (t_one_mon_c_paid_us, 0, 0, 1)) t_two_y_m_mul_ca_
    FROM (SELECT SUM (one_mon_c_paid_us) t_one_mon_c_paid_us
    FROM (
    SELECT a.individual_id individual_id,
    CASE
    WHEN NVL
    (b.ship_dt,
    TO_DATE ('05-MAY-1955')
    ) >= SYSDATE - 45
    AND a.country_cd = 'US'
    AND b.individual_id in (
    SELECT UNIQUE c.individual_id
    FROM order c
    WHERE c.prod_cd = 'A'
    AND NVL (c.last_payment_dt,
    TO_DATE ('05-MAY-1955')
    ) >= SYSDATE - 745)
    THEN 1
    ELSE 0
    END AS one_mon_c_paid_us
    FROM items b, addr a, product d
    WHERE b.prod_id = d.prod_id
    AND d.affinity_1_cd = 'ADH'
    AND b.individual_id = a.individual_id)
    GROUP BY individual_id)
    Edited by: user4522368 on Aug 23, 2010 9:11 AM

    Please try and place \ before and after you code \Could you not remove the inline column select with the following?
    SELECT a.individual_id individual_id
         ,CASE
            when b.Ship_dt is null then
              3
            WHEN b.ship_dt >= SYSDATE - 90
              3
            WHEN b.ship_dt >= SYSDATE - 45
              2
            WHEN b.ship_dt >= SYSDATE - 30
              1
          END AS one_mon_c_paid_us
    FROM  items           b
         ,addr            a
         ,product         d
         ,order           o
    WHERE b.prod_id       = d.prod_id
    AND   d.affinity_1_cd = 'ADH'
    AND   b.individual_id = a.individual_id
    AND   b.Individual_ID = o.Individual_ID
    and   o.Prod_CD       = 'A'             
    and   NVL (o.last_payment_dt,TO_DATE ('05-MAY-1955') ) >= SYSDATE - 745
    and   a.Country_CD    = 'US'

  • My snapchat won`t work if i use wifi, its only working when im useing 3g

    my snapchat won`t work if i use wifi, its only working when im useing 3g

    Since this is an app-related issue, you may get better results solving your problem by contacting the app developer, or searching their help/FAQ pages.

  • Google images only showing first page. Any solutions yet?

    Hi
    I've recently come across this problem of Google images only showing the first page of images with the rest being blank grey boxes.
    After trawling the web for days it seems this has been an ongoing problem for many for several months now but I haven't seen any solutions that have worked for me.
    I've cleared the cache and temp files, I've un-checked 'disable or replace context menus' on firefox etc.
    It seems to run ok on ie8 but I prefer to use Firefox if at all possible.
    Is there a solution out there?
    I am on XP Pro sp3 using FF 3.6.11

    This was happening to me (only getting one page of images after a search.) I disabled the AdBlock Plus ad-on and the problem was solved.

  • Hi can someone please help, my imac crashed, when i try to start it up, it just beeps loudly 3 times, then there is a pause before it beeps 3 more times, this just continues to happen, any sugestions? please help

    Hi can someone please help, my imac crashed, when i try to start it up, it just beeps loudly 3 times, then there is a pause before it beeps 3 more times, this just continues to happen, any sugestions? please help

    allanpar wrote:
    i am having to use my laptop to post this question, missing my imac so much, its just not the same using this slow windows laptop.
    Then maybe it's time to buy a new Windows notebook.
    The RAM has either gone bad or somehow become unseated. Also there is the chance that the RAM slots have failed.

  • I have unabled 5 fingure gesture now not able to perform any task,also my power button is not working,please help me in removing this gesture,using I phone 4

    I have unabled 5 fingure gesture now not able to perform any task,also my power button is not working,please help me in removing this gesture,using I phone 4

    I have unabled 5 fingure gesture now not able to perform any task,also my power button is not working,please help me in removing this gesture,using I phone 4

  • I upgraded to 20gb iCloud but it isn't enough to back up. I get constant error messages saying there is no backup space and I've not been able to use the upgrade. Apple promised to refund then didn't. Please help is there anyway I can use this space?

    Please see the subject line thanks
    I upgraded to 20gb iCloud but it isn't enough to back up. I get constant error messages saying there is no backup space and I've not been able to use the upgrade. Apple promised to refund then didn't. Please help is there anyway I can use this space?

    If you were told they would refund the price for the iCloud storage - Contact AppleCare and ask to speak with a senior advisor.  Have the case number for the promised refund available.
    If you are trying to update your device, but you don't have sufficient space to download and install the update, you need to delete content from your device.  Buying storage in iCloud does not add space to the device which is what you need.
    You can always update using a computer with iTunes installed - this method is faster, and will allow you to make a backup on the local computer (Local backups restore faster than iCloud backups).
    HTH

Maybe you are looking for

  • Calling report from forms while running the application from thin clients

    I am using thin client technology with 64MB RAM for running developer 6i application. The server has windows 2000 advanced server with 256 MB RAM. When I run the apllication from a single client, it works fine even for multiple windows. But the momen

  • Is there a solution in Apple framework that offers NAS RAID DLNA?

    Hello forum, I think the requirement of NAS with RAID and additionally DLNA is slowly belcoming quite common these days. Apple seems to have taken a step in the right direction with Time Capsule but without RAID it only reaches halfway though. In add

  • Display preferences do not allow for turning off Apple TV

    After turning on Apple TV it cannot be reset without rebooting the system. Display preferences will not allow unchecking of Apple TV. It reverts immediately from Off to Apple TV

  • This might not be specific to MacBook Pro, but here's my issue.

    I received a zip file that I want to add to a WORD for Mac document as a hot link, but I can't seem to do it. Can anyone walk me through the proper way? Thanks.

  • CS2 Upgrade

    I am thinking of purchasing a copy of Adobe CS2 on Ebay, but am not sure if I will be able to install it. I own Adobe Photoshop 5.5 and Illustrator 8. Will these be sufficient for an upgrade to CS2, or is the first version of Adobe CS needed to upgra