JMF Effect Class, fast conversion of Buffer to an ImageFormat

public int process(Buffer input, Buffer output) {
        if (debug) {
            time = System.currentTimeMillis();
        int outputDataLength = ((VideoFormat) outputFormat).getMaxDataLength();
        super.validateIntArraySize(output, outputDataLength);
        Dimension size = ((VideoFormat) outputFormat).getSize();
        output.setLength(outputDataLength);
        output.setFormat(outputFormat);
        output.setFlags(input.getFlags());
        int inn[] = (int[]) input.getData();
        int out[] = (int[]) output.getData();
//        System.arraycopy(inn, 0, out, 0, inn.length);
        if (im == null) {
            im = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
        im.setRGB(0, 0, size.width, size.height, inn, 0, size.width);
// lots of formating
        im.getRGB(0, 0, size.width, size.height, out, 0, size.width);
        if (debug) {
            System.out.println("Frame time: " + (System.currentTimeMillis() - time));
        return BUFFER_PROCESSED_OK;
    }This is the form of the process function in an Effect class I wrote. The problem is that only im.setRGB & im.getRGB are taking me up to 400 ms. That means the movie is screwed...
Do you know, by any chance a faster method?
This problem occurs when images are large: 800x600, 1024x728, 1280x1024 (I use the Effect class to play with images taked fron an ipCamera).

public int process(Buffer input, Buffer output) {
        if (debug) {
            time = System.currentTimeMillis();
        int outputDataLength = ((VideoFormat) outputFormat).getMaxDataLength();
        super.validateIntArraySize(output, outputDataLength);
        Dimension size = ((VideoFormat) outputFormat).getSize();
        output.setLength(outputDataLength);
        output.setFormat(outputFormat);
        output.setFlags(input.getFlags());
        int inn[] = (int[]) input.getData();
        int out[] = (int[]) output.getData();
//        System.arraycopy(inn, 0, out, 0, inn.length);
        if (im == null) {
            im = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
        im.setRGB(0, 0, size.width, size.height, inn, 0, size.width);
// lots of formating
        im.getRGB(0, 0, size.width, size.height, out, 0, size.width);
        if (debug) {
            System.out.println("Frame time: " + (System.currentTimeMillis() - time));
        return BUFFER_PROCESSED_OK;
    }This is the form of the process function in an Effect class I wrote. The problem is that only im.setRGB & im.getRGB are taking me up to 400 ms. That means the movie is screwed...
Do you know, by any chance a faster method?
This problem occurs when images are large: 800x600, 1024x728, 1280x1024 (I use the Effect class to play with images taked fron an ipCamera).

Similar Messages

  • How to export as mp4 and achieve effect of "fast start" in mov export

    When exporting as a .mov one can check the "fast start" prepare for internet streaming option. This option allows the end user to start watching your video without waiting for the entire file to buffer/download. That's great.
    However, when export as a .mp4 file, the same option does not exist.
    Does anyone know how to achieve this "fast start" effect if exporting as an mp4?
    I have an existing work around...just rename the .mov to .mp4.
    I would like an .mp4 file because I use ezs3 to host my videos and the mp4 player options are far superior to the mov player options.
    Thanks for your help.

    I'm having the same problem. I want to export an .mp4 that can start playing as soon as it starts downloading from a web site. Until I can find a solution, I'm using .m4v files, but they're huge.
    Does anyone have a solution?

  • After Effects CS3 & YUV conversion : total mess

    Hello all,
    Should be a point many times discussed, but not solved : YUV to RGB conversions done in AE8.
    I am videographist, I work on Mac, and I'm something like 20 years experience. I tell you this to avoid usual recommandations and useless pre-checkups...
    I was recently on 10.4 OS with a quad G5, and I just switched to MacPro 8 core, running 10.5 OS.
    My video board is a Kona3, that's now exclusively with Pal HD IO (1920*1080 YUV 10 bit).
    As 10bit uncompressed is just a pain in the ***, I decided to use 10bit HQ ProRes, which works like a charm, at least until I have to go out and come back to FCP...
    From what I saw, uncompressed 10bit YUV is correctly interpreted as a footage in AE8. There's a slight gamma shift when previewing AE comp thru Kona3 preview, but once back in FCP, gamma shift is just gone.
    BUT ProRes is totally misinterpreted, and huge color shifts are occuring, with no easy or correct way to fix it. If some of you wanna make a short test, I can recommand exporting FCP bars, as ProRes QT, and import into AE. Look at what you now have : total crap.
    I've been playing with color management, Rec709 simulation on/off, footage interpretation as Rec709 on/off, only slight differences occur, and for sure nothing related to signal shifts I can see...
    So what the f**k ?
    Is it a known problem at Adobe ? As many post companies are actually switching to HD, buying new computers, new video boards, looking for new consistent HD workflows, is Adobe aware of the trouble this issue can cause ?
    That said, is there a way to fix this by hand ?
    I know there's a famous "interpretation rules 802" text file, supposed to contain rules to interpret many formats, but I can't figure out what to do in it...
    Anyone with such knowledge around here ?
    Am I alone with this issue ?
    Thanx for your help
    David

    Hey Andrew,
    The gamma issue is for sure a misunderstanding problem between apple & adobe.
    Does Prores can be seen as faulty when it works like a charm inside fcp or any of the fcp suite software ? I'm not that sure...it may yes, but I just don't know.
    Also, Quicktime, even being sometimes dirty, dictates the way to go. It's not an opinion, it's a fact. My workflow is entirely dependent of QT, and AE is a great software but still supposed to handle QT seamlessly, what he doesn't actually...
    But my question was more "how to fix it" than "who's guilty"...
    10bit uncompressed is just too fast & too big for me.
    I have 2x 500Go Huge systems, but disks are not very stable at that datarate, and files are just huge..
    Maybe bigger & faster drives would be a solution ;)

  • Time machine effect with fast user switching

    I already calculated it will take 11 hours to do my initial back up of 420 gb. but my Gf wants to login. I am certain this will at least slow to process down if not pause or cancel. does any one know for sure?

    Audio output is squelched when fast user switching. Under Panther, audio playing in one user account would continue to play after fast user switching to another account. Under Tiger, the actual process continues, but the sound is muted.
    Same thing goes for audio input. I learned this the hard way by setting up an app to record a two hour radio program through the built-in audio input jack. During the recording I switched to another account for an hour. When I later went to listen to the recording, there was an hour of silence corresponding to the time I was in the other account.
    I really wish Apple would fix this.

  • JSP to class file conversion

    Hi all,
    I'm having a small problem. As we know JSP is converted to class file before execute. So I would like to know where this temp class files are created.
    Specially in Weblogic Server.
    Lakmal
    [email protected]

    Where the class files are created is totally dependant on the implementation of the server.
    Tomcat has a "work" directory where it puts all the generated java and class files from jsps.
    A quick google turned up [this page|http://m-button.blogspot.com/2008/09/using-jsp-precompilation-in-weblogic.html] which mentions the default location for the classes.
    cheers,
    evnafets

  • Class File conversion

    Hi All
    I am new to webforms and can any one pls do let me know what is the component that is converting fmx files into class files.
    any white paper links pls refer to me.
    Thanks In advance
    sasidhar.p

    Hi,
    there is no need to convert fmx files into class files. The Forms Services runtime engine interprets fmx files and displays them as an Applet in the browser
    Frank

  • Can style sheets effect how fast edits can be made in InCopy?

    Issue has happened using both CS5 and CS6.
    InDesign user (designer) is on a Mac Pro (OS X 10.8.4)
    InCopy user (writer) is on PC (Win7sp1 64 bit)
    Normally, the workflow between InDesign and InCopy is smooth, however I’ve encountered issues when working with larger InDesign documents. The file I have issues with is 100 pages of flowed text (no images, no master pages) with 17 character styles and 24 paragraph styles.
    When the writer tries to make text edits in InCopy, it takes anywhere from 5-45 seconds to make a change (for example; deleting a space may take 5 seconds, while getting rid of a paragraph return takes 45 seconds).
    Troubleshooting this problem a few months ago, I narrowed down that the issue was coming from the style sheets in InDesign (when I ran the same text without any style sheets, the writer was able to make InCopy edits without a problem).
    I then recreated the style sheets from scratch (instead of importing them from the previous catalog like we normally do) and that seemed to fix the issue. Now, with the current catalog we just started working on, we’re running into the same problem with slow edits in InCopy. I imported the style sheets from the file that worked last time (with the new style sheets I built) but that didn’t work this time around.
    Is it possible to have a “corrupt” style sheet that would cause this issue? I’m not sure if the slowness is coming from style sheets or something else entirely. Any thoughts or suggestions on where this problem might be coming from would be greatly appreciated.
    Thanks for your time!
    Tracy

    • create a vertical Gradient Layer black to nothing
    • create a horizontal Gradient Layer nothing to white to nothing
    • apply »Create Clipping Mask«
    • add black background
    • convert that whole stack of layers to a Smart Object or flatten it (being as CS3 will not support perspectival transformation of SO)
    • invoke Edit > Transform > Perspective or Warp
    • create a Gradient Map Layer blue to cyan (or whatever) and clipping mask it to that layer
    • set the Gradient Map Layer to Color and the Layer with the Gradient to Screen (that way it should work on all backgrounds)
    • if necessary apply some Gaussian Blur to the gradient layer

  • Help for Image detection in video & hardware issues

    Hi,
    I am trying to develop a web app that lets the user select shapes in a video(user can click only on detected shape if clicked elsewhere it should inform user to click only on the detected shape)
    Then the location of the clicked position is determined & a robotic arm(at remote location) is moved to that position
    I am a newbie on JMF
    I do have a solution: load video on an applet(which can help in determining location of click but how would it know that the clicked position has the detected shape or not)
    And here are my questions:
    Is solution right?
    Are there other solutions that i miss up?
    What is the best language for hardware (microcontroller) programming here?
    Is interaction between JMF & remote hardware possible & how?
    Thank u all in advance

    saurabh.nigam wrote:
    Is solution right?The thing you're calling a "solution" doesn't appear to be a solution. Normally, solutions don't have questions embedded in them...
    Are there other solutions that i miss up?Again, you're not being clear and you're nowhere near a solution...
    What is the best language for hardware (microcontroller) programming here?That's not a question for this forum. This forum is for questions about the JMF API...
    Is interaction between JMF & remote hardware possible & how?Yeah, you can always send commands via a socket using normal Java stuff. JMF isn't a special langauge or anything, it's just some Java classes that do media stuff...
    In order to do what you're wanting to do, you'd have to implement a series of "not easy" things to implement.
    1) You'd need to implement some sort of blob detection / extraction code that would take in an image and detect / extract the blobs in it.
    2) You'd need to implement some sort of blob shape filter that would filter out all of the detected blobs that aren't a shape you're happy with
    3) You'd need to embed your blob code into a JMF effect class so it could process video frames as they come through
    4) You'd probably also want to augment the video stream with outlines or translucent colored regions to indicate to the user where the clickable blobs are...
    5) You'd need to implement a socket-based control protocol for controlling the remote hardware.
    All of that is possible with Java / JMF, but none of it is easy.

  • * JMF PlugIn Effect/Codec Filter for Motion Detection : Source Example *

    I have noticed some posts on here recently about reading a webcam�s pixel stream and as at least one example the processing of that data for robotics, or another for motion detection or tracking.
    This can mean a requirement for fast frame processing, setting the datasource framerate, and to implement as easily as possible; eg a simple JMF effect or codec plugin to set on the processor.
    I have a link as follows to some source and examples for such plugin effects, and some of you may find this interesting if not also useful.
    See an updated http://www.exactfutures.com/index02.htm for the new download. Enjoy.

    thanx Andy

  • Video editing 'special effects': can you apply a fast/slow motion effect to video clips?

    I haven't been able to find a way to create the effects of fast or slow motion in the video clips. Is there a way to do this? If not, please consider adding it in the full version - I use these effects alot when editing videos.
    Thanks!

    Hi,
    When working with a video layer (clip) in the Timeline panel, either 1.) Context-click on the selected clip (right-click or ctrl-click for mac) or 2.) Click on the flyout button located at the top right corner of the clip.
    The "Speed" option should show up in the flyout menu.  This is only available for video layers.  If you're working with still or smart objects the speed option is not available.

  • How to render/export fast in Adobe After Effects CC

    Hi,
    How can I export and render fast in Adobe After Effects, I bought a new PC but it's not quick enough in my opinion.
    I want to export a 1920*1080 60FPS project, 10 seconds long. It takes a very long time.
    I have already set my GPU as processor but if I start the render and look at my GPU usage, After Effects won't use it.
    Screenshots of my project and settings:
    Project - https://snapr.pw/i/b18473e4cc.png
    Momory - https://snapr.pw/i/e92cb228a9.png
    Cache - https://snapr.pw/i/30addc6d0c.png
    GPU - https://snapr.pw/i/2b36b10748.png
    Computer system: popoqwerty - Profiel - Tweakers
    CPU - Intel Core i7- 8520K six-core
    GPU - Asus GTX 780 OC 6GB STRIX
    MOBO - Asus X99-A
    RAM - 16GB Crucial
    SSD - Samsung SSD PRO 850
    HDD - WD Black 2TB

    > How can I export and render fast in Adobe After Effects,
    See this page for resources about making After Effects work faster: http://adobe.ly/eV2zE7
    > I have already set my GPU as processor but if I start the render and look at my GPU usage, After Effects won't use it.
    After Effects uses the GPU for almost nothing. See this page for details of GPU features in After Effects:
    GPU (CUDA, OpenGL) features in After Effects
    > A ''verry long time'' is 10 minutes for a 10 second video.
    10 minutes is not a long time for a 10-second movie with visual effects, compositing, 3D, or many other kinds of computationally intensive processing. Often, people leave 30-second movies overnight or over the weekend to render. This is true for all aoftware that does this kind of work, not just After Effects.

  • Adding Effect on an incoming H.263/RTP stream

    Hi,
    I am playing an h.263/rtp stream which is multicasted over a network. I want to play the file with rotation or some other effect added to it. I tried to see following link for some help(as the forums suggested):- http://java.sun.com/products/java-media/jmf/2.1.1/solutions/RotationEffect.html. But the link is disabled and new link which they are providing does not contain the example.
    Can any of me help me how to add the effect on h263/rtp.
    Though i already created my effect class and tried adding it. But could not add the effect.
    Kindly give me some directions.

    Is there some error in above code or if there is some other issue.There's an error in the above code because you're assuming I'm being imprecise with my language. I am not.
    You must copy the data from the input buffer to the output buffer...
    Buffer objects are wrappers around byte[], and you cannot copy data from one array to another by modifying the object references...which is what your code does.
    public int process(Buffer inBuffer, Buffer outBuffer) {
        // Make sure the output buffer will hold data
        if (!(outBuffer.getData() instanceof byte[])) {
            outBuffer.setData(new byte[inBuffer.getLength()]);    
            outBuffer.setLength(inBuffer.getLength());  
            outBuffer.setOffset(0);
        // Make sure the output buffer is long enough
        if (outBuffer.getLength() + outBuffer.getOffset() < inBuffer.getLength())) {
            int offset = outBuffer.getOffset();
            int length = inBuffer.getLength() + outBuffer.getOffset();
            byte[] oldData = (byte[])outBuffer.getData();
            byte[] newData = new byte[length];
            // Copy the previous data
            for (int i = 0; i < offset; i++) {
                newData[i] = oldData;
    // Set the variables for the output buffer
    outBuffer.setData(newData);
    outBuffer.setLength(length);
    outBuffer.setOffset(offset);
    // Copy the data from in to out
    int j = outBuffer.getOffset();
    for (int i = inBuffer.getOffset(); i < inBuffer.getOffset() + inBuffer.getLength(); i++) {
    ((byte[])outBuffer.getData())[j++] = ((byte[])inBuffer.getData())[i];
    return BUFFER_PROCESSED_OK;
    That's untested code above, fix my dumb mistakes as necessary.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to copy large files - fast

    Hi, here is an I/O challenge: I need to copy large binary files under windows in one of my apps. File size can be above 2 GB. The copying should be as fast as possible. What would be the fastest way to do this?
    Here is what I've tried so far:
    1) Use FileInputStream/FileOutputStream with a byte buffer (see copy1 below)
    2) Use BufferedInputStream/BufferedOutputStream (see copy2 below)
    3) Use java.nio.FileChannel#transferTo (see copy3 below)
    4) Use a shell copy command (see copy4 below)
    Testing the four methods with a 500 MB file I get
    1) 525271525 Byte in 47141 ms (11142 kByte/s)
    2) 525271525 Byte in 68969 ms (7616 kByte/s)
    3) 525271525 Byte in 38765 ms (13550 kByte/s)
    4) 525271525 Byte in 37984 ms (13828 kByte/s)
    This is on a Pentium 4, 2.4 GHz, 512 MB RAM, Windows XP with JDK 1.4.2.
    Hence, my favorite method would be 3), since it is more portable than 4).
    However, with java.nio.FileChannel#transferTo I get exceptions for files larger than 2 GB. The exception is
    java.io.IOException: Falscher Parameter
      at sun.nio.ch.FileChannelImpl.map0(Native Method)
      at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:673)
      at sun.nio.ch.FileChannelImpl.transferToTrustedChannel(FileChannelImpl.java:421)
      at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:490)leading me to suspect that the long values used by Java to specify the file length are not supported by the native code, and that they may be downcast to a 32-bit signed number. (If anyone could shed some more light on this, I'd be grateful!) So, is there a better way than using 4), a shell copy command?
    Following is the code I used to for my test:import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.nio.channels.FileChannel;
    /** Class for testing different ways to copy files */
    public class TestCopy
      /** i/o buffer size */
      public static final int BUF_SIZE = 1024 * 1024;
      /** Copy method, using FileInputStream and byte buffer */
      void copy1(File source, File target) throws IOException
        FileInputStream in = new FileInputStream(source);
        FileOutputStream out = new FileOutputStream(target);
        byte[] buf = new byte[BUF_SIZE];
        int i;
        while ((i = in.read(buf, 0, BUF_SIZE)) != -1)
          out.write(buf, 0, i);
        in.close();
        out.close();
      /** Copy method, using BufferedInputStream */
      void copy2(File source, File target) throws IOException
        BufferedInputStream in =
          new BufferedInputStream(new FileInputStream(source), BUF_SIZE);
        BufferedOutputStream out =
          new BufferedOutputStream(new FileOutputStream(target), BUF_SIZE);
        int i;
        while ((i = in.read()) != -1)
          out.write(i);
        in.close();
        out.close();
      /** Copy method, using FileChannel#transferTo */
      void copy3(File source, File target) throws IOException
        FileChannel in = new FileInputStream(source).getChannel();
        FileChannel out = new FileOutputStream(target).getChannel();
        in.transferTo(0, in.size(), out);
        in.close();
        out.close();
      /** Copy method, using command shell copy */
      void copy4(File source, File target) throws IOException
        Process p =
          Runtime.getRuntime().exec(
            new String[] {
              "cmd",
              "/C",
              "copy",
              "/Y",
              "/B",
              source.getAbsolutePath(),
              target.getAbsolutePath()});
        int j;
        try
          j = p.waitFor();
          if (j != 0)
            throw new IOException("copy returned exit code " + j);
        catch (InterruptedException e1)
      public static void main(String[] args)
        if (args.length != 2)
          System.out.println("usage: java TestCopy <sourceFile> <targetFile>");
          return;
        File source = new File(args[0]);
        File target = new File(args[1]);
        if (!source.exists())
          System.out.println("File not found: " + args[0]);
          return;
        TestCopy tc = new TestCopy();
        try
          long time = System.currentTimeMillis();
          tc.copy1(source, target);
          time = System.currentTimeMillis() - time;
          System.out.println(
            "Copy1: "
              + source.length()
              + " Byte in "
              + time
              + " ms ("
              + source.length() / time
              + " kByte/s)");
          time = System.currentTimeMillis();
          tc.copy2(source, target);
          time = System.currentTimeMillis() - time;
          System.out.println(
            "Copy2: "
              + source.length()
              + " Byte in "
              + time
              + " ms("
              + source.length() / time
              + " kByte/s)");
          time = System.currentTimeMillis();
          tc.copy3(source, target);
          time = System.currentTimeMillis() - time;
          System.out.println(
            "Copy3: "
              + source.length()
              + " Byte in "
              + time
              + " ms("
              + source.length() / time
              + " kByte/s)");
          time = System.currentTimeMillis();
          tc.copy4(source, target);
          time = System.currentTimeMillis() - time;
          System.out.println(
            "Copy4: "
              + source.length()
              + " Byte in "
              + time
              + " ms("
              + source.length() / time
              + " kByte/s)");
        catch (IOException e)
          e.printStackTrace();
    }Cheers, HJK

    Hmm, I guess I have to agree with jschell. Runtime.exec("cmd /c copy <file1> <file2>"); is the way to go.
    The FileChannell#transferTo method in a loop, as asjf suggested, is not much slower, but it's a workaround. Using JNI to call the system command, is probably not worth the effort. I can't see how it will be faster than calling the shell copy command.
    Thank you all for your help! Cheers, HJK

  • Beginner Question. need opinion on using JMF

    i am hoping to use JMF to have a audio/video chat session . it will be like there will be 5 PC's . and 1 PC will be streaming a video, the other 4 PC's will be showing it.
    what i want to do is to draw lines or make some mark on the video thats been telecast (from the other 4 PC's), and that change to be shown on all 5 PC's
    is this do-able ? and i hope my question was not confusing .

    localpott wrote:
    is this do-able ?Yes. JMF has the built-in capability to broadcast a stream to multiple participants simultaniously, and it works a lot like email. You just add a few more recipients to the list before you press send.
    As for drawing on the video, that'd be relatively easy to do. You'd just need to develop a layering system, whereby a "bottom" layer renders the video frames, and the upper layer renders / modifies the drawing. You'd just then need to create a video "Effect" class that would grab the upper layer, render it on top of the current video frame, and then it would come out of the Processor with the drawing on it.

  • Double Buffer

    Hi all,
    I've just written this Digital Clock in Java and I'm trying to add a double buffer to it to stop it flickering however I get 4 errors when I try to compile it. Here is the code:
    (START OF CODE)
         import java.awt.*; //puts in abstract windows toolkit to get output on screen
         import java.util.*;
         import java.applet.Applet;
         import java.awt.event.*;
         //<applet code="DigitalClock.class" width=400 height=400></applet> //displays applet without needing to create HTML file
         public class DigitalClock extends Applet implements ActionListener, Runnable //listen for action events
         Image myimage,buffer;
         Graphics doublebuffer;
         private javax.swing.Timer timer; //implements timer
         public void init() {
    timer = new javax.swing.Timer(1000, this);
    timer.setInitialDelay(0);
    timer.start();
         buffer = createImage(width,height);
         doublebuffer = buffer.getGraphics();
         public void paint(Graphics g) //states that the code below will paint objects onto the applet
         g.setColor (Color.white); //sets colour to white
         g.drawRect(130, 78, 120, 30); //rectangle shape surrounding digital clock
         g.setColor (Color.darkGray); //sets colour to grey
         g.fillRect(132, 80, 117, 27); //fills rectangle from code 2 lines up with colour grey
         setBackground(Color.black); //specifies background colour as black
         Calendar myCal = new GregorianCalendar();
         myCal.set(1956, Calendar.MARCH, 17); //
         of myCal.setTime(myCal2.getTime());
         myCal.setTime(new Date());
         int year = myCal.get(Calendar.YEAR); int mnth = myCal.get(Calendar.MONTH) + 1;
         int DATE = myCal.get(Calendar.DATE); System.out.println(DATE + "." + mnth + "." + year);
         myCal.add(Calendar.YEAR, 1);
         DATE myDate = myCal.getTime(); System.out.println(myDate);
         GregorianCalendar cal = new GregorianCalendar(); //tells program to implement the a new Gregorian Calemder in order to display a date or time
         doublebuffer.setFont(new Font("Arial", Font.BOLD,20)); //sets font to arial, bold style, and size 20
         doublebuffer.setColor (Color.white); //sets colour to white
    doublebuffer.drawString(cal.get(Calendar.HOUR_OF_DAY) + " : " + //examines windows clock to get current hour
    cal.get(Calendar.MINUTE) + " : " + //examines windows clock to get current minute
    cal.get(Calendar.SECOND), 140, 100); //examines windows clock to get current second
         doublebuffer.setFont(new Font("Arial", Font.BOLD,15)); //sets the font to arial, bold style, and size 15
         doublebuffer.drawString("By Darren Cole", 130, 270); //adds words in pink as string and specifies coardinates
         doublebuffer.drawString("Last Modified: 03/04/03", 110, 290); //adds words in pink as string and specifies coardinates
         doublebuffer.drawLine(90, 60, 130, 77); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(210, 60, 250, 77); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 60, 210, 60); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 90, 130, 107); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 60, 90, 90); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.setColor (Color.darkGray); //sets colour to dark grey
         doublebuffer.fillRect(129, 62, 83, 16);
         g.drawImage(buffer,0,0,this);
         public void actionPerformed(ActionEvent e) //tells program that there is an action event specified in the code below
         repaint(); //keeps repainting the digital clock graphics as the time changes i.e. keeps looping the code over
    (END OF CODE)
    What am I doing wrong here? Also I've tried to implement the date as well using a GregorianCalendar. How would I actually make the date appear on the page?
    Thanks,
    Darren

    Most of that doesn't matter now because I've now put in a simplercode for the date but it still doesn't display. But now I get 10 errors. The new code is:
    (START OF CODE)
    import java.awt.*; //puts in abstract windows toolkit to get output on screen
         import java.util.*;
         import java.applet.Applet;
         import java.awt.event.*;
         //<applet code="DigitalClock.class" width=400 height=400></applet> //displays applet without needing to create HTML file
         public class DigitalClock extends Applet implements ActionListener, Runnable //listen for action events
         Graphics doublebuffer;
         private javax.swing.Timer timer; //implements timer
         public void init() {
    timer = new javax.swing.Timer(1000, this);
    timer.setInitialDelay(0);
    timer.start();
         doublebuffer = buffer.getGraphics();
         public void paint(Graphics g) //states that the code below will paint objects onto the applet
         doublebuffer.setColor (Color.white); //sets colour to white
         doublebuffer.drawRect(130, 78, 120, 30); //rectangle shape surrounding digital clock
         doublebuffer.setColor (Color.darkGray); //sets colour to grey
         doublebuffer.fillRect(132, 80, 117, 27); //fills rectangle from code 2 lines up with colour grey
         setBackground(Color.black); //specifies background colour as black
         Calendar date = new GregorianCalendar();
         DateFormat df=DateFormat.getDateInstance(DateFormat.LONG);
         String date = df.format(new Date());
         GregorianCalendar cal = new GregorianCalendar(); //tells program to implement the a new Gregorian Calemder in order to display a date or time
         doublebuffer.setFont(new Font("Arial", Font.BOLD,20)); //sets font to arial, bold style, and size 20
         doublebuffer.setColor (Color.white); //sets colour to white
    doublebuffer.drawString(cal.get(Calendar.HOUR_OF_DAY) + " : " + //examines windows clock to get current hour
    cal.get(Calendar.MINUTE) + " : " + //examines windows clock to get current minute
    cal.get(Calendar.SECOND), 140, 100); //examines windows clock to get current second
         doublebuffer.setFont(new Font("Arial", Font.BOLD,15)); //sets the font to arial, bold style, and size 15
         doublebuffer.drawString("By Darren Cole", 130, 270); //adds words in pink as string and specifies coardinates
         doublebuffer.drawString("Last Modified: 03/04/03", 110, 290); //adds words in pink as string and specifies coardinates
         doublebuffer.drawLine(90, 60, 130, 77); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(210, 60, 250, 77); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 60, 210, 60); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 90, 130, 107); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.drawLine(90, 60, 90, 90); //specifies coardinates for lines that give 3D effect to Digital Clock
         doublebuffer.setColor (Color.darkGray); //sets colour to dark grey
         doublebuffer.fillRect(129, 62, 83, 16);
         g.drawImage(buffer,0,0,this);
         public void actionPerformed(ActionEvent e) //tells program that there is an action event specified in the code below
         repaint(); //keeps repainting the digital clock graphics as the time changes i.e. keeps looping the code over
    (END OF CODE)
    The errors are:
    ---------- Javac ----------
    DigitalClock.java:63: 'class' or 'interface' expected
         public void actionPerformed(ActionEvent e) //tells program that there is an action event specified in the code below
    ^
    DigitalClock.java:70: 'class' or 'interface' expected
    ^
    DigitalClock.java:70: 'class' or 'interface' expected
    ^
    DigitalClock.java:8: DigitalClock should be declared abstract; it does not define run() in DigitalClock
         public class DigitalClock extends Applet implements ActionListener, Runnable //listen for action events
    ^
    DigitalClock.java:21: cannot resolve symbol
    symbol : variable buffer
    location: class DigitalClock
         doublebuffer = buffer.getGraphics();
    ^
    DigitalClock.java:37: cannot resolve symbol
    symbol : class DateFormat
    location: class DigitalClock
         DateFormat df=DateFormat.getDateInstance(DateFormat.LONG);
    ^
    DigitalClock.java:37: cannot resolve symbol
    symbol : variable DateFormat
    location: class DigitalClock
         DateFormat df=DateFormat.getDateInstance(DateFormat.LONG);
    ^
    DigitalClock.java:37: cannot resolve symbol
    symbol : variable DateFormat
    location: class DigitalClock
         DateFormat df=DateFormat.getDateInstance(DateFormat.LONG);
    ^
    DigitalClock.java:38: date is already defined in paint(java.awt.Graphics)
         String date = df.format(new Date());
    ^
    DigitalClock.java:58: cannot resolve symbol
    symbol : variable buffer
    location: class DigitalClock
         g.drawImage(buffer,0,0,this);
    ^
    10 errors
    Normal Termination
    Output completed (2 sec consumed).
    Thanks,
    Darren

Maybe you are looking for