Article View: borland.public.jbuilder.java.api
Article #1117Image loading problems...
From: Tebriel
Date: Fri, 10 May 2002 18:28
Date: Fri, 10 May 2002 18:28
29 lines
2607 bytes
2607 bytes
I've tried everything to get a lousy jpg to load (never mind trying to get
it to display) and nothing seems to work, I don't know if it's because these
are applet functions or what...
Some of the things I've tried are:
JLabel imageLabel = new JLabel(new
ImageIcon(this.getClass.getResource("images/IMG003.jpg")));
(won't compile, getClass function isn't found. What is the this pointer
supposed to point to? Where should this line be?)
JLabel imageLabel = new JLabel(new
ImageIcon(frame.getResource("images/IMG003.jpg")));
(frame is a JFrame, and getResource isn't there..... wont compile)
Image img;
img = Toolkit.getDefaultToolkit().getImage("images/IMG003.jpg");
(compiles and runs but does not do anything.... the width, height, etc are
set to -1 so it can't be loading.....)
Robot rob;
img = rob.createScreenCapture(new Rectangle(0, 0, 100, 100));
(same as the one above--this is the one I REALLY want to get working, I want
to capture part of the screen into pics)
I can't distinguish between applet and application functionality, and so far
my luck in researching Java stuff on the internet and in the docs has been
lousy. It's pretty annoying... I'm starting to think that all of this would
be faster in C++ which I'm used to....
Technical Details
Message-ID:
<ljUC8.142080$N8.11704668@bin5.nnrp.aus1.giganews.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!207.217.77.43.MISMATCH!newsfeed1.earthlink.net!newsfeed.earthlink.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,bd75e1f1bed9e110,start X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2002-05-10 11:28:51 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!supernews.com!207.217.77.43.MISMATCH!newsfeed1.earthlink.net!newsfeed.earthlink.net!nntp2.aus1.giganews.com!nntp.giganews.com!nntp3.aus1.giganews.com!bin5.nnrp.aus1.giganews.com.POSTED!not-for-mail From: "Tebriel" <fakeaddress@fake.com> Newsgroups: borland.public.jbuilder.java.api Subject: Image loading problems... Lines: 31 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: <ljUC8.142080$N8.11704668@bin5.nnrp.aus1.giganews.com> NNTP-Posting-Date: Fri, 10 May 2002 13:28:33 CDT Organization: Giganews.Com - Premium News Outsourcing X-Trace: sv3-Dt7GtptwNrmj5eqqNUiRc+GP9xFdFEYb+gMr9aTY+JqDe1eXK/+ctCaO87HSKWaU5KepppJAHH3Q21r!cPg2eNGutQQvi8s2/l6Dsv5BocaZEnzou1LHhkT5h0ZqUA50spBU/NXmDUcGfKGItt4LzXiY0urE!/Uk= X-Complaints-To: abuse@comcast.com X-DMCA-Complaints-To: abuse@comcast.com X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly Date: Fri, 10 May 2002 18:28:33 GMT