Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


java applet displaying image from raw bytes received by socket

Posted on 2003-03-15
Medium Priority
Last Modified: 2006-11-17
I have an Applet which receive data packets and MUST display images from the received data.
All stuff is done except the image displaying.
The data is a complete jpeg file.
It would be easy to write a file, but the applet security doesnt allow this since i dont have and dont plan to buy a signature.

Is there another way to do this?
If you have please send me an working sample code.

Question by:neanderthal
  • 3
  • 3
LVL 86

Expert Comment

ID: 8144915

Image i = new ImageIcon(byteArray).getImage()


Image i = Toolkit.getDe

LVL 86

Accepted Solution

CEHJ earned 2000 total points
ID: 8144919
Image i = Toolkit.getDefaultToolkit().createImage(byteArray)

Author Comment

ID: 8151134
I will try this and return you a position.
Do you have some similar code?

Really thanks a lot
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 8223904
Works pretty fine. Thanks a lot.

By the way do you know how to force a immediate repaint of canvas?

I'm trying to use the following code but repaint occurs eventually, not in all calls.

Graphics g = getGraphics();
if (g != null)

LVL 86

Expert Comment

ID: 8223917
Why not just call repaint?

Author Comment

ID: 8224514
repaint does not execute a repaint at the time of call, seems it waits until its event to be processed later, in this situation i call repaint in a loop and nothing happens until i move or resize window.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question