How to display a dynamic image file from url?
Hey,I want to display a dynamic image file from url in applet.For example,a jpg file which from one video camera server,store one frame pictur for ever.My java file looks like here:
//PlayJpg.java:
import java.awt.*;
import java.applet.*;
import java.net.*;
public class PlayJpg extends Applet implements Runnable {
public static void main(String args[]) {
Frame F=new Frame("My Applet/Application Window");
F.setSize(480, 240);
PlayJpg A = new PlayJpg();
F.add(A);
A.start(); // Web browser calls start() automatically
// A.init(); - we skip calling it this time
// because it contains only Applet specific tasks.
F.setVisible(true);
Thread count = null;
String urlStr = null;
int sleepTime = 0;
Image image = null;
// called only for an applet - unless called explicitely by an appliaction
public void init() {
sleepTime = Integer.parseInt(getParameter("refreshTime"));
urlStr = getParameter("jpgFile");
// called only for an applet - unless called explicitely by an appliaction
public void start() {
count=(new Thread(this));
count.start();
// called only for applet when the browser leaves the web page
public void stop() {
count=null;
public void paint(Graphics g) {
try{
URL location=new URL(urlStr);
image = getToolkit().getImage(location);
}catch (MalformedURLException mue) {
showStatus (mue.toString());
}catch(Exception e){
System.out.println("Sorry. System Caught Exception in paint().");
System.out.println("e.getMessage():" + e.getMessage());
System.out.println("e.toString():" + e.toString());
System.out.println("e.printStackTrace():" );
e.printStackTrace();
if (image!=null) g.drawImage(image,1,1,320,240,this);
// called each time the display needs to be repainted
public void run() {
while (count==Thread.currentThread()) {
try {
Thread.currentThread().sleep(sleepTime*1000);
} catch(Exception e) {}
repaint(); // forces update of the screen
// end of PlayJpg.java
My Html file looks like here:
<html>
<applet code="PlayJpg.class" width=320 height=240>
<param name=jpgFile value="http://Localhost/playjpg/snapshot0.jpg">
<param name=refreshTime value="1">
</applet>
</html>
I only get the first frame picture for ever by my html.But the jpg file is dynamic.
Why?
Can you help me?
Thanks.
Joe
Hi,
Add this line inside your run() method, right before your call to repaint():
if (image != null) {image.flush();}Hope this helps,
Kurt.
Similar Messages
-
How use PHP to read image files from a folder and display them in Flex 3 tilelist.
Hello. I need help on displaying images from a folder dynamically using PHP and display it on FLEX 3 TileList. Im currently able to read the image files from the folder but i don't know how to display them in the TileList. This is my current code
PHP :
PHP Code:
<?php
//Open images directory
$imglist = '';
$dir = dir("C:\Documents and Settings\april09mpsip\My Documents\Flex Builder 3\PHPTEST\src\Assets\images");
//List files in images directory
while (($file = $dir->read()) !== false)
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
echo "filename: " . $file . "\n";
$dir->close();
?>
FLEX 3 :
Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="pic.send();">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.events.ItemClickEvent;
import mx.rpc.events.ResultEvent;
public var image:Object;
private function resultHandler(event:ResultEvent):void
image = (event.result);
ta1.text = String(event.result);
private function faultHandler(event:FaultEvent):void
ta1.text = "Fault Response from HTTPService call:\n ";
]]>
</mx:Script>
<mx:TileList x="31" y="22" initialize="init();" dataProvider = "{image}" width="630" height="149"/>
<mx:String id="phpPicture">http://localhost/php/Picture.php</mx:String>
<mx:HTTPService id="pic" url="{phpPicture}" method="POST"
result="{resultHandler(event)}" fault="{faultHandler(event)}"/>
<mx:TextArea x="136" y="325" width="182" height="221" id="ta1" editable="false"/>
<mx:Label x="136" y="297" text="List of files in the folder" width="182" height="20" fontWeight="bold" fontSize="13"/>
</mx:Application>
Thanks. Need help as soon as possbile. URGENT.i have made some changes, in the php part too, and following is the resulting code( i tried it, and found that it works.):
PHP Code:
<?php
echo '<?xml version="1.0" encoding="utf-8"?>';
?>
<root>
<images>
<?php
//Open images directory
$dir = dir("images");
//List files in images directory
while (($file = $dir->read()) !== false)
if (eregi("gif", $file) || eregi("jpg", $file) || eregi("png", $file))
echo "<image>" . $file . "</image>"; // i expect you to use the relative path in $dir, not C:\..........
//$dir->close();
?>
</images>
</root>
Flex Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="callPHP();">
<mx:Script>
<![CDATA[
import mx.rpc.http.HTTPService;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.events.ItemClickEvent;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var arr:ArrayCollection = new ArrayCollection();
private function callPHP():void
var hs:HTTPService = new HTTPService();
hs.url = 'Picture.php';
hs.addEventListener( ResultEvent.RESULT, resultHandler );
hs.addEventListener( FaultEvent.FAULT, faultHandler )
hs.send();
private function resultHandler( event:ResultEvent ):void
arr = event.result.root.images.image as ArrayCollection;
private function faultHandler( event:FaultEvent ):void
Alert.show( "Fault Response from HTTPService call:\n " );
]]>
</mx:Script>
<mx:TileList id="tilelist"
dataProvider="{arr}">
<mx:itemRenderer>
<mx:Component>
<mx:Image source="images/{data}" />
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
</mx:Application> -
Dynamic Image (.gif) from URL into adobe Form by SFP
Hi all
I post the comment of Shamila because I have the same problem
I need to place an image in the Adobe form based on the url.
I have written the following formcalc script in the image field form ready action
ImageField1.value.image.href = "http://www.adobe.com/imageshome/pdfgift_home.gif"
But when i view the form , the image field is empty, and when i click on the blank space of the image field, a popup appears to select the image............
How can i show the image from url in the form..........
Regards,Hello,
have you checked these basics documents?
When you need to send a picture into the offline form: another image question - using Regular ABAP not web dynpro and Display a logo dynamically in adobe form
Where to start with scripting: http://www.adobe.com/devnet/livecycle/articles/lc_designer_scripting_basics/lc_designer_scripting_basics.pdf
http://help.adobe.com/en_US/livecycle/es/FormCalc.pdf
Also try: Re: Dynamic R/3 Image URL in Adoeb Form
regards, Otto -
How can I make an image file from/to a V240 SPARC workstation?
Scenerio: I have 4 V240 SPARC Workstations on a network. 1 of these servers is set up the way I want it with all necessary applications and drivers. I had assistance from a number of good people to do this and now I want to preserve this scsi image and put it on all the other workstations. I have tried to use G4U but the SPARC system will not boot from the cd. This cd is usable on other x86 systems. Is there something different with "SPARC" as compared to "x86"? Is it possible to get some "freeware/shareware" software that will allow me to perform the similar functionality as G4U for the SPARC system? If not, how is imaging performed on SPARC and by what?
Thanks in advance
PandahSPARC and x86 have entirely different instruction sets. A SPARC system (as you found out), will not run x86 code.
Have you looked into Solaris Jumpstart technology? -
Is anyone know how to create dynamic pdf file from a JSP page or Servlet ?
Hi
Is any one know how to create a dynamic PDF file from JSP or servlet. I need to have standard form format needs to be created and want to send the info to that form dynamically.
Is there any libraries available?
ThanksI posted a link in this thread to a lib that lets you create PDFs from an app. They have a Java version. I have not used it but I know someone who used it with Microsoft ASP and they liked it.
http://forum.java.sun.com/thread.jsp?forum=31&thread=287285
-S- -
How to remove image files from audio files
i dont understand enough about how itunes worked...So my problem is, when i would add album art to a song, i would copy and past to the artwork box on the song. When i would find a better image, i would just past over the last one, not realizing that it was actually adding another image. This form of Copy/past(as i understand) saves the image to the audio file. *My question:* how do i remove the image files from the audio files...?
Right click on the file you want to remove the artwork from, choose Get Info then the Artwork tab, click on the image and press the delete button then OK. To remove from multiple items, highlight the adjacent tracks in your selection (click on the first in the list, hold down the shift key and click on the last), right click and choose Get Info, choose yes when you are asked if you want to edit multiple items, tick the box beside the small empty artwork window about halfway down on the right. (if the songs aren't adjacent to each other but spread through out the playlist or library CTRL & Click on each of the songs you want to highlight)
-
How to locate the correct image file before reading/saving it
Hi,
I would like to find out how to copy/save/read image files from certain website in Java, particularly to locate the right one from various relative URL links on the same website. Below is an example to look at:
On the main web page
By selecting (http://www.abc.com/Public/Details.aspx?adid=2007103609) on a tiny camera icon that consist of source code (<td class="even"><a target="_blank" href="http://www.abc.com/Public/Details.aspx?adid=2007135110"><img src="/images/camera.gif" width="19" ...></a></td>) directed me to another page with the actual photo.
The source code of this secondary page where the photo is located are as follows:
<script language="JavaScript" type="text/javascript"><!--
</script>
<style type="text/css">@import url("http://fdimages.def.com.au/cui/netstrip-20050427.css");</style>
<div id="networkStripTop">
<a href="http://www.def.com.au/" onclick="linktop(this);" target="_top"><img src="http://fdimages.def.com.au/cui/digital.gif" height="17" width="95" class="logo" alt="DEF Digital" /></a>
<div class="links">Any suggestion would be much appreciated.
Many thanks,
JackHi All,
Could someone give me a hand with suggesting on how to locate the correct links (from multiple web pages) of the image file? I still could not proceed further on this issue.
There is no problem with saving/reading the file once it is accurately identified.
Please move it to the Java Technology & XML forum if it is not already in it.
Many thanks,
Jack -
How to upload and overwrite a file from a dynamic list
I need to come up with a way to upload and overwrite and existing image file from a dynamically generated list. For instance, there would be a drop-down select box with Company A, Company B, Company C, etc. and when the user selects one of them it should display a prompt to upload a new logo image file, overwriting the existing logo file. Any help would be appreciated.
I'm not sure why you need a prompt. Sounds like an unnecessary annoyance to me.
A simple form with a select and input type="file" should get you started. Then I would probably do something like:
1. upload the file to a temp folder on your server.
2. Rename it according to what company was selected.
3. Move it to it's permanent folder. -
How to display servlet dynamically generated image ?
Hi,
How to display servlet dynamically generated image ?
I have a servlet generating a buffered image in the doGet. I want to display the image in a jsp page with other information. I'm not able to get it properly displayed.
**Try n# 1 **************************************************************
This displays my image but nothing elle :
ServletOutputStream sos = pResponse.getOutputStream();
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
encoder.encode(img);
**Try n# 2 ****************************************************************
I tried also :
In the servlet :
request.setAttribute("renderedImage", img);
and in the jsp page :
BufferedImage image = (BufferedImage) request.getAttribute("renderedImage");
<img src="<%=ImageIO.write(image,"jpeg",response.getOutputStream())%>" width="300" height="280"/>
This last try draws big crap in the jsp page, thank you in advance.
NelsonCall another servlet from the IMG tag. Have the servlet stream out the image using ImageIO (instead of writing HTML).
-
How to Insert image file from fileChooser to a tabbedPane?
Hi,
Currently, i have encounted a problem halfway through my project. That is how do i insert images into a tabbedPane after selecting a image file from the fileChooser?
Do anyone has any idea of how to solve the above problem?
Thanks!!I would put the image in a JLabel and put the JLabel in the tabbed pane.
-
How to transfer image files from nikon d800 to ipad4?
How to transfer jpeg image files from nikon d800 to IPad 4?
Are you having a problem? What have you tried? Do you have Apple's camera connection kit?
With the CCK, you can connect the camera or the camera's SD card.
iPad iOS 6 Update - Camera Connection Kit Fix
http://www.georgewheelhouse.com/blog/2012/10/ipad-ios-6-update---camera-connecti on-kit-fix
Cheers, Tom -
How to start the Toshiba Ghost image files from the HDD
Hello
Ok this is a tough one but hopefully some tech/wizz can help me out.
I have all the necessary CD Recovery disc but my Toshiba laptop CDRom has died and i'm looking for replacement at the moment.
I have managed to copy the image files and all the other info from these CD's onto the laptop hard drive via a network from my desktop cdrom. I did try to use the desktop cdrom to boot the 2.5" laptop drive but it knew it wasnt a toshiba laptop so wouldn't let me recovery.
However now I have manage to copy all the ghost image files onto the laptop hdd I'm stuck on how to run installation via dos.
The laptop hdd is formatted and all i have are the following files
span.bmp
setenv.bat --------> batch file contains following lines
@ECHO OFF
SET GHOSTPAR=
SET SWN=01237000
SET EXT=GHO
SET VOLLABEL=%SWN%
SET FILENAME=%SWN%.%EXT%
01237001.GHS------> PART 2 OF IMAGE
01237000.GHO -----> GHOST IMAGE MAIN
01237000.CRC
A folder called G_INST
which contains 3 extra folders BMP, DOS and TOOLS and span.bmp
I cant figure out how i can run ghost to extract and recovery my HDD can someone help me :)
Thanks in advance
SimonIm really skeptical if you will be start the Toshiba ghost image files from the second partition without using the Symantec Norton Ghost software.
I have created a ghost image of the C partition and placed it on the D partition.
To recover the C partition I have to start the Ghost Utility and have to use the image file .gho from D partition
I have googled a little bit and found the useful instruction how to recover the Portege M3500 without using an CD/DVD drive. Maybe this will run also on the Sat A30.
http://mobilepcwiki.com/mpc/index.php?title=Toshiba/Portege_M3500/FAQ
By the way: the internal, compatible ODD can be ordered from the ASP in your country! -
HT204003 how can i print a boarding pass image file from passbook?
how can i print a boarding pass image file from passbook?
I do not believe that Passbook supports printing. You can email, but not print. Then again I'm not sure what it actually emails, if that is a graphic of the card or what. I'm going to try it with my Starbuck's card, but there is no setting for printing within Passbook.
EDIT: Actually it sends the email as an attachment for a Passbook card file, that cannot be handled by my computer. Hope that answers your question.
Message was edited by: ChrisJ4203 -
How to make a image file from Pre installed Mac osx ? "PLEASE HELP :("?
hey guys ..Thanks u for the time.
So i have this eMac which has crashed and i have got may hands on another eMac.. and it works
... the only problem is.. I can take my eMac to the working eMac to do Target Mode or any thing...
So Help me..
My question is .. Is there a way to make a .DMG image file from pre installed mac osx OR
Is there a way to may a recovery disc??You can use Carbon Copy Cloner to copy everything from the working eMac onto the non-working eMac while the working eMac is running. If your eMac will still do target mode into the working one, you can download the above software, select the booted drive as the source drive, and your eMac's drive as the target, however it is possible this will not work.
When you say your eMac crashed, what exactly happened? It is possible that the hard drive in your eMac failed or is failing, so in order to get it running again you would need to replace the hard drive. On the eMac, this repair is somewhat involved, and you have to be very careful because it exposes the CRT, which has several areas which can be extremely dangerous to touch if not properly handled. CRTs retain a great deal of voltage, even when unplugged, sometimes for weeks, and they can give you a nasty shock if you touch them in the wrong place.
Also keep in mind that cloning from the working computer to the non-working computer will ERASE any data that you have stored on that eMac, so if you don't have it backed up anywhere, you may want to attempt that with target mode before proceeding.
Good luck! -
How to Copy an Image File from a Folder to another Folder
i face the problem of copying an image file from a folder to another folder by coding. i not really know which method to use so i need some reference about it. hope to get reply soon, thx :)
Try this code. Make an object of this class and call
copyTo method.
import java.io.*;
import java.net.*;
import java.util.*;
public class FileUtil
extends File {
public FileUtil(String pathname) throws
NullPointerException {
super(pathname);
public void copyTo(File dest) throws Exception {
File parent = dest.getParentFile();
parent.mkdirs();
FileInputStream in = new FileInputStream(this); //
Open the source file
FileOutputStream out = new FileOutputStream(dest); //
Open the destination file
byte[] buffer = new byte[4096]; // Create an input
buffer
int bytes_read;
while ( (bytes_read = in.read(buffer)) != -1) { //
Keep reading until the end
out.write(buffer, 0, bytes_read);
in.close(); // Close the file
out.close(); // Close the file
This is poor object-oriented design. Use derivation only when you have to override methods -- this is just
a static utility method hiding here.
Maybe you are looking for
-
How do I stop QuickTime from changing music files to movie files?
I use iTunes exclusively for music & have recently noticed that downloaded files (usually midi files) are showing up in my iTunes library as QuickTime movie files. I usually use Firefox for music downloads but occasionally use AOL, which uses IE. To
-
[svn:osmf:] 14903: ChromeLibrary update:
Revision: 14903 Revision: 14903 Author: [email protected] Date: 2010-03-22 05:28:17 -0700 (Mon, 22 Mar 2010) Log Message: ChromeLibrary update: Unbinding chrome font and visuals from the ChromeLibrary project, Introducing asset loaders, that c
-
ok so i have a working internet connection if i connect directly to the modem. i take the ethernet and plug it into TC and run the network wizard to setup everything up and it was working says no internet connection get the flashing amber. played wit
-
Queries with ":" failing in TimesTen 11.2.1 ..NodeId :NodeId
After upgrading to TimesTen 11.2.1, we've notice that some of our current sql statements are failing. These same instructions executes from the applications on TT6.0. This is once of the selects that is failing. select NodeId , Idx from Santera.eswi
-
How canI download an app which refuses to download? It states in my purchases that I have the app. But it does'nt appear on my iPad.