How to transport code on this page to applet?

Hi friends..
the following page has a program to capture images from a web-cam.. can u help me how to transport that code into an applet. So that i can import that applet into an html page, where the live video can be streamed.
the link is :- http://forum.java.sun.com/thread.jspa?threadID=247253&start=0&tstart=0
i tried this code. but on html page the code is not being initialized, though the program is getting compiled correctly.
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import javax.media.*;
import javax.media.format.*;
import javax.media.util.*;
import javax.media.control.*;
import javax.media.protocol.*;
import java.util.*;
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import java.applet.*;
import com.sun.image.codec.jpeg.*;
public class applet extends JApplet{
   static final int    WIDTH  = 320;
    static final int    HEIGHT = 320;
    //public intoApplet d = null;
    public static void main(String args[]){
         JFrame frame = new JFrame("Code Converter");
         applet a = new applet();
         a.init();
         frame.getContentPane().add(a);
         frame.setSize(WIDTH, HEIGHT);
         frame.setVisible(true);
    public void init() {
      System.out.println("Applet initializing");
      intoApplet d = new intoApplet();
      getContentPane().add(d);
    public void start() {
        System.out.println("Applet starting");
    public void stop() {
        System.out.println("Applet stopping");
    public void destroy() {
        System.out.println("Applet destroyed");
public class intoApplet extends JPanel //implements ActionListener
  public Player player = null;
  public CaptureDeviceInfo di = null;
  public MediaLocator ml = null;
  public JButton capture = null;
  public Buffer buf = null;
  public Image img = null;
  public VideoFormat vf = null;
  public BufferToImage btoi = null;
  //public ImagePanel imgpanel = null;
  public intoApplet()
       System.out.print("into swing...");
    setLayout(new BorderLayout());
    setSize(320,320);
    String str1 = "vfw:Logitech USB Video Camera:0";
    String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
    di = CaptureDeviceManager.getDevice(str2);
    //ml = di.getLocator();
    ml = new MediaLocator("vfw://0");
    try
      player = Manager.createRealizedPlayer(ml);
      player.start();
      Component comp;
      if ((comp = player.getVisualComponent()) != null)
        add(comp,BorderLayout.NORTH);
      //add(capture,BorderLayout.CENTER);
      //add(imgpanel,BorderLayout.SOUTH);
    catch (Exception e)
      e.printStackTrace();
public void playerclose()
    player.close();
    player.deallocate();
}

i tried this code..but on html page the applet isnot
being initialised. And what error do you get? Look at the Java console.Java Console shows no error..
when i run the applet class on console by java applet the frame comes and works fine.. but when i do that thru html page..the appl;et is not getting displayed..
code of html page is:-
<HTML>
<HEAD> <TITLE> Hello World</TITLE>
<BODY>
This is the applet to check swing component import:<P>
<APPLET
CODE = "applet.class"
WIDTH = "320" HEIGHT = "320"
>
</APPLET>
</BODY>
</HTML>
applet.class is placed on same directory as that of html page.

Similar Messages

  • How to transport code on this page to an applet?

    Hi friends..
    the following page has a program to capture images from a web-cam.. can u help me how to transport that code into an applet. So that i can import that applet into an html page, where the live video can be streamed.
    the link is :- http://forum.java.sun.com/thread.jspa?threadID=247253&start=0&tstart=0
    i tried this code..but on html page the applet is not being initialised. though compiling is giving no error. please help.
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import javax.media.*;
    import javax.media.format.*;
    import javax.media.util.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import java.applet.*;
    import com.sun.image.codec.jpeg.*;
    public class applet extends JApplet{
       static final int    WIDTH  = 320;
        static final int    HEIGHT = 320;
        //public intoApplet d = null;
        public static void main(String args[]){
             JFrame frame = new JFrame("Code Converter");
             applet a = new applet();
             a.init();
             frame.getContentPane().add(a);
             frame.setSize(WIDTH, HEIGHT);
             frame.setVisible(true);
        public void init() {
          System.out.println("Applet initializing");
          intoApplet d = new intoApplet();
          getContentPane().add(d);
        public void start() {
            System.out.println("Applet starting");
        public void stop() {
            System.out.println("Applet stopping");
        public void destroy() {
            System.out.println("Applet destroyed");
    public class intoApplet extends JPanel //implements ActionListener
      public Player player = null;
      public CaptureDeviceInfo di = null;
      public MediaLocator ml = null;
      public JButton capture = null;
      public Buffer buf = null;
      public Image img = null;
      public VideoFormat vf = null;
      public BufferToImage btoi = null;
      //public ImagePanel imgpanel = null;
      public intoApplet()
           System.out.print("into swing...");
        setLayout(new BorderLayout());
        setSize(320,320);
        String str1 = "vfw:Logitech USB Video Camera:0";
        String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
        di = CaptureDeviceManager.getDevice(str2);
        //ml = di.getLocator();
        ml = new MediaLocator("vfw://0");
        try
          player = Manager.createRealizedPlayer(ml);
          player.start();
          Component comp;
          if ((comp = player.getVisualComponent()) != null)
            add(comp,BorderLayout.NORTH);
          //add(capture,BorderLayout.CENTER);
          //add(imgpanel,BorderLayout.SOUTH);
        catch (Exception e)
          e.printStackTrace();
    public void playerclose()
        player.close();
        player.deallocate();
    }

    i tried this code..but on html page the applet isnot
    being initialised. And what error do you get? Look at the Java console.Java Console shows no error..
    when i run the applet class on console by java applet the frame comes and works fine.. but when i do that thru html page..the appl;et is not getting displayed..
    code of html page is:-
    <HTML>
    <HEAD> <TITLE> Hello World</TITLE>
    <BODY>
    This is the applet to check swing component import:<P>
    <APPLET
    CODE = "applet.class"
    WIDTH = "320" HEIGHT = "320"
    >
    </APPLET>
    </BODY>
    </HTML>
    applet.class is placed on same directory as that of html page.

  • "Portal Content Area Builder" how to get rid of this page heading?

    "Portal Content Area Builder" how to get rid of this page heading?
    Hi All
    I have created a Single page Website..??? by using folders.
    when a user click on any link that call a folder but not a page and that folder is displayed with the layout specified in "Content Area Page" however there is no such option available to change the Heading <Title>Page title</Title> for browsers so for every folder called it displays a Oracle defined Content area page title.
    "Portal Content Area Builder"
    Is there anywork around for this.
    Thanks.
    Rakesh.

    This problem is fixed in Release 2. There is no supported workaround in 3.0.

  • How do I turn off this page

    I am completekly lost. Who can help me get baqck to the beginning? How do I turn of this page and get a home page that make sense or at least looks lke something I might understand?

    Which pages do you see?
    What is the current home page?<br />
    The default in current Firefox versions is the build-in about:home page that doesn't require web access.
    See also these articles for some suggestions:
    *https://support.mozilla.com/kb/Firefox+has+just+updated+tab+shows+each+time+you+start+Firefox
    *https://support.mozilla.com/kb/How+to+set+the+home+page - Firefox supports multiple home pages separated by '|' symbols
    *http://kb.mozillazine.org/Preferences_not_saved

  • How to type vietnamese in this page?

    I use facebookfirefox page. Although i had install unikey, i still can not type vietnamese in this page. So, pls tell the way to type vietnamese in this page
    == This happened ==
    Every time Firefox opened

    After I upgraded to FF 11 I can't type Vietnamese accent anymore. It's the same installation for as long as I remember. I wonder if I just installed Comcast Guard and Norton so they tried to intercept Unikey and consider Unikey as keyboard capture.

  • How can I disable warning: "This page contains some SWF objects..."

    "This page contains some SWF objects that may not work properly in the most recent version of IE..."
    Is there a way to suppress this warning?! I'm doing a find and replace on an old web site, which does not pay well! and this pops up on every page. I have to click on it to continue every time. Making me mad.
    Thanks

    Thanks for answering. In my case that won't work because I'm doing a global find and replace of some text.
    I agree though, that process would eliminate the message when I have to come back to edit the site again. It's just the thought of many dozens of pages that would need it and to be honest, I'm really not feeling that motivated to do all the up front work right now
    Like I said, there should have been a setting for this...

  • How to write code for this logic in a routine, very urgent --help me

    hi all,
    i want to apply this logic into one subroutin ZABC.
    here i m giving my logic ,can any body help me in coding for this, this is very urgent, i hv to submit on wednesday.
    4.1 Read the company code number BSEG-BUKRS from document line item.
    4.2 Fetch PRDHA from MARA into GV_PRDHA where MATNR = BSEG-MATNR.
    4.3 Fetch Business area (GSBER) from ZFIBU into GV_GSBER where (PRDHA = GV_PRDHA and BUKRS = BSEG-BUKRS) OR (PRDHA = GV_PRDHA and BUKRS = SPACE).
    4.4 If business area match is found, go to step 3.9. Else continue.
    4.5 If BKPF-BLART IN set “ZVS_POSDT” OR BKPF-XBLNR starts with “I0*”, execute steps below. Else, go to Step 3.6.
    i. MOVE: BSEG-BKURS TO work area field WA_ZFIBUE-BUKRS,
    BSEG-MATNR TO work area field WA_ZFIBUE-MATNR,
    GV_PRDHA TO work area field WA_ZFIBUE-PRDHA,
    BSEG-HKONT TO work area field WA_ZFIBUE-HKONT,
    BSEG-GSBER TO work area field WA_ZFIBUE-GSBER,
    BSEG-PSWBT TO work area field WA_ZFIBUE-PSWBT,
    BKPF-BUDAT TO work area field WA_ZFIBUE-BUDAT,
    SY-DATUM TO work area field WA_ZFIBUE-CREDATE,
    SY-UZEIT TO work area field WA_ZFIBUE-CRETIME,
    Fetch running serial number (WA_ZFIBUE-SERIALNO) from ZFICO. This number will be stored in ZFICO with PARAMTYPE = "BPM030307", SUBTYPE = "ZFIBUE" and KEY1 = "SERIALNO". The actual serial number will be stored in the field VALUE1.
    i. Insert WA_ZFIBUE INTO ZFIBUE.
    ii. Send email notification to the user (if it is not already sent to user on the same posting date).
    Use function module ‘SO_NEW_DOCUMENT_ATT_SEND_API1’ to send mail.
    Fetch email address and date of last email from ZFICO. These values will be stored in ZFICO with PARAMTYPE = "BPM030307", SUBTYPE = "EMAIL" and KEY1 = "<USERNAME>". The email address will be stored in the field VALUE1 and posting date in VALUE2. Once mail is sent, VALUE2 is updated with latest posting date (BKPF-BUDAT).
    iii. Increment the running serial number and update ZFICO with new serial number.
    a. GV_ SERIALNO = WA_ZFIBUE-SERIALNO + 1
    b. Update ZFICO Set value1 = GV_SERIALNO
    Where PARAMTYPE = "BPM030307" AND
    SUBTYPE = "ZFIBUE" AND
    KEY1 = "SERIALNO".
    iv Move “VDFT” to BSEG-GSBER.
    v. Exit routine.
    4.6 Fetch MTART into GV_MTART from MARA where MATNR = BSEG-MATNR.
    4.7 If SY-BATCH = INITIAL AND GV_MTART <> ‘ROH’, issue the error message - “Maintain the mapping of product hierarchy <PRDHA> from article <MATNR> for <BUKRS>”. Else, go to step 3.8.
    4.8 If SY-BATCH <> INITIAL AND GV_MTART <> ‘ROH’, issue the error message - “Maintain product hierarchy on article master”. Go to step 3.10.
    4.9 Move GV_GSBER TO BSEG-GSBER.
    4.10 Exit Routine
    plz give me reply asap --this is very urgent
    thanks in advance
    swathi

    Hi Swathi,
    If it's very very urgent then you better get on with it, don't waste time on the web. Chop chop.

  • How to remove "Subscribe to this page" option on bookmarked pages?

    When you have bookmarked a page, a button is displayed in the "awesome bar" that gives the option to subscribe to the page.
    Is there a way to remove this button from the toolbar?
    I hate this button being in my URL/search bar and have not been able to find a way to remove it anywhere.

    go into your about:config and filter "extensions.abhere2.bmsmenu.subscribe"
    double click and set the value to false.
    Hope this helps

  • How do I print just this page?

    In the print options, I can go to the pages section and designate the page number to print, but that requires several steps. In Word I would hit Control-P then Alt-E and the current page would print. Is there a similar option in Pages? Is it possible to make a shortcut using my F6 key? I used that shortcut a lot, so I hope you can help me with this. Thanks.

    No such thing but you might be able to create an AppleScript that identifies the current page and inserts that in the print dialog.
    MsWord is a much heftier program and tries to fit in everything plus the kitchen sink.
    I prefer a trimmer ship, which by the way is not Pages.
    Personally I would like a direct print to .pdf option everywhere in OSX.
    Peter

  • How to write code for this logic, plz help me very urgent

    Hi All,
    i am new to sap-abap, i got this work and i m working on this can any body help me in writing code, plz help me, this is very very urgent.
    here  i m giving my logic, can anybody send me the code related to this logic.
    this is very urgent .
    this program o/p should be in ALV format and need to create one commond 'SAVE" on this o/t list  if  user clicks save processedon and processedby fields in ZFIBUE should be updated automatically.
    i am creating one custom table zfibue having fields: (serialno, bukrs, matnr,prdha,hkont,gsber,wrbtr,budat, credate, cretime,processed, processedon, processedby,mapped)
    fields of zfibue:
    serailno = numc
    bukrs = char
    matnr = char
    prdha = char
    hkont = char
    gsber = char
    wrbtr = char
    budat = date
    credate = date
    cretime = time
    processed= char
    processedon = date
    processedby = char
    mapped = char      are   belongs to above type data types
    and seelct-optionfields:  s_bukrs for bseg-bukrs
                                        s_hkont for bseg-hkont,
                                         s_budat for bkpf-budat,
                                         s_processed for zfibue-processed,
                                          s_processedon for zfibue-processedon,
                                          s_mapped. for zfibue-mapped
    parameters: p_chk1 as checkbox,
                      p_chk2 as checkbox.
                      p_filepath type rlgrap-filename.
    1.1 Validate the user inputs (S_BUKRS and S_HKONT) against respective check tables (T001 and SKB1). If the validation fails, provide respective error message. Eg: “Invalid input for Company Code”.
    1.2 Fetch SERIALNO, BUKRS, MATNR, PRDHA, HKONT, GSBER, WRBTR, BUDAT, CREDATE, CRETIME, PROCESSED, PROCESSEDON, PROCESSEDBY, MAPPED from table ZFIBUE into internal table GT_ZFIBUE where BUKRS IN S_BUKRS, HKONT IN S_HKONT, BUDAT IN S_BUDAT, PROCESSED IN S_PROCESSED, PROCESSEDON IN S_PROCESSEDON, and MAPPED IN S_MAPPED.
    1.3 If P_CHK2 = ‘X’, go to step 1.11. Else continue.
    1.4 If P_CHK1 = ‘X’, continue. Else go to step 1.9
    1.5 Fetch MATNR, PRDHA from MARA into GT_MARA for all entries in GT_ZFIBUE where MATNR = GT_ZFIBUE-MATNR.
    1.6 Sort and delete adjacent duplicates from GT_MARA based on MATNR.
    1.7 Loop through GT_ZFIBUE where PRDHA = blank.
              Read Table GT_MARA based on MATNR = GT_ZFIBUE-MATNR.
              IF sy-subrc = 0.
                     Move GT_MARA-PRDHA to GT_ZFIBUE-PRDHA.
                  Modify Table GT_ZFIBUE. “Update Product Hierarchy
                 Endif.
        Fetch PRDHA, GSBER from ZFIBU into GT_ZFIBU for all entries in GT_ZFIBUE where PRDHA = GT_ZFIBUE-PRDHA.
        Read Table GT_ZFIBU based on PRDHA = GT_ZFIBUE-PRDHA.
              IF sy-subrc = 0.
                     Move GT_ZFIBU-GSBER to GT_ZFIBUE-GSBER.
                  Move “X” to GT_ZFIBUE-MAPPED.      
                  Modify Table GT_ZFIBUE.
                 Endif.   
    Endloop.
    1.8 Modify database table ZFIBUE from GT_ZFIBUE.
    1.9 Fill the field catalog table GT_FIELDCAT using the details of output fields listed in section “Inputs/Outputs” (above).
       Eg:                 LWA_ FIELDCAT -SELTEXT_L = 'Serial Number’.
                              LWA_ FIELDCAT -DATATYPE = ‘NUMC’.
                              LWA_ FIELDCAT -OUTPUTLEN = 9.
                              LWA_ FIELDCAT -TABNAME = 'GT_ZFIBUE'.
                              LWA_ FIELDCAT-FIELDNAME = 'SERIALNO'.
              Append LWA_FIELDCAT to GT_FIELDCAT
    Note: a) The output field GT_ZFIBUE-PROCESSED will be editable marking INPUT = “X” in field catalog (GT_FIELDCAT).
             b) The standard ALV functionality will be used to give the user option for selecting all or blocks of entries at a time.
             c) The PF-STATUS STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN will be copied to the program and modified to include a “SAVE” button.
    1.10 Call the function module REUSE_ALV_GRID_DISPLAY passing output table GT_ZFIBUE and field catalog GT_FIELDCAT. Additional parameters like I_CALLBACK_PF_STATUS_SET (= ‘ZFIBUESTAT’) and I_CALLBACK_USER_COMMAND (=’HANDLE_USER_ACTION’) will also be passed to handle user events. Go to 2.14.
    1.11 Download the file to P_FILEPATH using function module GUI_DOWNLOAD passing GT_ZFIBUE.
    1.12 Exit Program.
    Logic to be implemented in  routine “Handle_User_Action”
    This routine will have the following interface:
    FORM Handle_User_Action  USING r_ucomm LIKE sy-ucomm
                                                               rs_selfield TYPE slis_selfield.
    ENDFORM.
    Following logic will be implemented in this routine:
    1.     If r_ucomm = ‘SAVE’, continue. Else exit.
    2.     Loop through GT_ZFIBUE where SEL_ROW = ‘X’. “Row is selected
    a.     IF GT_ZFIBUE-PROCESSED = ‘X’.
    i.     GT_ZFIBUE-PROCESSEDON = SY-DATUM.
    ii.     GT_ZFIBUE-PROCESSEDBY = SY-UNAME.
    iii.     MODIFY ZFIBUE FROM work area GT_ZFIBUE.
    Endif.
    Endloop.

    Hi Swathi,
    If it's very very urgent then you better get on with it, don't waste time on the web. Chop chop.

  • Classical report how to write code for this task

    coding
    Delivery Due List: This Report program generates list with details of quantity available, quantity planned, quantity delivered and quantity still to be delivered for sales orders and stock transport orders based on shipping point

    Hi,
    Try to get TABLE and FIELD names from your senoir or functional consultants.
    or
    search the field names in the following tables...
    VBAP
    LIPS
    VBRP.
    Regards,
    Billa

  • How can I code around this: RuntimePermission accessClassInPackage

    (JDK1.4)
    I'm using JCE in Java Web Start without this permission.
    The code I'm using very simple:
    DHParameterSpec dhSkipParamSpec;
    dhSkipParamSpec = new DHParameterSpec(skip1024Modulus, skip1024Base);
    KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DH");
    keyPairGenerator.initialize(dhSkipParamSpec);
    KeyPair keyPair = keyPairGenerator.generateKeyPair();
    This code tries to access the code in a sun.security.provider which throws the stack trace below.
    Of course, the code works without a SecurityManager. I'm likely fubar'd with JWS and above code.
    Is my only option to investigate complete JCE rewrites like IAIK so I can make it part of my classpath (and security policy)??
    Thank you.
    java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.sun.security.provider)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
         at java.security.AccessController.checkPermission(AccessController.java:401)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
         at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1513)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:262)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
         at com.wss.calendar.client.swing.Main.main(Main.java:47)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at com.sun.javaws.Launcher.executeApplication(Launcher.java:739)
         at com.sun.javaws.Launcher.executeMainClass(Launcher.java:701)
         at com.sun.javaws.Launcher.continueLaunch(Launcher.java:584)
         at com.sun.javaws.Launcher.handleApplicationDesc(Launcher.java:328)
         at com.sun.javaws.Launcher.handleLaunchFile(Launcher.java:166)
         at com.sun.javaws.Launcher.run(Launcher.java:134)
         at java.lang.Thread.run(Thread.java:536)

    Sign it and also specify the "all-permissions" in your deployment descriptor

  • HT5312 How do I get to this page ?

    How do I get to the security question reset page

    1)  Apple ID: All about Apple ID security questions
    If necessary
    2)  See Here... ask to speak with the Account Security Team...
    Apple ID: Contacting Apple for help with Apple ID account security
    3)  Or Email Here  >  Apple  Support  iTunes Store  Contact

