Image from Web  
Author Message
_Mario_





PostPosted: 2004-7-20 0:29:00 Top

java-programmer, Image from Web Hi all, I need to read an image located in http://www.xxx.yyy/eee/test.jpg

...how can I do?

How can I display once readed in a swing interface?

thanks.

mario


 
Andrew Thompson





PostPosted: 2004-7-20 0:47:00 Top

java-programmer >> Image from Web On Mon, 19 Jul 2004 18:28:35 +0200, _Mario_ wrote:

> Hi all, I need to read an image located in http://www.xxx.yyy/eee/test.jpg
..
> How can I display once readed in a swing interface?

<sscce>
import javax.swing.*;
import java.net.*;

public class ShowImage {

// trying to create an URL might produce
// an exception, so throw it
public static void main(String args[])
throws MalformedURLException {

// construct the URL
URL url = new
URL("http://www.physci.org/codes/all_inc/codes.gif");

//make the frame
JFrame f = new JFrame();
// construct the icon
ImageIcon icon = new ImageIcon(url);

// add the icon to a label
JLabel picLabel = new JLabel( icon );

// add the label to the frame's cont pane
f.getContentPane().add( picLabel );

// pack the frame and make it visible
f.pack();
f.setVisible(true);
}
}
</sscce>

> thanks.

No worries..

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
_Mario_





PostPosted: 2004-7-20 1:01:00 Top

java-programmer >> Image from Web Thanks!

I got this error on my new Pc (win XP)...:

java.lang.NoSuchMethodError: getAccessibleTableFromContext............

java.lang.NoSuchMethodError: getAccessibleTableFromContext
at com.sun.java.accessibility.AccessBridge.run(Native Method)
at java.lang.Thread.run(Unknown Source)

What could be?

How can I fix it? It seems that java cannot access my HD.... or web...






"Andrew Thompson" <email***@***.com> wrote in message
news:nwb38989220j$.jomvjvbbyntj$email***@***.com...
> On Mon, 19 Jul 2004 18:28:35 +0200, _Mario_ wrote:
>
> > Hi all, I need to read an image located in
http://www.xxx.yyy/eee/test.jpg
> ..
> > How can I display once readed in a swing interface?
>
> <sscce>
> import javax.swing.*;
> import java.net.*;
>
> public class ShowImage {
>
> // trying to create an URL might produce
> // an exception, so throw it
> public static void main(String args[])
> throws MalformedURLException {
>
> // construct the URL
> URL url = new
> URL("http://www.physci.org/codes/all_inc/codes.gif");
>
> //make the frame
> JFrame f = new JFrame();
> // construct the icon
> ImageIcon icon = new ImageIcon(url);
>
> // add the icon to a label
> JLabel picLabel = new JLabel( icon );
>
> // add the label to the frame's cont pane
> f.getContentPane().add( picLabel );
>
> // pack the frame and make it visible
> f.pack();
> f.setVisible(true);
> }
> }
> </sscce>
>
> > thanks.
>
> No worries..
>
> --
> Andrew Thompson
> http://www.PhySci.org/ Open-source software suite
> http://www.PhySci.org/codes/ Web & IT Help
> http://www.1point1C.org/ Science & Technology


 
 
Andrew Thompson





PostPosted: 2004-7-20 1:14:00 Top

java-programmer >> Image from Web On Mon, 19 Jul 2004 19:00:53 +0200, _Mario_ wrote:

Please do not top-post Mario, it confuses me..
<http://www.physci.org/codes/javafaq.jsp#netiquette>

(Top-Posting corrected, see comments below)

> "Andrew Thompson" <email***@***.com> wrote in message
>> On Mon, 19 Jul 2004 18:28:35 +0200, _Mario_ wrote:
>>
>>> Hi all, I need to read an image located in
>>> http://www.xxx.yyy/eee/test.jpg
>>> How can I display once readed in a swing interface?
>>
>> <sscce>
..
>> </sscce>
..
> I got this error on my new Pc (win XP)...:
>
> java.lang.NoSuchMethodError: getAccessibleTableFromContext............

Are there some other bits you do not show?
<http://www.physci.org/codes/javafaq.jsp#exact>

> What could be?

It *could* be that your Java is 1.1.

What does this report for java.version?
<http://www.physci.org/pc/property.jsp?prop=java.version>

If it says 1.1.4, click the first 'JTest' link
and check the same thing in the program that
comes up.

> How can I fix it? It seems that java cannot access my HD.... or web...

We will not solve this by guessing Mario, you
need to figure exactly what that Exception means.

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology