Passing parameters inside applet

Hello everybody,
I need send many parameters with same key but different value in to an applet. Does that sounds possible?
If it is, how can I be able to extract all these values inside the applet and store them in an array?
Please, advise me a solution
Thanks,
Shivram.

Hello,
Could anybody please let me know about the possibility of doing this? If it is not possible, Is there any other means of passing a set of data which has same key in to an applet?
Like
<Param key="name" value="james"/>
<Param key="name" value="rob" > ..and so on
I dont want to pass all the values within the same param by using a seperator (like comma) as the original values have lengthy words in it.
Please give your suggestions.
Thanks
Shivram.

Similar Messages

  • Passing arguments to applet

    Hi,
    i have problem with passing parameters to Applet in OA page. i including the applet in raw text bean and placing the applet tag in setText(). but when i try to pass some dynamic values to the applet its not taking the parameters. Can anyone help me?
    here is my sample code
    String appletCode = "<HTML><HEAD> <TITLE>Gantt Applet</TITLE> </HEAD><applet code='ScrollingGantt.class' width=970 height=500>";
    appletCode = appletCode + "<PARAM NAME='Resources' VALUE='"+pageContext.getParameter("Resources")+"'>";
    appletCode = appletCode + "<PARAM NAME='BatchId' VALUE='"+pageContext.getParameter("BatchId")+"'>";
    appletCode = appletCode + "<PARAM NAME='BatchNo' VALUE='"+pageContext.getParameter("BatchNo")+"'>";
    appletCode = appletCode + "<PARAM NAME='StartDate' VALUE='"+pageContext.getParameter("StartDate")+"'>";
    appletCode = appletCode + "<PARAM NAME='EndDate' VALUE='"+pageContext.getParameter("EndDate")+"'>";
    appletCode = appletCode + "</applet></HTML>";
    OARawTextBean appletBean = (OARawTextBean)webBean.findChildRecursive("Applet");
    appletBean.setText(appletCode);
    Thanks Nagesh

    Hi Tapash,
    Try executing this simple example
    Applet code :-
    import java.applet.*;
    import java.awt.*;
    public class Demo extends Applet{
    String s="";
    public void start(){
    s = this.getParameter("Name");
    public void paint(Graphics g){
    System.out.println(s);
    setBackground(Color.RED);
    setForeground(Color.BLACK);
    g.drawString("Hello"+s,150,50);
    OAF Code:
    Place this code in ProcessRequest
    String appletCode = "<applet code='Demo.class' width=970 height=500><param name='Name' value='nagesh'></applet>";
    System.out.println(appletCode);
    OARawTextBean appletBean = (OARawTextBean)webBean.findChildRecursive("Applet");
    appletBean.setText(appletCode);
    System.out.println("Text here :"+appletBean.getText());

  • Issue with passing parameters to an applet?

    Hi,
    I have an apex page which is a popup page. I am passing parameters to the applet and then reading them in from my java code.
    Here is my applet code
    <SCRIPT>
      function getStatus(retStatus) {
        $s("P3_MESSAGE", ''||retStatus||'')
    </SCRIPT>
    <APPLET ARCHIVE="/i/bin/offline_load.zip" CODE="offline_load.class"  STATUSMSG WIDTH=0 HEIGHT=0>
    <PARAM name="username" value="&APP_USER.">
    <PARAM name="dbuser" value="&P3_DBUSER.">
    <PARAM name="dbpassword" value="&P3_DBPASSWORD.">
    <PARAM name="dbserver" value="&P0_DBSERVER.">
    <PARAM name="dbport" value="&P3_DBPORT.">
    <PARAM name="dbsid" value="&P3_DBSID.">
    </APPLET>P3_DBUSER, P3_DBPASSWORD, etc are all defined on page zero as hidden and protected items
    My applet code
    public void init() {
        CallableStatement load_stmt = null;
        String userName = this.getParameter("username");
        String dbUser = this.getParameter("dbuser");
        String dbPass = this.getParameter("dbpassword");
        String dbServer = this.getParameter("dbserver");
        String dbPort = this.getParameter("dbport");
        String dbSid = this.getParameter("dbsid");
        try {
          System.out.println("init(): loading OracleDriver for applet created at " + created.toString());
          Class.forName("oracle.jdbc.driver.OracleDriver");
          System.out.println("init(): getting connection");
          conn = DriverManager.getConnection("jdbc:oracle:thin:@" + dbServer + ":" + dbPort + ":" + dbSid, dbUser, dbPass);
        } // end tryThe odd thing is I have gotten this working twice then unexpectedly it just stops working when I make a change to the java applet code.
    And the changes have absolutely nothing to do with the above code it can be anything the first time was error handling I added
    to another section and the second I modified a stored procedure call.
    Anyone have any idea why this might be occurring as this is driving me completely insane :(
    Thanks in advance

    Hi,
    In your init() code, you have a "try" block - do you have a "finally" block to close the connection? Something like:
    finally {
      try {
        conn.close();
      catch (Exception ignore) {
    }Could it be that you have reached the limit of the number of available open connections?
    Your code looks ok as far as I can see (based on examples at: http://www.orafaq.com/wiki/JDBC )
    Also, in your new bits of code, have you added try/catch/finally blocks? Does the code compile fully (ie, no warnings)? Have you added new imports that may conflict with existing code such that you have to fully qualify existing objects/classes (eg, you may now have two DriverManager classes or CallableStatement objects)?
    Andy

  • Passing parameters to an applet dynamically

    I am looking for suggestions on how I can pass parameters to my applet which generates a simple bar graph. If I pass parameter names and values using HTML tags the number of bars are fixed. I want my applet to accept variable number of values for the x and y axes.

    Then use a JSP for the HTML page. This can then pass dynamically generated numbers as params. Alternatively, your applet could communicate to the server through a Socket (package java.net) - although this can cause problems if there are firewalls inbetween client and server.

  • Passing parameters to my applet on apex

    i cannot seem to pass parameters to my applet which i embedded on my apex region. can anyone help.

    We probably can't help without more information, details and perhaps and example to look at.

  • SSRS. Not passing fields/parameters to report when stored procedure keeps parameters inside IF statement

    So what I mean:
    I have stored procedure like this:
    CREATE PROCEDURE sp_Example
    @param1 NVARCHAR(20) = '',
    @param2 DATE = ''
    AS
    BEGIN
    IF (SELECT COUNT(*) FROM Table1 WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')) > 2
    BEGIN
    SELECT Name, Date, Price, Etc
    FROM Table2
    WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')
    END
    IF (SELECT COUNT(*) FROM Table1 WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')) < 2
    BEGIN
    SELECT Name, Date, Price, Etc
    FROM Table3
    WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')
    END
    END
    So in stored procedure are some input parameters and they are passed into IF statement.
    If I use this stored procedure as report's dataset (Microsoft Visual Studio 2013) in following:
    Add
    Dataset > Query
    Type: Stored Procedure > sp_Example It
    do NOT get any fields, but get parameters
    If I use this stored procedure in following:
    Add
    Dataset > Query
    Type: Text > EXECUTE
    sp_Example It get all required fields, but do NOT get parameters
    Of course If I add manually parameters or fields It not working.
    If I change IF statement
    in stored procedure something like:
    IF (1 < 3)
    BEGIN
    SELECT Name, Date, Price, Etc
    FROM Table3
    WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')
    END
    It normally working in report (getting all fields and parameters). So problem is that I pass parameters to IF statement.
    Have you any ideas how to pass parameters to IF statement
    and get It correctly working on report?

    Hi Stanisolvas,
    Per my understanding that you are experending some issue when using the stored procedure to create the dataset, you can't get the fields to display under the dataset, right?
    I have tested on my local environment with the same script as your and can't reproduce the issue, Please try to check and provide more details information according to below points:
    What do you mean of not get any fields, Is that mean no table header along with the value will display? If you got any error message, please provide it.
    Did you use any temp table in the stored procedure, if so, the issue can be caused by the temp table you are using, please don't use temp table in it which will cause no fields display.
    If you use the second method to execute the procedure, please check to make sure you have added the script like below to make the parameters display in the report:
    exec sp_Example @Param1=@Param1,@Param2=@Param2
    Please execute the stored procedure in the SQL Server Management Studio like below to see if the stored procedure will works fine:
    exec sp_Example @Param1='Test1',@Param2='2014-10-15'
    If this work fine in the management studio, please try to create an new report to re-add this procedure.
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • How to open a page from a Form and pass parameters to the form on that page

    I found a similar example on this forum, but it did not work for me:
    declare
    l_names owa.vc_arr;
    l_values owa.vc_arr;
    i number;
    begin
    PORTAL.wwpro_api_parameters.retrieve(l_names, l_values);
    FOR i in 1..l_names.count
    LOOP
    htp.p(l_names(i) || ' ' || l_values(i));
    END LOOP;
    end;
    By using this method i get the parameters for the Form, like the session ID, but not the parameters for the Page that the form is displayed in.
    Another method I tried:
    To open a Form from a Form and pass parameters works fine like this:
    --In the After processing page PL/SQL event.
    declare
    v_id number;
    blk varchar2(10):='DEFAULT';
    Begin
    v_id:=p_session.get_value_as_number (p_block_name=&gt;blk,p_attribute_name=&gt;'A_ID');
    if v_id &gt; 0 then
    htp.formOpen('PORTAL.wwa_app_module.link?p_arg_names=_moduleid&p_arg_values=2649500412&p_arg_names=_show_header&p_arg_values=YES&p_arg_names=ID&p_arg_values='||to_char(v_id),'post');
    htp.formSubmit(NULL,'Upload Files');
    htp.formClose;
    end if;
    End;
    But I want to open a Page containing the Form instead of just opening the Form. Is this possible to open a Page and pass paramters to the page, and then let the form inside the Page access the passed paramters. The reason for this is that a Form cannot be based on a page template, or can it? When opening the form i want to keep the left menu, which I can if it is a page based on my template with the left menu.
    Best regards
    Halvor

    Hi,
    You can do this by calling the url of the page with the form. You can then use p_arg_names and p_arg_values to pass parameters. In the called form you can get the value from p_arg_names and p_arg_values and assign it to the form field.
    You can call this code in the success procedure of the calling form.
    declare
    v_id number;
    blk varchar2(10):='DEFAULT';
    v_url varchar2(2000);
    Begin
    v_id:=p_session.get_value_as_number (p_block_name=>blk,p_attribute_name=>'A_ID');
    v_url := <page_url>;
    if v_id > 0 then
    call(v_url||'&p_arg_names=id&p_arg_values='||v_id);
    end if;
    End;
    In the called form in "Before displaying form" plsql section write this code.
    for i in 1..p_arg_names.count loop
    if p_arg_names(i) = 'id' then
    p_session.set_value(
    p_block_name => blk,
    p_attribute_name => 'A_ID',
    p_value => p_arg_values(i)
    end if;
    end loop;
    This code picks up the value from p_arg_values and assigns it to the form field.
    Hope that helps.
    Thanks,
    Sharmila

  • Pass parameters that contain spaces between web pages

    Hi,
    I have a .jsp . Inside it, I only need to call a link with a parameter.
    The problem is that the parameter contains spaces:
    name="ALARM LEVELS"
    If I write:
    <a href=modif_list.jsp?name=<%=paramName%>>See list</a></p>The parameter received in modif_list is "ALARM" and not "ALARM LEVELS"!!!
    How can I pass parameters that contain spaces between web pages?
    Thanks

    The think is that the parameter is a label and obviously I don't know the value before hand.
    In fact, I am using
    <a href=modif_list.jsp?table=<%=paramName%>&label=<%=label%>
    <%=tableName%></a></p>.....So I can't help it if the label contains spaces.
    Now if there is no solution, I suppose I can always replace the space by "_" and when I collect the parameter, I replace the "_" by a space!

  • Passing parameters between portlets

    Hi , I have a page with two portlets : one , done with the wizard , is a form , the other one is another form , but is done with a JSP.
    My trouble is that with the second form , the one done with a JSP , I must insert into the database two values , one retrieved by the jsp itself , and the other one is a value of one field of the other form.
    My question is how can I get , from my jsp , that value coming from the other portlet ???
    Thanks
    max

    Hi,
    You can redirect to another page and pass parameters to it. For this, you need to know the pageid to which you have to redirect. Assign form action to
    http://machine:port/servlet/page
    PageServlet requires few other parameters (form fields) to redirect the control to the required page.
    You can get them by making a call to
    HttpPortletRendererUtil.htmlFormHiddenFields(pr,PortletRendererUtil.PAGE_LINK)
    This returns a string similar to the following.
    <INPUT TYPE="hidden" name="_pageid" value="54" />
    <INPUT TYPE="hidden" name="_dad" value="portal30" />
    <INPUT TYPE="hidden" name="_schema" value="PORTAL30" />
    Parse it for _pageid and change the value to the page you want to redirect. Print these contents inside your form. Once you submit the form, it'll redirect the control to the page you want with the parameters.
    --Sriram

  • Passing parameters to web based oracle forms

    Hi,
    How can I pass parameters from web page to oracle form applet? OR is there anyway i can know (within a form) if that form is run from a client/server or from web. This is just to set some parameters depending on the condition: client/server or web application.
    thank you

    To know if you are on the Web use the get_application_property built-in, check out the online help for it.
    To pass parameters - if you are using the forms servlet you can pass parameters on the URL that calls your Forms application.

  • JVM Parameters in Applets

    Hi,
    I need to set the jvm parameter in an applet for instance "file.encoding" and
    System.setProperty("file.encoding","UTF8") doesnt work, is there any other way to set the parameters?
    Thanks in advance...

    System.setProperty("file.encoding","UTF8")
    Will throw an exception because the applet is not allowed to do that
    java.security.AccessControlException: access denied (java.util.PropertyPermission file.encoding write)
    You need to sign the applet and the consumer of your applet needs to trust the signature
    or the consumer of your applet needs to set up a policy for your applet.
    Or
    The consumer of your applet sets up runtime parameters.
    Here is something I copied and pasted to pass parameters that will force the jre to
    generate a full trace everytime.
    To turn the full trace on (windows) you can start the java console, to be found here:
    C:\Program Files\Java\j2re1.4...\bin\jpicpl32.exe
    In the advanced tab you can fill in something for runtime parameters fill in this:
    -Djavaplugin.trace=true -Djavaplugin.trace.option=basic|net|security|ext|liveconnect
    if you cannot start the java console check here:
    C:\Documents and Settings\userName\Application Data\Sun\Java\Deployment\deployment.properties
    I think for linux this is somewhere in youruserdir/java (hidden directory)
    add or change the following line:
    javaplugin.jre.params=-Djavaplugin.trace\=true -Djavaplugin.trace.option\=basic|net|security|ext|liveconnect
    for 1.5:
    deployment.javapi.jre.1.5.0.args=-Djavaplugin.trace\=true -Djavaplugin.trace.option\=basic|net|security|ext|liveconnect
    The trace is here:
    C:\Documents and Settings\your user\Application Data\Sun\Java\Deployment\log\plugin...log
    I think for linux this is somewhere in youruserdir/java (hidden directory)
    I think the main question is why do you need to set this property? If you want to write
    something to the local filesystem you should sign or set up policy for the applet
    anyway so I would go with that sollution. Or better yet use an URL object and send the
    data that needs to be saved to a server that does something with it (store it in
    a database).

  • Is it possible to pass parameters through eventlisteners?

    Hello everyone!
    Inside a .fla file I have some buttons and each button will tween a different image to the stage. All the images are outside the stage in the same x and y position and I just need to tween the x coordinate.
    Now I'm working with an external document class where I'm trying to hold all my functions and I'm stucked with the Tweens. I'm willing to stay away from the flash tween engine and I'm trying to work with tweenLite.
    My question is: Is it possible to pass parameters through eventListeners so I can use something like this inside my docClass?
         public function animeThis (e:MouseEvent, mc:MovieClip, ep:int):void { //ep stands for endPoint.
         TweenLite.to(mc, 2, {x:ep});
    If this is possible, how am I supposed to write the listeners so it will pass the event to be listened for AND those parameters? And how to build the function so it will receive those parameters and the event?
    If this is not possible, what's the best approach to do this?
    Thanks again!

    So, I understand you need to match buttons with corresponding visuals.
    Here is a suggested approach.
    Since SimpleButton is not a dynamic class, I suggest you have an enhanced base class for these buttons that extends SimpleButton. What is enhanced is that button has reference to the target.
    I wrote code off the top of my head and it may be buggy. But concept is clear:
    This is base class for all the buttons:
    package 
         import flash.display.DisplayObject;
         import flash.display.SimpleButton;
         public class NavButton extends SimpleButton
              public var targetObject:DisplayObject
              public function NavButton()
    Now, this is your doc class that utilizes this new buttons:
    package 
         import flash.display.DisplayObject;
         import flash.display.MovieClip;
         import flash.display.Sprite;
         import flash.events.Event;
         import flash.events.MouseEvent;
         public class DocClass extends Sprite
              private var btnArray:Array;
              private var visuals:Array;
              // references to objects being swapped
              private var visualIn:MovieClip;
              private var visualOut:MovieClip;
              public function DocClass()
                   if (stage) init();
                   else addEventListener(Event.ADDED_TO_STAGE, init);
              private function init(e:Event = null):void
                   removeEventListener(Event.ADDED_TO_STAGE, init);
                   // buttons and MCs shouldn't be in the same array - otherwise it is counterintuitive
                   // assuming all the objects are on stage
                   btnArray = [price_btn, pack_btn, brand_btn, position_btn];
                   visuals = [g19_mc, g16_mc, g09_mc, g04_mc];
                   configObjects();
              private function configObjects():void
                   var currentVisual:MovieClip;
                   var currentButton:NavButton;
                   for (var i:int = 0; i < btnArray.length; i++)
                        currentVisual = visuals[i];
                        // hold original positioin
                        currentVisual.hiddenPosition = currentVisual.x;
                        currentButton = btnArray[i];
                        // set target MC
                        currentButton.targetObject = currentVisual;
                        currentVisual.addEventListener(MouseEvent.CLICK, placeObject);
                        currentButton.addEventListener(MouseEvent.CLICK, placeObject);
              private function placeObject(e:MouseEvent):void
                   // if NavButton is clicked - make new visual targeted for moving in and currently visible object subject for moving out
                   if (e.currentTarget is NavButton) {
                        visualOut = visualIn;
                        visualIn = NavButton(e.currentTarget).targetObject;
                   else {
                        // otherwise - move visual out
                        visualOut = visualIn;
                   swapVisuals();
               * Accompishes visuals swapping
              private function swapVisuals():void {
                   if (visualIn) TweenLite.to(visualIn, .3, { x:0 } );
                   if (visualOut) TweenLite.to(visualOut, .3, { x:visualOut.hiddenPosition } );

  • Pass parameters into CellRenderer

    Hello!
    I want to pass parameters into CellRenderer.
    How can I do that?

    Found solution!
    Create method, that set my Bean in CellRenderer, in what I keep my values, and call this method when create my CellRenderer. Than Use MyBean inside CellRenderer when it render cell.
    JSP:
    <hbj:tableView id="NewTable" model="LotsBean.ModelLots"
              design="TRANSPARENT"
              headerVisible="false"
              footerVisible="false"
              fillUpEmptyRows="false"
              selectionMode="NONE"
              visibleFirstRow="1"
              rowCount="16"
              width="100%" >
              <%  MyCellRenderer MyCell = new MyCellRenderer();
                     MyCell.setST(MyBean);
                     NewTable.setUserTypeCellRenderer(MyCell); %>
         </hbj:tableView>
    CellRenderer class:
         public void setST(user_registration_bean Bean){
              MyBean = Bean;

  • How to pass parameters to automation plugin to Javascript

    Hello,
    We can call automation plugin from java script below code.
    var xx = stringIDToTypeID( "459ac2e6-82d1-11d5-9879-00b0d0201111" );     // Has will be the unique ID for this plugin
    executeAction( xx, undefined, DialogModes.NO );
    I am trying to passing parameters for the same plugin.
    I tried to find a way myself following plug-in resource guide but there information is not so clear.
    Can you tell me,
    How to define parameters in terminology file. (my guess it should be define in terminology file)
    How to JS call with parameters
    And how to extract those parameters inside plugin.
    Sample Pipl.r file  (This is from C++ plugin in SDK)
    // Dictionary (scripting) resource
    resource 'aete' (16000, "Getter dictionary", purgeable)
           1, 0, english, roman, /* aete version and language specifiers */
                "Testing", /* vendor suite name */
                "Adobe example plug-ins", /* optional description */
                'get ', /* suite ID */
                1, /* suite code, must be 1 */
                1, /* suite level, must be 1 */
           { /* structure for automation */
           plugInName, /* name */
           "No comment", /* optional description */
           'get ', /* class ID, must be unique or Suite ID */
           'getr', /* event ID, must be unique */
           NO_REPLY, /* never a reply */
                IMAGE_DIRECT_PARAMETER, /* direct parameter, used by Photoshop */   <-- According to the documentation, I guess here should be come parameters.  (para name, keyID, typeID )
                { // filter or selection class here:
      {}, /* non-filter/automation plug-in class here */
      {}, /* comparison ops (not supported) */
      { // Enumerations go here:
      } /* end of any enumerations */
    // end GetterPiPL.r
    Thank you.

    Hello Mack,
    Thanks for your detail explanation.
    Actually, I haven't much play with PS javascripting plugins niter Fit image.
    The key points I have figure out that, the way you attached parameters to descriptor and point of finding some light from listener.
    That made me a conceptual idea, although I did not get all the mention facts.
    My previous guess was correct.
    Parameter should be something like below according to PiPL grammar. (in Sample Pipl.r file)
    'mymod', /* event ID, must be unique */
           NO_REPLY, /* never a reply */
                IMAGE_DIRECT_PARAMETER, /* direct parameter, used by Photoshop */ 
                "action",    /* name for parameter*/
                 keyMyPara,    /*Key parameter you have define in terminology file*/
                 typeChar,       /*parameter type*/
                 "",     /*optional description*/
                 flagsSingleParameter     /*flags */
    The UUID is enough for calling plugin, only challenge was to define parameter wtr grammar at PiPL and read it at C++ end.
    Another important fact is that we have the message pointer which points to above plug-in parameters.
    Automation plugin would give that access.

  • Parameters to Applets in Eclipse

    Hi friends
    I M new to java applets.How can I pass Parameters (HTML Tags) in a Applet using Eclipse. My Applet runs with default Parameters. How Can I give new parameters.

    oops !!!!!!
    I forget to paste program with it.
    import java.applet.*;
    import java.awt.*;
    import java.awt.image.MemoryImageSource;
    import java.awt.image.PixelGrabber;
    import java.net.URL;
    <applet code = Lavatron.class width=560 height=128>
    <param name="img" value="vf.gif">
    </applet>
    public class Lavatron extends Applet implements Runnable{
         int scrollX;
         int bulbsW, bulbsH;
         int bulbS = 8;
         Dimension d;
         Image offscreen,bulb,img;
         Graphics offgraphics;
         int pixels[];
         int pixscan;
         IntHash clut = new IntHash();
         boolean stopflag;
         public void init() {
              d = getSize();
              int offw = (int) Math.ceil(d.width/bulbS)*bulbS;
              int offh = (int) Math.ceil(d.height/bulbS)*bulbS;
              offscreen = createImage (offw , offh);
              offgraphics = offscreen.getGraphics();
              bulbsW = offw/bulbS;
              bulbsH = offh/bulbS;
              bulb = createBulbs (bulbS , bulbsH*bulbS);
              try{
                   img = getImage (getDocumentBase() , getParameter("img"));
                   MediaTracker t = new MediaTracker (this);
                   t.addImage(img,0);
                   t.waitForID(0);
                   pixscan = img.getWidth(null);
                   int h = img.getHeight(null);
                   pixels = new int[pixscan * h];          
                   PixelGrabber pg = new PixelGrabber (img,0,0,pixscan,h,pixels,0,pixscan);
                   pg.grabPixels();
              catch(InterruptedException e){};
              scrollX = 0;
              //paint blackbulbs on the offscreen image
              offgraphics.setColor(Color.black);
              offgraphics.fillRect(0,0,d.width,d.height);
              for ( int x=0; x<bulbsW; x++)
              offgraphics.drawImage(bulb, x*bulbS,0,null);
         Image createBulbs(int w,int h){
              int pixels[]= new int[w*h];
              int bulbBits[]= {
                        0,0,1,1,1,1,0,0,
                        0,1,2,1,1,1,1,0,
                        1,2,1,1,1,1,1,1,
                        1,1,1,1,1,1,1,1,
                        1,1,1,1,1,1,1,1,
                        1,1,1,1,1,1,1,1,
                        0,1,1,1,1,1,1,0,
                        0,1,1,1,1,1,0,0,
              int bulbCLUT[] = {0xff000000, 0x00c0c0c0, 0xffffffff};
              for (int i=0; i<w*h; i++)
                   pixels[i] = bulbCLUT[bulbBits[i%bulbBits.length]];
              return createImage(new MemoryImageSource(w,h,pixels,0,w));
         public final Color color(int x, int y){
              int p = pixels[y*pixscan+x];
              Color c;
              if((c=(Color)clut.get(p))== null);
              clut.put(p,c = new Color(p));
              return c;
         public void update() {}
         public void paint(Graphics g) {
              URL url= getDocumentBase();
              String msg = "Docment Base : " + url.toString();
         g.drawString(msg,10,20);
              offgraphics.copyArea(bulbS,0,bulbsW*bulbS-bulbS,d.height,-bulbS,0);
              for (int y =0; y<bulbsH;y++){
                   offgraphics.setColor(color(scrollX, y));
                   offgraphics.fillRect(d.width-bulbS, y*bulbS, bulbS, bulbS);
              offgraphics.drawImage(bulb, d.width-bulbS, 0, null);
              g.drawImage(offscreen,0,0,null);
              scrollX=(scrollX+1)% pixscan;
    Thread t;
         public void run() {
              while (true) {
                   paint(getGraphics());
                   try{Thread.yield();}
                   catch (Exception e){};
                   if(stopflag)
                        break;
         public void start() {
              t = new Thread(this);
              t.setPriority(Thread.MIN_PRIORITY);
              stopflag= false;
              t.start();
         public void stop () {
              stopflag = true;
    }

Maybe you are looking for