  • How to remove "Firefox prevented this page from automatically reloading" message bar at top. It appeared at the same time I lost local news on my homepage. Neither Tools or Preferences seem to have a solution. Any suggestions?

    Firefox 3.6.15, Mac OS X
    There's no "options" setting in Tools.

    Do you know if that then allows the page to automatically reload or does that just get rid of the message? Thanks!

  • How to remove "About this Page" and "Privacy Statement" on a OA page

    Hi,
    How do i remove "About this Page" and "Privacy Statement" links at the bottom of an OA page and add "Close Window" link on the top right corner of OA page.
    Please help.
    Advance thank
    Pavan

    Hi,
    1. Select Personalize Page link at top right of page.
    2. Select Choose context button.
    3. In the scope drop down box select OA Footer.
    4. Click on apply.
    5. Expand privacy.
    6. Click on personalize pencil icon.
    7. Set Rendered property to false at required level.
    8. Click on apply.
    9. Click on Return to Application link.
    thanx
    Pratap

Maybe you are looking for

  • Error When Trying to select a value project partner ComboBox in Sale Order

    Hello, I'm using a  project partner comboBox in Order system form and i need to select a particular value in ValidValues comming from OPRJ table to fill this comboBox , is it possible? This is my c# code Form form = B1Connections.theAppl.Forms.Item("

  • Batch Wise Item Cost

    Hi   Any work around for batch wise item cost at the time of issue. Thanks

  • Screensaver and screen not dimming

    in bootcamp. I have a santa rosa MBP and I have a problem with the screensaver and the screen not shutting off. I set the screensaver to turn on in 1 min and the screen to turn off in 5 and it still doesn't work. I unplugged everything and it still d

  • Changed DSN in connection object but reports still use value from old DSN

    We're running BObj XIr2 SP4 and have both WEBI and DESKI reports. Most of our DESKI reports have two data providers, one from a universe (header/footer info) and one for free-hand SQL (report data). We are testing in preparation to upgrading all our

  • Stop a running BPM instance

    Hi All, I tried a BPM with 2 receive steps(to understand corelation). Accidentally, I sent a wrong msg to receive1 which has no corresponding msg for receive2. So this BPM instance is running waiting for its corresponding second msg(which is never go