Adding ItemListeners to an object created in an inner class?

Hi All,
I was wondering how dow you add ItemListeners to an object, thats created in an inner class of an outer class that implements the item listener interface. Or is it possible? I got around the problem by putting the createBox method in the outer class and calling it from the inner class, but it would be nice to know if you can keep it contained.
i.e (Assume everythings declared, libs are imported, interface is implemented in outer class etc.)
public class OuterClass implements ItemListener
    // Stuff
    class InnerClass
        // Yet more stuff
        void createBox (JPanel aPanel)
             JCheckBox aBox = new JCheckBox;
             aPanel.add(aBox)
             // What should this line be ->
             aBox.addItemListener(whatGoesHere?);
    // More Stuff
}

aBox.addItemListener(OuterClass.this);

Similar Messages

  • Can I create the object of an protected inner class of a Base class in to t

    Dear All,
    Can I create the object of an protected inner class of a Base class in to the subclass ?
    e.g.
    public class Base{
         protected class Inner {};
    Public class Sub extends Base{
         Public Inner amethod (){
              Return new Inner(); //here I get an exception as
                                //Inner has protected access
    }Regards,
    Ishan

    @Op. The code that you posted isn't close to compiling. Java is case sensitive. It should be public and not Public, and return instead of Return.
    Kaj

  • Referencing parent object in a annonymous inner class

    so i have this on some class i wrote:
    public class MyClass {
    randomButton.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e)
              //refernce the object instanciated from MyClass somehow.
              //the this keyword references the actionlistener here., super.this doesnt work

    what you can do is that you can store an instance of
    the MyClass it self inMyClass
    example
    public class MyClass {
    private MyClass instance = this;
    ...then, in the inner class, just refer to instance
    rather then using this.This is not a good advice. It's better to do what
    ehodges says. You should use the name of the
    outerclass followed by .this. E.g. MyClass.this in the
    example above.
    /Kajok... learning something new...

  • Appraisal Objects created in 'Approved' Planning status

    Good day,
    When creating Appraisal Template objects, they are created in 'Approved' Planning Status. We want them created in 'Active' Planning Status. We suspect this is the reason why we can't configure/define the process configuration for our template under IMG path: Personnel Management > Personnel Development > Objective Setting and Appraisals > Define Tabs and Process Configuration for Template. The system gives the following error message: "No process defined for form <template name>"
    We've tried using program RHAKTI00 to make these objects (VA VB VC) active but are facing a further issue that it makes appraisal template unreleased. Vice versa when i released the template, it makes objects planning status to reset to approved from active. A similar issue has been posted in the below thread but an answer was not provided.
    Objects created in 'Approved'  Planning status
    Kindly assist.
    Best regards
    Hardus

    >
    Chris Thomas wrote:
    > Michael - thanks as always for your insight and willingness to help out.
    >
    > Let me explain further.  Duke currently has a third party performance management system that allows the users to manage their Expected Job Results (EJR) in a catalog (translate to Qualifications catalog in R3).  In a separate step, the manager can select a single EJR and on the other side of the screen select all , or a subset of their employees to assign the EJR to.
    >
    > Extrapolate this to SAP PM.  We have created a Criteria group in our template and have experimented with adding qualifications via the BADI and this works fine EXCEPT that the manager would have to do this in each employee's appraisal, individually.  We are developing the tool to build and maintain the qualification catalog and assign to the employee via Manager Self Service, we are hoping to be able to facilitate the assignment of the EJR/Qualification into the employee's appraisal template.   The EJR's (Q objects) will be associated to a quadrant in their catalog: QK's - Clinical Quality, Customer Service, Finance and Work Culture
    >
    > The criteria group, Expected Job Results, has for criteria groups nested under it:  VB objects for four quadrants, Clinical Quality, Customer Service, Finance and Work Culture.   SO, we get to the crux of the matter.  Since we know the employee, we can get to the appraisal document and associated data in the tables.  The decision of which VB to go to is what we are trying to facilitate.  The textual names will be the same for the quadrants in the QK's and VB's BUT thats a bad way to try to make a decision, thus the thought to create a relationship between the QK and the associated, logically equivalent VB.  
    >
    > The issue comes up with some of our managers who have large (60+) direct reports so the thought of creating qualifications from the appraisal side, individually per employee does not work.  This is why we are thrashing around with trying to start outside and work our way in.  Make sense ?
    >
    > Chris Thomas
    Hi Chris,
    This is what I was trying to explain between free vs fixed enhancement. 
    Free enhancement - user selects from a list to add something to the template
    Fixed ehahcement - preloads data into the template
    If your application that you build in MSS assigns the qualifications to the employees, you have a number of options to make this work as fixed enhancement.
    First use the following fixed enhancement as your basis: 
    HRHAP00_ENHANCE_FIX1 - Fixed Enhancement - Add Position Requirements
    Now in your MSS application if you assigned the qualifications to the position and wanted all qualifications to show up in 1 criteria group, you can use this enhancement with no development. 
    qualifications assigned to positions or jobs are called requirements
    qualifications assigned to employees are called qualifications
    if you have like 10 qualifications assigned to the position and 4 need to go to clinical quality VB, 3 need to go to finance vb criteria groups, you will create a BADI for each one of those, each criteria group wiill have its own unique badi.  in the badi you will apply the filter after all "requirements are selected from position" so that only the 4 belonging to the qualification block for finance are loaded into that VB. 
    if your mss application MUST assign it the employee for business reason, you use the same logic except swap out position lookup with employee lookup. 
    are we closer?

  • Adding an Array of Objects into an external Web-Service

    Hi all,
    I want to populate an Array of Objects into an external Web-Service which I have introspected into BPM. But I am finding it difficult to do so which should be very easy I guess.
    When i use the EXTEND keyword for adding the array of objects, it gives me the following parameters which are not required:-
    testArray.records.extend(name : "", attributes : null, value : "", children : {  }, tagName : "", namespace : "", isNil : false);
    I only need to populate the name and value pairs and do not need to populate others. But there is no way for me to do this.. How do I populate other parameters or skip them especially
    children which is a Fuego.Xml.XMLObject[].. How do I populate that? How do I populate attributes which is an associative array and not required..
    Is there a proper documentation of consuming external Web-Services into BPM?

    Very interesting, I am going to have to really break this down and see if I can make sense out of it with my 300 lines of code LOL.
    I think this may jsut work at first glance and will let you know!
    It works. We all use it all of the time. The old Add-Member was a big pain in the neck.  InPowerShell V2 New-Object -Property ws added to take a hash of name/value pairs and convert them into an object in one step.  It is faster and more reliable.
    $myprops=@{
        Name='joe'
        Birthdate=[datetime]'02-12-1965'
        Weight=[int]130
        Married=$false
        Flags=[byte]0x3F
    # we can change a value on the fly
    $myprops.Weight+=5  # adjust weight for liars
    New-Object PsObject -Property $myprops
    OR get name=value pairs from a file and make into an object
    $fileprops=Get-Content mydata.txt | ConvertFrom-StringData
    New-Object PsObject -Property $fileProps
    There are more than a dozen other variations of how to levcerage this to create objects out of other things like results from old DOS commands.
    ¯\_(ツ)_/¯

  • How to Execute the Business objects created in ABAP from webDynpro applicat

    Wht is the steps , or where the help documents are available for accessing the Business objects created in ABAP or R/3 systems from webDynpro project.

    Hello Vishal,
    I couldn't find any useful documents for your purpose.
    However i had a similar requirement and had implemented the same using GCP APIs. But before i send you the code help, i would like to know your exact requirement. What are you trying to achieve? Are you just wanting to execute the BO and get the result? Or is your requirement has got something more to do?
    Regards,
    Sudeep.

  • Insert Object (create from pdf file) in wordpad fails

    Problem:
    I am unable to insert object (create from existing pdf file) in wordpad application.
    Environment:
    OS: Windows 7 Professional + SP1 (64-bit)
    Acrobat X (32-bit installer)
    Procedure:
    Open Wordpad application, click on 'Insert Object', choose 'Create from File', Browse and Select exsting pdf file, click 'Display As Icon' and Click 'Ok'
    Expexted Result:
    PDF should get inserted as OLE object to wordpad
    Actual Result:
    Error message "Failed to create object. Make sure the application is entered in the system registry."
    Addition Notes:
    I noticed that while insterting PDF (OLE object) it seach for certain registry key (AutoConvertTo) which is not available hence it fails.

    Yes, I am aware. But this problem appears only when I insert PDF file (which is Adobe file).
    I guess this has nothing to do specifically with 'wordpad' but I referenced known application from standard offiering. It happens with any 64-bit application using 'rich-edit' control (this is Microsoft too ) and allowing user to insert OLE objects.
    I guess somewhere Adobe Acrobat installation fails to create required registry entries which are being referred by 64-bit applications while inserting PDF files as OLE objects.

  • Garbage collection of objects created inside a method

    I have method and inside the method I create new Objects I mean I instantiate objects using new and call some methods on these objects.
    once the method execution is completed and control goes to caller of the method will all the object created inside the method will be garbage collected ?
    here with code
               public List<StgAuditGeneral> getAudits(
              List<StgAuditGeneral>  audits= new ArrayList<StgAuditGeneral>();
                  for(Map<String, String> result :results ){
                   audits.add(new MapToObject<StgAuditGeneral>() {
                        @Override
                        public StgAuditGeneral getObject() {
                                             StgAuditGeneral  stg= new StgAuditGeneral();
                             return stg;
                   }.getObject());
              }in the above method I cam creating tons of objects wil they be garbage collected immediatedly after jvm leaves the method ?

    user11138293 wrote:
    I have method and inside the method I create new Objects I mean I instantiate objects using new and call some methods on these objects.
    once the method execution is completed and control goes to caller of the method will all the object created inside the method will be garbage collected ?If there are no reachable references, to those objects, then when the method ends, they become eligible for GC. If and when they are actually collected is something we can't know or control, and generally don't care about. The only guarantee is that everything that can be collected will be collected before an OutOfMemoryError is thrown. So from our perspective, once it's eligible for collection, it is effectively collected.
    If you pass references to those objects to something else that holds onto them after the method ends, then they are still reachable, and not eligible for collection.
    However, you almost never need to even think about whether something is eligible for GC or not. It works pretty intuitively.

  • To load a object created with 3D Studio Max

    Hello,
    I am a new Java user. I have to realize an interactive presentation in Java of a three-dimensional object created with 3D Studio Max. I would like to know how I can load this object in my java project.
    I should, in fact, allow the customer to modify the color of the object and to rotate it.
    Many thanks
    Massimo

    Well, my first reccomendation is to look into Java 3D. I don't know anything about it myself, but it's the obvious place to look.

  • How to create an object of inner class

    hi i don't know how to create an object of an inner class..
    i got something like
    class Abc{
    private class Abcd {
    like this and i want to create an object of Abcd so that i can use some of method
    there..
    i think i should create the outter class object first right? but not sure
    the syntax.. i tried something like
    Abc.Abcd justTry = new Abc.Abcd()
    something like this..but not work..
    help me plz. ...

    If the nested class (that's not technically an inner
    class you have there) is not static, then you can't
    refer to it with OuterClassName.InnerClassName any
    more than you can refer to any other member--method
    or variable--with ClassName.staticMember.
    You need an instance.
    It's been a while since I've created an instance of a
    non-static nested class from outside that clsas, but
    I think it's something like this: Outer outer = new Outer();
    outer.Inner inner = new outer.Inner();
    Actually, I think it is this:
      Outer outer = new Outer();
      outer.Inner inner = outer.new Inner();Can't test it now though, gotta go to Taco John's for TACO TUESDAY!!!!
    Gotta love them crunchy shell bean tacos!!!

  • How to find Number of objects created in SAP during 1 year..

    Dear Experts,
    We wanted to know how much customized object has been created in our system in a specified period of time say last 1 year.. Can you please suggest the way to find this.. The objects includes Program. Function Module, Tables, Structures, Smartforms etc...
    Is there a way to check the complexity of these objects..
    Regards,
    Vidya..

    >
    Alpesh wrote:
    > u can check this objects in se03 transaction
    >
    > under transport organization tools --> object --> Object in customer namespace
    >
    > you will get list of all packages and enter whatever you want (say TABL for table  in object type field)
    >
    > Regards,
    > Alpesh
    Read  the thread properly before giving reply.
    There you have no where creation date mentioned, how you
    will identify objects created in SAP during 1 year ?

  • Please  tell me the difference between CREATE OBJECT & CREATE DATA ,statements in CRMTECHNICAL

    Please  tell me the difference between CREATE OBJECT & CREATE DATA ,statements in CRMTECHNICAL

    found it on my own . the best way to do this is use the RetriveLimitedHierTreeCommand  with a search on the taxonomy table.

  • How to identify objects created by registering xml schema

    Hi Everyone,
    We are using Oracle 9i Rel2. I have registered an XML schema and I saw that there were several objects created for it table ,some types and a trigger . For some build purposes I want to exclude all of these objects which are associated with xml schema and should be able to drop and recreate the whole of oracle schema.
    I see the user_types table does not have any parameter to indicate that these are autogenerated or are different. In user_types they look like any other type that a user would have created. Do any of you know how to differentiate these types created by registering XML schemas from the normal types.
    Thanks for your help

    There is no way I know of to differentiate between a type created by Schema Registration and another Type. You can query the XML Schema itslef to get the Typenames it relies on.
    SQL> --
    SQL> SQL> select nvl(extractvalue
    2 (
    3 value(ct),
    4 '/xs:complexType/@name',
    5 'xmlns:xs="http://www.w3.org/2001/XMLSchema"
    6 xmlns:xdb="http://xmlns.oracle.com/xdb"'
    7 ),'Local Complex Type') COMPLEX_TYPE,
    8 extractvalue
    9 (
    10 value(ct),
    11 '/xs:complexType/@xdb:SQLType',
    12 'xmlns:xs="http://www.w3.org/2001/XMLSchema"
    13 xmlns:xdb="http://xmlns.oracle.com/xdb"'
    14 ) SQL_TYPE
    15 from user_xml_schemas,
    16 table
    17 (
    18 xmlsequence
    19 (
    20 extract
    21 (
    22 schema,
    23 '//xs:complexType',
    24 'xmlns:xs="http://www.w3.org/2001/XMLSchema"
    25 xmlns:xdb="http://xmlns.oracle.com/xdb"'
    26 )
    27 )
    28 ) ct
    29 /
    COMPLEX_TYPE
    SQL_TYPE
    PurchaseOrderType
    PURCHASEORDER_T
    LineItemsType
    LINEITEMS_T
    LineItemType
    LINEITEM_T
    COMPLEX_TYPE
    SQL_TYPE
    PartType
    PART_T
    ActionsType
    ACTIONS_T
    Local Complex Type
    ACTION_T
    COMPLEX_TYPE
    SQL_TYPE
    RejectionType
    REJECTION_T
    ShippingInstructionsType
    SHIPPING_INSTRUCTIONS_T
    Local Complex Type
    ROOT_T
    COMPLEX_TYPE
    SQL_TYPE
    Local Complex Type
    P222_T
    10 rows selected.
    SQL>

  • Adding inner class object

    Hello to all
    I have one doubt regarding eventhandling. Consider i am having one class named outer which extends applet and with in outer class i am having one class inner which extends panel.
    Now when i try to add the inner class object in action performed of outer
    class it doesnt get added. How to overcome this.
    Eventhough sometimes it gets added it shouldnot appear for the first time. After resizing the window only it gets displayed.
    How to over come this.
    This is my coding
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test extends JApplet implements ActionListener{
         JButton b1;
         Container c;
         public void init()
              c=getContentPane();
              b1=new JButton("First");
              c.add(b1,BorderLayout.NORTH);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent ae)
              System.out.println("Working");
              c.add(new panel());
         class panel extends JPanel
              int a=5;
              JLabel l=new JLabel("ADSF");
              public panel()
                   add(new JButton("ASDFASDFs"));
                   add(l);
              /*public void paint(Graphics g)
                   g.drawString("ASDFASDF123123123123",20,20);
    }

    You could try being more specific when you add ie
    c.add(new panel(), BorderLayout.CENTER);

  • Create proxy to an object created by a wcf service class

    Hi
    We are trying to develop a WCF Service which is configured as per-session.
    The service object creates another object which has some data + functions, and has its own Interface which is available on both client and server.
    Is it possible to somehow create a proxy of this object on the client so that the client can call the object functions directly ?
    Thanks
    Abhishek
    PS:
    The object interface is also configured as a servicecontract and the object class is also configured as a service. However if we call this service independently, it creates a new instance of the object.

    Hi Amy
    Many thanks for replying.
    OK let me try to explain by way of example code appended after my signature.
    Let us say we have a service which implements Iservice1. The service contract has an operation returning an object of type Userinfo. In addition to data, the userinfo class has a method GetHistory which returns a datatable.
    Datacontract and Datamember attributes will cause the UserInfo object to be recreated on the client. But what I really want is a proxy to this userinfo object, so that the GetHistory function can be called directly rather than going through Iservice1.
    In general, I want the service class to be able to create a server object and then let the client have its proxy.
    Kindly advise.
    Thanks
    Abhishek
    -----Code Begins ---------------------------------
        [ServiceContract]
        public interface IService1
            [OperationContract]
            UserInfo  SelectUserDetails(UserID as Integer);
        [DataContract]
        public class UserInfo
            int userid;
            string username;
            [DataMember]
            public int UserID
                get { return userid; }
                set { userid = value; }
            [DataMember]
            public string UserName
                get { return username; }
                set { username = value; }
            public DataTable GetHistory()

Maybe you are looking for

  • Display of report in excel format.

    Hi,   How to display a report in excel format?? I have the display details in an internal table.     Is it possible for the output to come in excel format as soon as we  run the pgm other.than downloading from list or grid format..If so how to do it?

  • FCC in receiver FTP adapter

    Hi. In attached file ut20140505-165117-416.xml you will find a field called Data. I need to create a txt file based on tghe Data fields. The attached file should create the out.txt file How would a content conversion setting look to accomplish that?

  • Please help me match a cartridge to a printer (both HP)

    I was hoping someone would know of a list where I can find out which HP printers take a certain cartridge (in this case, numbers 21, 22 and 58)).A full list would be nice since every so often, I run into full cartridges in thrift shops. Thanks. This

  • Add page number

    How Do I easily add page numbers to all the pages in my document...? Do I really have to manually create a textbox and put a number in it or add a text variable to each and every page? Is't there like some kind of one button push like microsoft word

  • Document printing authorization URGENT

    Please can anyone help. Users receiving error message You are not authorized to perform this action - Document Printing. I have tried changing several authorizations and cannot figure out which one is correct. Can anyone help