Call the CALL METHOD and CREATE OBJECT

Hi Friends,
     How to call the CALL METHOD and CALL OBJECT in the se38 edit program.For example for calling the FUNCTION MODULE we can use the pattern in that using the call function we can get the function module in the se38 edit.but in METHOD hoe to call if you explain me in detail it would be very much usefulfor me.
Thanks,
Regards,
Rajendra Kumar

Hi rajendra,
its the same way we do. call pattern ..there will be another radiobutton whcich says 'ABAP objects' , give the method name and the class name there.. this will call the method similar to function module..
we can also write our own classes and methods...
say..you created your own class c1 and method m1
then first create the instance of the object..
data:obj1 type ref to c1.
create object obj1.
call method obj1->m1.
Regards,
Vidya.

Similar Messages

  • How to create the custom method and make it available to clients:

    Hello, Can any one help me with this problem ASAP??
    I am trying to work on an example of "Customizing the Query and Creating an Associated Custom Method"
    from http://helponline.oracle.com/jdeveloper/help/topics/jdeveloper/developing_mvc_applications/adf_pviewcustommethod.html?tp=true#method. To do that, the first task is to create the custom method and make it available to clients.
    Following instructions in the helponline documentation, I completed the three steps: (1) "Specify a custom query for the View Object definition for EmployeesView", (2) "Add the custom method to the application module Java class", and (3) "Make the method available to clients".
    The following is the error message I got to test the application module. Can anyone tell me what the message really means and what I should do. I am wondering if there is any mistakes in the document.
    (oracle.jbo.SQLStmtException) JBO-27122: SQL error during statement preparation. Statement: SELECT Employees.EMPLOYEE_ID, Employees.FIRST_NAME, Employees.LAST_NAME, Employees.EMAIL, Employees.PHONE_NUMBER, Employees.HIRE_DATE, Employees.JOB_ID, Employees.SALARY, Employees.COMMISSION_PCT, Employees.MANAGER_ID, Employees.DEPARTMENT_ID FROM EMPLOYEES Employees WHERE Employees.SALARY > :1 and Employees.DEPARTMENT_ID = :2
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) ORA-01008: not all variables bound

    You need to set values for the parameters in your query before you try to execute the query in the view object.
    So you need to call the setBindVars method before the query.

  • Calling Methods from Business Object BUS2032

    Hi all,
              Is it possible to call methods from the Business Object BUS2032.
       If so, how can it be done?? 
    Regards,

    Hi Marv,
    you sure can. Here is an extract from the SAP Help. I found it at http://help.sap.com/saphelp_46c/helpdata/en/c5/e4ad71453d11d189430000e829fbbd/frameset.htm
    <b>Programmed Method Call</b>
    Call (fictitious) method Print of object type VBAK (sales document). The method receives the parameters Paperformat and Printertype as input.
    * Call method Print of object type VBAK
    * Data declarations
    DATA: VBAK_REF TYPE SWC_OBJECT.
    SWC_CONTAINER CONTAINER.
    * Create object reference to sales document
    SWC_CREATE_OBJECT VBAK_REF 'VBAK' <KeySalesDoc>
    * Fill input parameters
    SWC_CREATE_CONTAINER CONTAINER.
    SWC_SET_ELEMENT CONTAINER 'Paperformat' 'A4'.
    SWC_SET_ELEMENT CONTAINER 'Printertype' 'Lineprinter'.
    * Call Print method
    SWC_CALL_METHOD VBAK_REF 'Print' CONTAINER.
    * Error handling
    IF SY-SUBRC NE 0.
    ENDIF.
    Cheers
    Graham

  • XML Parsing and creating objects..

    I need to create objects with the value present in the XML file under a specific tag.
    E.g.:
    XML file:
    <employees.
    <employee>
    <name>
    <first>Chandan</first>
    <last>Sharma</last>
    </name>
    <empid>1212</empid>
    <dept>Telecom</dept>
    </employee>
    <employee>
    <name>
    <fitst>First</first>
    <last>Last</last>
    </name>
    <empid>100</empid>
    <dept>Dept</dept>
    </employee>
    </employees>
    There may be tags other than <employees> in the XML file.
    I need to parse this file and create objects of class
    Employees{
    String firstName,lastName,empid,dept;
    Please help me.
    As I am new with this, it would be better if you provide me some with code.
    Thanks & Regards,
    Chandan Sharma

    You can od it using SAX of course but the implementation is completely different. As I haven't used any SAX approach for many years, I can't provide you any example but you should find many of them either with google or by downloading any java implementation (like Xerces, Xalan...)
    The better solution depends on your needs. That's the standard answer, I know :)
    when you use DOM, you load the entire content of the file in the memory. and then you travel through the JAVA structure that has been created by using the methods I gave you.
    When you use SAX, you define a listener for your parser that will be called any time the parser finds something interesting. a new node, a new attribute, a new node content... sometimes it's a pain to implement.
    In my opinion if your application will only handle one message at a time, you should keep the DOM approach because I don't think there will be any big difference in time processing. On the other hand if your application will potentially manage multiple messages at the same time, then your computer memory can be overloaded by a DOM approach and the you will face bad performances, in such case use the SAX approach.
    as a conclusion, the best way to make a decision is to run benchmarks. good luck :)
    Marc

  • How to keep track of all the classes/methods/properties created in a long script

    Hi,
    I'm curious to know what method people use to keep track of all the classes, methods, and properties you've created when writing a longer script.
    For quick scripts, this isn't a problem. But for long scripts it can get quite difficult to keep track of all the objects one has created, and all their methods and properties, and overloaded constructors, etc.
    ESTK is great, and it's the IDE I use for InDesign scripting, if only because of it's powerful debugging options.
    But it doesn't provide any way of keeping track of this stuff. No proper Intellisense as in Visual Studio.
    I'd be interested to hear how people solve this issue.

    Hi Ariel,
    Not sure it is relevant to your question but I have an old snippet that collects and displays ExtendScript references using $.list(). This may help to track some object relationships.
    // WARNING: this is just a WIP -- Not tested in all platforms and versions
    $.scanRefs = function scanRefs(/*0|1*/showAll)
        var s = $.list(),
            p = (!showAll) && s.indexOf('[toplevel]'),
            a = ((!showAll) ? s.substr(0,10+p) : s).split(/[\r\n]+/),
            n = a.length,
            // --- Address:1     L:2  Rf:3   Pp:4  Type:5  Name:6
            re = /^([0-9a-z]{8}) (.) +(\d+) +(\d+) (.{10}) (.{1,17})/,
            reTrim = / +$/,
            i, t, k, m,
            refBy, type, name, tag, rest, rfCount, props, j,
            o = {},
            TYPES = {'Function':"FCT", 'Object':"OBJ", 'Array':"ARR", 'RegExp':"REG"};
        for( i=2, refBy=0 ; i < n ; ++i )
            s=a[i];
            while( s && m=s.match(re) )
                k = '&'+m[1].toUpperCase();
                rfCount = parseInt(m[4],10);
                rest = s.substr(m[0].length);
                type = m[5].replace(reTrim,'');
                name = m[6].replace(reTrim,'');
                if( 0x5B==rest.charCodeAt(0) )
                    p = rest.indexOf(']');
                    tag = rest.substr(0,1+p);
                    rest = rest.substr(1+p);
                else
                    tag = '';
                if( 0x20==rest.charCodeAt(0) )
                    rest=rest.substr(1);
                if( p=!(rest.indexOf("referenced by:")) )
                    rest = rest.substr(14);
                o[k] || (o[k] = {
                    locked:        +('L'==m[2]),
                    rfCount:    parseInt(m[3],10),
                    ppCount:    rfCount,
                    type:        TYPES[type]||type,
                    name:        name,
                    tag:        tag,
                    from:        [],
                    order:        -1,
                if( 0 < refBy )
                    if( p || !rest ){ throw "Unable to parse references." }
                    props = rest.split(' ');
                    refBy -= (j=props.length);
                    while( j-- ) t.from.push([k,props[j]]);
                    (props.length=0)||(props=null);
                    rest = '';
                else
                    refBy = rfCount;
                    if( p != !!refBy )
                        if( p ){ throw "Unable to parse references."; }
                        refBy = 0;
                    (t = o[k]).order = n - i;
                (m.length=0)||(m=null);
                s = rest;
        a.length=i=0;
        for( k in o )
            if( !o.hasOwnProperty(k) ) continue;
            a[i++] = k;
        a.sort( function(x,y){return o[x].order-o[y].order;} );
        //a.sort( function(x,y){return parseInt(x.substr(1),16)-parseInt(y.substr(1),16);} );
        var u,
            pngLock = "\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x0E\x00\x00\x00\x0E\b\x06\x00\x00\x00\x1FH-\xD1\x00\x00\x00\tpHYs\x00\x00\x0B\x13\x00\x00\x0B\x13\x01\x00\x9A\x9C\x18\x00\x00\x01VIDAT(\xCF\xA5\x91\xB1j\xC2P\x14\x86\x93\xD6\x94\x98\xA4\xB5\xA5\x85\x0E-R\xAF\xA5\xB8\xF4\x1D\xAA\xEF\x10_B\x9C\xDD\x0B]\xA4o`C\xE9$B\x1C\xCD\x10\x10C6\x05q\td\xA9%\x83d2\x83O\xF0\xF7\xDCp#i\xB5\x1D\xDA\xC0\xC7\xB97\xE7|\xF7\xDC\xCB\x91\x00H\x7FA\xFA\xB7\x98\xFF\xAA\xD5\xEA\x0B\x855\xC1\x13k\xDA\xBF\xEA\x9A\xA6\x9C\x18\xC6\xC1\xB6\xE8\xBBHE\x16\x85w\xC6\xD8\xE3\x91\xA2\xDCQ|\xA2\xFD\x07\xC57\xADXT\x8B\xAAz\xB8#\x8A\x13\xD7\xBC\xD8\xD0\xB4kC\xD7\x19q\xCB*\x95g\xFA\x9FP\xD7\x0B\x8A\n!oE.\xB5Z-\xEC\xA3\xD9l\xA2\xFEP\x07\x1D\xC8;\x18D!/\x16x\x91\xEF\xFBX.\x97\xD8l6H\x92$]O\xA7S\x8CF#\x887\x9F\x13j^T\xB9\xD8\xE9t0\x99L\x10\xC71V\xAB\x15\x82 \xC0\xD0\x1E\xA2\xDDng\xE2\x15q\x9C\x175.:\x8E\x83\xC5b\x81(\x8A \xCB2\xE6\xF39\\\u00D7E\xBF\xDF\xCF\xC4\x1B\xE24/\x1A\\\u00ECv\xBB\xF0<\x0Fa\x18\xA2\xD1h`<\x1E\xC3\xB2,\x98\xA6\x99\x89\x8C8\xDB\x11\x07\x83AzU\xDEu6\x9B\xA5\xA2m\xDB\xE8\xF5z?\x8B4\xC3,\xF9\x1B_E1\x9F\x12Q&j\xC4\xFD\x1Ej\"_\xCA\x8B\x051\xA3K\x91d{(\x8B\xBC\xFE\t\xC1TI!\xE3L\x03\x7F\x00\x00\x00\x00IEND\xAEB`\x82",
            pngNop = "\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x0E\x00\x00\x00\x0E\b\x03\x00\x00\x00(\x96\xDD\xE3\x00\x00\x00\x03PLTE\x00\x00\x00\xA7z=\xDA\x00\x00\x00\x01tRNS\x00@\xE6\xD8f\x00\x00\x00\x15IDATx\xDA\xDD\xC1\x01\x01\x00\x00\x00\x80\x90\xFE\xAF\xF6#\xDA\x01\x00\xD2\x00\x01\xCC \x10\x14\x00\x00\x00\x00IEND\xAEB`\x82",
            w = new Window('dialog', " ExtendScript Memory"),
            p1 = w.add('panel', u, "References"),
            lRefs = p1.add('listbox', u, "",
                numberOfColumns: 4,
                showHeaders: true,
                columnTitles: ["Address", "Type", "Name", "Refs"],
                columnWidths: [90,60,120,36],
            g = w.add('group'),
            pFrom = g.add('panel', u, "From"),
            lFrom = pFrom.add('listbox', u, "",
                numberOfColumns: 4,
                showHeaders: true,
                columnTitles: ["Address", "Type", "Name", "Property"],
                columnWidths: [90,60,120, 120],
            pTo = g.add('panel', u, "To"),
            lTo = pTo.add('listbox', u, "",
                numberOfColumns: 4,
                showHeaders: true,
                columnTitles: ["Property", "Address", "Type", "Name"],
                columnWidths: [120,90,60, 120],
        g.orientation = 'column';
        w.orientation = 'row';
        w.alignChildren = ['left','top'];
        lRefs.maximumSize = lRefs.minimumSize = [330,450];
        lFrom.maximumSize = lFrom.minimumSize = [420,120];
        lTo.maximumSize = lTo.minimumSize = [420,220];
        lRefs.onChange = function()
            lFrom.removeAll();
            lTo.removeAll();
            lFrom.parent.text = "From";
            lTo.parent.text = "To";
            if( !this.selection ) return;
            var key = '&'+this.selection.text,
                t = o[key],
                from = t.from,
                i = from.length,
                k;
            lFrom.parent.text = "["+key.substr(1)+"] is reachable from " + t.ppCount + (1<t.ppCount ? " properties" : " property");
            if( t.ppCount && !i )
                with( lFrom.add('item', '--------') )
                    image = pngNop;
                    subItems[0].text = '';
                    subItems[1].text = '<UNKNOWN REFERRER>';
                    subItems[2].text = '';
            while( i-- )
                k = from[i][0];
                t = o[k];
                with( lFrom.add('item', k.substr(1)) )
                    image = t.locked ? pngLock : pngNop;
                    subItems[0].text = t.type;
                    subItems[1].text = t.name + ' ' + t.tag;
                    subItems[2].text = from[i][1];
            for( k in o )
                if( !o.hasOwnProperty(k) ) continue;
                t = o[k];
                from = o[k].from;
                i = from.length;
                while( i-- )
                    if( from[i][0]!=key ) continue;
                    with( lTo.add('item', from[i][1]) )
                        image = pngNop;
                        subItems[0].text = k.substr(1);
                        subItems[1].text = t.type;
                        subItems[2].text = t.name + ' ' + t.tag;
            lTo.parent.text = "["+key.substr(1)+"]'s properties had access to " + lTo.items.length + " addr.";
            from = t = null;
        for( i=0, n=a.length ; i < n ; ++i )
            t = o[k=a[i]];
            with( lRefs.add('item', k.substr(1)) )
                image = t.locked ? pngLock : pngNop;
                subItems[0].text = t.type;
                subItems[1].text = t.name + ' ' + t.tag;
                subItems[2].text = t.ppCount + '/' + t.rfCount;
        w.show ();
    // TEST
    var t;
    var f = function MyFunc()
        (function MyInnerFunc(){})();
    $.scanRefs(1);
    @+
    Marc

  • Custom Image Capture that Auto Imports the OS WIM and Creates a New Task Sequence

    We just finished a consulting project where our customer requested an easy solution to capture thick images.  After hearing their reasoning it made sense for their circumstances.  The people that
    will be managing the system will be non-technical and all they wanted was a very, very simple method of capturing and deploying images with no learning curve.   They wanted the ability to Deploy the images via PXE.  
    This quickly became both our easiest scope project but making MDT simple for non-technical users can be challenging.   The MDT capture and staging steps are pretty easy for tech savvy person but for non-technical people it presented a learning
    curve that the customer wanted simplified. They didn’t want to understand sysprep, capture, importing an OS and then creating a Task Sequence to reference that new image.        
    So we changed the scope of our project to automate MDT to perform additional steps following the capture that would:
    Automatically Import the Captured OS into the MDT Deployment Share
    Automatically Create a new Task Sequence that references the newly imported image
    Auto Name the Task Sequence with the Model Name, Date and Time of Capture
    The Final Solution:
    Customer will setup a Windows PC Thick Image (All software and drivers)
    The customer will Kick-off the Sysprep and Capture Task Sequence
    The customized Task Sequence will capture, import the new image, and create a new TS with the new image
    Customer can then PXE boot a new computer and Deploy the image or stage to media and deploy the image
    We were able to remove the import OS and create new task sequence steps and this simplified it for our customer considerably.  If anyone is interested in this functionality
    let me know and I can send you instructions.  We used Vbscript, Powershell and PSExec.exe from PowerShell.  It seems to being working pretty good so far
    MDT Task Sequence Duplicator https://panaconsulting.egnyte.com/h-s/20130614/61707be809944999 Application Bundle Duplicator https://panaconsulting.egnyte.com/h-s/20130614/405e7d64e5d54610

    We just finished a consulting project where our customer requested an easy solution to capture thick images.  After hearing their reasoning it made sense for their circumstances.  The people that
    will be managing the system will be non-technical and all they wanted was a very, very simple method of capturing and deploying images with no learning curve.   They wanted the ability to Deploy the images via PXE.  
    This quickly became both our easiest scope project but making MDT simple for non-technical users can be challenging.   The MDT capture and staging steps are pretty easy for tech savvy person but for non-technical people it presented a learning
    curve that the customer wanted simplified. They didn’t want to understand sysprep, capture, importing an OS and then creating a Task Sequence to reference that new image.        
    So we changed the scope of our project to automate MDT to perform additional steps following the capture that would:
    Automatically Import the Captured OS into the MDT Deployment Share
    Automatically Create a new Task Sequence that references the newly imported image
    Auto Name the Task Sequence with the Model Name, Date and Time of Capture
    The Final Solution:
    Customer will setup a Windows PC Thick Image (All software and drivers)
    The customer will Kick-off the Sysprep and Capture Task Sequence
    The customized Task Sequence will capture, import the new image, and create a new TS with the new image
    Customer can then PXE boot a new computer and Deploy the image or stage to media and deploy the image
    We were able to remove the import OS and create new task sequence steps and this simplified it for our customer considerably.  If anyone is interested in this functionality
    let me know and I can send you instructions.  We used Vbscript, Powershell and PSExec.exe from PowerShell.  It seems to being working pretty good so far
    MDT Task Sequence Duplicator https://panaconsulting.egnyte.com/h-s/20130614/61707be809944999 Application Bundle Duplicator https://panaconsulting.egnyte.com/h-s/20130614/405e7d64e5d54610
    I would love to get the instructions to this process, as I have a simular client.

  • What is the best method for creating a simple DVD from X?

    Now that I no longer have DVD SP on my system, I need to know the preferred method of creating a simple menu driven DVD. The DVD needs to have a simple (one click) since the local cable company needs that so it will trigger at a specified time. I shoot in 720p 60. The DVD is SD. I do have Toast, Compressor, and iDVD on the computer. Any input will really be appreciated. Thanks in advance.
    Cheers.
    Tom

    Thanks Luis.
    Can't beleive I missed that. I am so used to using Compressor or Toast. This method works great. Thanks.
    Best.
    Tom

  • How to use the index method for pathpoints object in illustrator through javascripts

    hii...
    am using Illustrator CS2 using javascripts...
    how to use the index method for pathpoints object in illustrator through javascripts..

    Hi, what are you trying to do with path points?
    CarlosCanto

  • HT201263 My ipod Touch does not want to turn on. I've tried all the different methods and I'm stuck and dont know what to do now. What else can I try?

    My ipod Touch does not want to turn on. I've tried all the different methods and I'm stuck and dont know what to do now. What else can I try?

    JesusDGZ wrote:
    My ipod Touch does not want to turn on. I've tried all the different methods and I'm stuck and dont know what to do now. What else can I try?
    I have no clue what you mean by "all the different methods."  Here are my suggestions.
    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.

  • How to find out the PATTERN, GRADIENT and BRUSHED objects?

    How to find out the PATTERN, GRADIENT and BRUSHED objects information in illustrator active document file. And also how to find the CMYK and RGB color information in illustrator file through javascript. Could you please provide any examples.

    I tried using the below code. But for both "cmyk" and "grayscale" pattern it gives only CMYK. Kindly check and advise.
    Code:
    var docRef = activeDocument;
    for(var i=docRef.inkList.length-1;i>=0;i--){
      var inkRef=docRef.inkList[i];
      var inkRefName=inkRef.name;
      alert(inkRefName);
      alert(inkRef.inkInfo.kind);
    Thanks for looking into this.

  • I'm moving to an imac from a PC. I want to move my itunes library from the PC to my new imac. What is the best method and where can I find instructions?

    I'm moving to an imac from a PC. I want to move my itunes library from the PC to my new imac. What is the best method and where can I find instructions?

    Move iTunes from PC to MAC, http://www.macworld.com/article/146958/2010/03/move_itunes_windows_mac.html

  • Facebook like button is not working, I have used the muse widget and created code from facebook. Does anyone know how to get this to work?

    Facebook like button is not working, I have used the muse widget and created code from facebook. Does anyone know how to get this to work?

    Hi connally25,
    Below is a link to a video tutorial on how to add a Facebook Log button, please check if you have followed the same steps to add the video.
    http://tv.adobe.com/watch/learn-adobe-muse-cc/adding-a-facebook-like-button/
    If you have followed the steps correctly and the button still does not work; here is a link to a forum thread which might help solving the issue:
    Facebook Follow Widget not working
    Regards
    Sonam

  • Good Morning.  I'm having a problem using both my Photoshop elements and premiere programs.  I've installed the programs, redeemed my code and entered the serial numbers, and created the adobe log-in.  I am able to open up the organizer without problems,

    Good Morning.  I'm having a problem using both my Photoshop elements and premiere programs.  I've installed the programs, redeemed my code and entered the serial numbers, and created the adobe log-in.  I am able to open up the organizer without problems, but when I try to open up the photo editor (either by trying to open up the program from the main menu, or right-clicking on a photo in the organizer to edit in elements), the program asks me to sign in to adobe (which I can do and it doesn't give an an "incorrect password" or log-in ID error) then accept the terms and conditions.  When I click to accept the terms and conditions, nothing happens and the editor fails to open.  Everytime I click on the program, I get this same "loop" of signing in and accepting T&C's, but the program fails to open.  Any advice?

      Premiere Elements 10 is now 64 bit, but not PSE10.
    Take a look at your scratch disk set-up and if you have a spare volume, allocate that first before the C drive. Elements use scratch disks when it gets low on RAM.
    Click image to enlarge
    Turn off face recognition and the auto-analyzer to improve performance.
    When editing photos or videos check the task manager to see what background processes may be running and end them temporarily if not needed.

  • HT2736 when i need to gift any app by print gift myself take me to billing info to choose the raiment method and already i have credit on my iTunes card

    when i need to gift any app by print gift myself take me to billing info to choose the raiment method and already i have credit on my iTunes card

    You cannot use a balance from a gift card to purchase another gift. You will have to provide a credit card.
    Regards.

  • How to call paint() method during creating object

    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    class SomeShape extends JPanel {
         protected static float width;
         protected BasicStroke line = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.CAP_ROUND);
    class Oval extends SomeShape {
         Oval(float width) {
              this.width = width;
              line = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.CAP_ROUND);
              repaint();
         public void paint(Graphics g) {
              Graphics2D pen = (Graphics2D)g;
              int i = 10;
              super.paint(g);
                   g.setColor(Color.blue);
                   g.drawOval(90, 0+i, 90, 90);
                   System.out.println("paint()");
    public class FinalVersionFactory {
        JFrame f = new JFrame();
        Container cp = f.getContentPane();
        float width = 0;
        SomeShape getShape() {
             return new Oval(width++); //I want to paint this oval when I call getShape() method
         public FinalVersionFactory() {
              f.setSize(400, 400);
    //          cp.add(new Oval()); without adding
              cp.addMouseListener(new MouseAdapter() {
                   public void mouseReleased(MouseEvent e) {
                        getShape();
              f.setVisible(true);
         public static void main(String[] args) { new FinalVersionFactory(); }
    }I need help. When I cliked on the JFrame nothing happened. I want to call paint() method and paint Oval when I create new Oval() object in getShape(). Can you correct my mistakes? I tried everything...Thank you.

    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    class SomeShape extends JPanel {
         protected static float width;
         protected static BasicStroke line = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.CAP_ROUND);
    class Oval extends SomeShape {
         static int x, y;
         Oval(float width, int x, int y) {
              this.width = width;
              this.x = x;
              this.y = y;
              line = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.CAP_ROUND);
         public void paint(Graphics g) {
              Graphics2D pen = (Graphics2D)g;
                   g.setColor(Color.blue);
                   pen.setStroke(line);
                   g.drawOval(x, y, 90, 90);
                   System.out.println("Oval.paint()"+"x="+x+"y="+y);
    class Rect extends SomeShape {
         static int x, y;
         Rect(float width, int x, int y) {
              this.width = width;
              this.x = x;
              this.y = y;
              line = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.CAP_ROUND);
         public void paint(Graphics g) {
              Graphics2D pen = (Graphics2D)g;
                   g.setColor(new Color(250, 20, 200, 255));      
                   pen.setStroke(line);
                   g.drawRect(x, y, 80, 80);
                   System.out.println("Rect.paint()"+"x="+x+"y="+y);
    public class FinalVersionFactory extends JFrame {
        Container cp = getContentPane();
        float width = 0;
        int x = 0;
        int y = 0;
            boolean rect = false;
        SomeShape getShape() {
             SomeShape s;
              if(rect) {
                   s = new Rect(width, x, y);
                   System.out.println("boolean="+rect);
              } else {
                   s = new Oval(width++, x, y);
                   System.out.println("boolean="+rect);
              System.out.println("!!!"+s); //print Oval or Rect OK
              return s; //return Oval or Rect OK
         public FinalVersionFactory() {
              setSize(400, 400);
              SomeShape shape = getShape();
              cp.add(shape); //First object which is add to Container(Oval or Rect), returned by getShape() method
              //will be paint all the time. Why? Whats wrong?
              cp.addMouseListener(new MouseAdapter() {
                   public void mouseReleased(MouseEvent e) {
                        x = e.getX();
                        y = e.getY();
                        rect = !rect;
                        getShape();
                        cp.repaint(); //getShape() return Oval or Rect object
                                      //but repaint() woks only for object which was added(line 67) as first
              setVisible(true);
         public static void main(String[] args) { new FinalVersionFactory(); }
    }I almost finish my program but I have last problem. I explained it in comment. Please look at it and correct my mistakes. I will be very greatful!!!
    PS: Do you thing that this program is good example of adoption Factory Pattern?

Maybe you are looking for

  • Facetime on 2 ios devices

    trying to use 2 ios devices linked to the same apple id, set up different emails in each but the recipient device just rings once then says "xxxx is busy" does it make any difference being on the same wireless network? wouldnt have thought so, where

  • Flash video / autohide question

    Hi, I'm building a website in Flash 8 which plays a number of videos. I have the choice of playing the videos using FLVPlayback components built into each video's .swf, or just creating a custom controller skin (the client wants a skin which resemble

  • Text at selection-screen level

    Hi Folks, I have a selection-screen having the matnr and quantity. MATNR is going to be fetched from the table but the quantity is going to be given by the user at the selection screen level.Now if the user enters say part4 as matnr 10 as quantity,th

  • 5508 LAG bundle connected to Nexus

    Currently setting up a 5508 WLC connected to a Nexus C7010 running 5.1(1) code. WLC setup guide recommends the switch the WLC is connected to runs src-dst-ip load balancing on the LAG bundle. The setup guide also makes reference to 6500 switches runn

  • How can I register my E51 to Voipbuster?

    Dear more experienced users, I just bought a E51. A wonderful thing. Connection to my WLAN works I did not succeed to connect to my Voip provider Voipbuster. I use a Zyxel P-2602HW-D1A Wireless modem. Can you tell me how to make this work? Thanks! Ma