Instantiation and communication

Hi there
I'm having problems with communication between classes within an application. I am instantiating objects of one class from within a main class, but these objects need to use methods located in the main class so the objects need to know where the main class is and the main class needs to know which of the objects is using the method so it can communicate back. I think I understand the theory, but I can't make it work. Here are the relevent bits of the code (the rest of the programme is long and boring) - can anyone help?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
import java.util.*;
import java.lang.*;
public class Machine
     private JFrame cbFr = new JFrame();
     private JLabel labCb = new JLabel();                    
     public Machine()
               Kam k1 = new Kam();
     public static void main(String [] args)
               Machine m1 = new Machine();
class Kam implements ActionListener, ItemListener //this the main class
          public Kam()                         
                    Cb a = new Cb(this);
                    cbFr.setLocation(20,230);
                    labcb = new JLabel("CbA ");
                    cbFr = new JFrame("CbA");
                    Cb b = new Cb(this);
                    cbFr.setLocation(20,230);
                    labcb = new JLabel("CbB ");
                    cbFr = new JFrame("CbB");                              Cb c = new Cb(this);
                    cbFr.setLocation(20,230);
                    labcb = new JLabel("CbC ");
                    cbFr = new JFrame("CbC");
class Cb implements ActionListener //class that builds the cb obj above
private String location;
          private Object empty, name, k1;
          public Cb(Kam k1) //trying to hold the location of
the main class
                    k1 = (String)kMachine;
                    drawCbDisplay( );
          public Object getName() //trying to hold the identity
of the objects
                    name = (Object)location;
                    return name;
          public void actionPerformed(ActionEvent ae)                     {     
               if (ae.getSource() == butE)
               k1.validation(); //a main
class method
}          

If you want Kam to call methods from Machine, construct it like this:
Kam k1 = new Kam(this);And change the constructor to this:
public Kam(Machine m)Is that what you meant?
Cheers,
Radish21

Similar Messages

  • Update Address and communication  Details of BP

    Hi,
    Requirement is we need to update address and communication details of BP, please let us know relative BAPI for the same. Below roles has to be updated with given address and communication details,
    General Role
    Employee Role
    Help full information will be appreciated..

    Hi,
      For updation of address you can use
    BAPI_BUPA_ADDRESS_CHANGE.
    I guess you cannot update a role . You can only add new roles with BAPI_BUPA_ROLE_ADD .
    One more thing in address updation, Whatever fields are there in import parameter ( Address) you can update them even if they are not present in database.
    But in case of Tables( Communication details)  fields you can only update if the values are existing in database.
    Reward if helpful.
    Regards
    Sourabh

  • Business Component  and  Communication Component

    hi
    is there any difference between Business Component and Communication Component in PI 7.1.
    I assume business service of pi 7.0 is become Business Component.

    Business Service of PI7.0 is now Business Component of PI7.1 with the same functionality
    Communication Component is containing Business Components, Integration Process, Business System)

  • Problem in Change Office and communication Data

    Hi all,
    In ESS, where we have the Employee search, there is Who's Who and Change office and Communication Data.
    We have added a new field "Mobile Telephone " in who's who list.But when we want to Change/Modify the Mobile number by goin to Change Office and Communication data , we are not getting that field there. How  can we make the changes?
    Need help on this ..
    Thnks in advance.
    NR

    Hi,
    Did u get a solution for this. I am also having a similar problem.

  • Message Interface and Communication Channel are not getting in RW B

    Hi
    I have created a sceario in which i have created following things
    2 - External Definition of Same XSD
    2 - Data Types
    2 - Message Types
    4 - Message Interfaces
    2 - XSLT mappings
    2 - Interface Mapping
    I have created on two scenario objects in XI ID.
    But In RWB i can see only one sceario message interfaces and communication channels but the for other scenario MIs and Communication channels are not visible in RWB
    I have created all the things in only one Namespace.
    What could be the problem .please help me
    Regards

    Hi,
    Have you activated it?
    Can you see it in SXI_CACHE?
    If one is no please run report SAI_CACHE_REFRESH
    Kind regards,
    Wojciech

  • EMET 5.1 crashes Outlook.exe, Photoshop.exe and Communicator.exe. Please explain why it would do that?

    Hi,
    EMET 5.1 is crashing/not opening these applications on two of our staff workstations (Both are Windows 7 x86):  Outlook.exe, Photoshop.exe and Communicator.exe.
    One computer, EMET crashes Communicator and Outlook.  The other Computer, the EMET crashes Photoshop only.
    Obviously, it works for everybody else.  Can someone please explain to me why would EMET crash these apps if it works for the rest?  Could it be that it found a possible threat/exploit to the machine? 
    How do I mitigate this problem?
    Please advise.  Below is a sample of the error.
    Fault bucket 1031393421, type 17
    Event Name: APPCRASH
    Response: Not available
    Cab Id: 0
    Problem signature:
    P1: communicator.exe
    P2: 4.0.7577.4103
    P3: 4fd6bebb
    P4: EMET.DLL
    P5: 5.0.0.0
    P6: 545ffd74
    P7: c0000005
    P8: 00060310
    P9: 
    P10: 
    Attached files:
    C:\Users\xx\AppData\Local\Temp\WERD21D.tmp.WERInternalMetadata.xml
    These files may be available here:
    C:\Users\xx\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_communicator.exe_7fba75e97ffde076db3fe52dd74029de19dc38_15d4e56e
    Analysis symbol: 
    Rechecking for solution: 0
    Report Id: 97ed67e2-de0a-11e4-822e-00125a5e8f35
    Report Status: 0
    Faulting application name: Photoshop.exe, version: 15.2.2.310, time stamp: 0x5480306d
    Faulting module name: EMET.DLL, version: 5.0.0.0, time stamp: 0x545ffd74
    Exception code: 0xc0000005
    Fault offset: 0x0006714e
    Faulting process id: 0x15c4
    Faulting application start time: 0x01d0721e6fc383e7
    Faulting application path: C:\Program Files\Adobe\Adobe Photoshop CC 2014 (32 Bit)\Photoshop.exe
    Faulting module path: C:\WINDOWS\AppPatch\EMET.DLL
    Report Id: b159a74a-de11-11e4-86b9-1cc1de578f37

    One guess is that old Outlook plugins can sometimes cause issues with EMET.  Try starting Outlook in safe mode, by holding down the CTRL key when starting Outlook to see if that helps, and look in Outlook in File / Options / Add-Ins menu item to see
    the add-ons that are installed.  Verify that the OS and apps have all the latest patches if you haven't, though you have probably already done that.  If those don't work you could try unchecking the EMET application protection boxes for the
    application that isn't working, one by one.  Note that EMET 5.2 is out now so that might be something to try too. 

  • RFC: Queries about Arch culture and community

    Good day everyone,
    This is a request for opinions from the Arch community, especially the Arch developers, Trusted Users, and long time users. I am writing a review about Arch Linux which I hope to publish within the next month or so. Unlike most distro reviews, which are actually distro installation reviews, I have devoted a lot of space to The Arch Way, unique technical qualities of Arch, day to day use and maintenance of Arch, and the Arch community. In my view, the community of a distro is much more important than its installation process.
    If I may, I would like to pose some questions about the Arch community. FWIW, I have been quietly participating in the Arch community myself for some months now, contributing material to the wiki. Anyway, please take a look at the queries below, and comment on any as you see fit.
    Thank you,
    Luke Seubert
    1. Despite its modest size, Arch has a very enthusiastic community, as evidenced by its internationalization projects, derivative distros, 3rd party repositories, Arch schwag, active forums and wiki, etc. Is this statement true or false, and if Arch does have an especially enthusiastic community, why?
    2. Arch is deeply conservative, refusing to deviate from core principles. Still, within these bounds, Arch permits a wide array of innovation. Are these statements true or false, and why? If true, what are the pros and cons of such conservatism? If false, in what way has Arch deviated from its core principles or resisted innovation?
    3. The Arch community is fairly harmonious, with little bickering, flamewars, forks or threats to fork, etc. Is this statement true or false, and why? (I have my own theory on the why of this one, and the answer in brief is... dogfood.)
    4. How good or bad a job is Arch doing in cultivating new Trusted Users and Arch developers? Does it have a formal mentoring process? It seems the most direct path to TU status is to put together packages in AUR, and eventually have them voted into Community based upon quality and popularity. However, at some point, virtually all of the popular packages will already be in Community or Extra. How does an AUR uploader become a Trusted User then?
    5. Hypothetical Scenario:
    The Chakra Project successfully completes in alpha, beta, and release candidate Live CD testing, and releases its Live CD - version 1.0 - with the GUI easy Tribe installer, to wide acclaim - DistroWatch even raves about it. Suddenly, there are lots of new Arch users, who never went through the traditional Arch install process, who never "paid their Arch dues", and who are not nearly as clueful because they never RTFW. They are flooding IRC and webforums with really, uh, "basic" questions, and suggesting/demanding new features. How does the Arch community handle this abrupt change in its culture? Has it dealt with such culture shocks before?
    6. If only you too could lift cars over your head, would you be more cool, less cool, or as cool as Phrakture, and why? What if you could only lift cars over your head after eating a can of spinach and slamming a six pack of Red Bull? Then how cool/not cool would you be by comparison?
    Last edited by lseubert (2009-08-08 13:45:07)

    Allan wrote:
    Here are my opinions on these questions and do not necessarily reflect other Arch devs...
    1. True.  I believe part of the enthusiastic community comes from the fact that Arch requires you to set up your system for yourself.  So people become very proud of their achievement of getting their system setup exactly as they like it.
    This is an excellent point. There is a nice sense of pride that comes from tweaking your Arch install to just the way you like it. And it is an involved process requiring some modicum of skill.
    Also, people have always been encouraged to contribute fixes or start projects to fulfill areas they see lacking.  Seeing your work become used by many others is always a good feeling.
    Yeah, I have noted this in my rough draft. Arch has amazingly low barriers to entry. Sign up for an AUR account, which is quick and automatic, and get to work. Your status and authority is derived from a roughly consensual meritocracy, as opposed to a hierarchical, bureaucratic process full of gatekeepers, aka potential gateclosers, like most distros.
    This simplicity extends to our package manager, which I believe is a major factor in making the AUR as popular as it is.  (Note that while pacman is developed primarily by Arch users, it aims not to be tied to any distro).
    Allan, could you clarify this comment? How does pacman make AUR popular? While I use pacman to access binaries from core, extra, and community; I use yaourt to handle PKGBUILDs from AUR. I don't quite follow you on this one.
    But as always, the principles guiding Arch do get bent when it is sensible to do so.  It was always said we don't split packages like many other distros, but we do some splitting these days (e.g. gcc-libs, KDE).  We now include info pages and other docs.
    Both of which are good moves. A system should have documentation built in, for those occasions when internet access is down. And I might actually take a look at KDE 4 once again, now that I wouldn't have to download a pile of unwanted packages.
    3. There are flame-wars every so often...  The last one that was probably quite obvious to many was changing rules governing the community repo (requiring votes or 1% usage as defined by pkgstats) and the move to using the official db-scripts (which may be seen as making the TUs less independent).
    That is a flamewar that I missed. How does Arch resolve difficult issues? There is no Constitution that I could find, nor any formal governing structure. Is it as simple as lengthy debate, and then Dred Overlord Phrakture decrees?
    I have never heard of a treat to fork the distro or components of it.  I guess that is because of the attitude of show us a working implementation of a good idea and it will possibly become official.
    Well, there aren't forks, but there are a lot of derivative distros, some of them with very different goals. And there are a lot of 3rd party repositories out there, outside of AUR. I wouldn't call that forking, but it is, I guess, extending. I think such experimentation is a good thing - really good ideas might be developed outside of even AUR, and eventually brought back into the Arch ecosystem. I believe some of Xyne's packages got started that way, yes?
    Here is an interesting factoid I came up with in my research:
    Packages Per Maintainer Ratio - how many packages on average does a maintainer support?
    For Debian, the P/M Ratio is 28
    When you add up all the Arch Devs and TUs, and divide out the packages in core, extra, and community, the Arch P/M Ratio is 67.
    Arch devs seem quite impressive, until you recall that they mostly maintain one version of each package and for only two architectures, whereas Debian devs support 11 architectures for 5 versions - experimental, unstable, testing, current stable, and old stable. (Ugh - is that brutal or what?)
    Seen in that light, one has to admire the very hardworking Debian devs, and wonder a bit about those Arch dev slackers. Yet another T-shirt idea! Change the first idea so it now reads, "I'm a slacker Arch developer, and I eat my own dogfood!"

  • Instantiation and Encapsulation

    Hi
    Can any one explain me about instantiation and Encasulation with example, i am new to ABAP Objects.
    Please dont send any links.
    Arun Joseph

    Hi,
    First let me give small introduction to OO ABAP programing.
    Object-oriented programming is a method of implementation in which programs are organized      as cooperative collections of objects, each of which represents  an instance of some class...?
    A class is a set of objects that share a common
    structure and a common behavior
    A class will have attributes ( i.e data definition) and methods ( nothing but functions )
    We can also call  object as Instance of the class.
    Lets see a simple demo class to calcualte SUM of 2 numbers.
    define 2 variables a and b of type i. (Attributes)
    SUM is the method name. this will have the logic to do the sum.
    2 importing paramers and an exporting parameter res for the method.
    Note: you can either create a class either globally or locally..
    Goto SE24 to create Global class, this class will be avaialable for use in all the programs, this is like class library with all global classes.
    Local class is the one which you create in SE38 i.e; your own program,
    by this it is understood that it's scope is only upto that program
    SO let us discuss the example with SE24(global class)
    give a class name, description,
    In the attributes tab, define a and b of type i, level as instance attribute and
    visibility as public That means these attributes are available outside this class also. we will come to this later.
    in the methods tab give name, level as instance, visibilty as pubilc again.
    now double click on the method name, it will take to you to write the code.
    (method implementation)
    just wirte between the method ---endmethod,
    res = num1 + num2.
    come back to methods tab, click on parameters button, to define exporting, importing etc.. paramters for your method,
    define 'res' as an exporting parameter, 2 variables num1 and num2 as importing parameters.Activate the class.
    now you have defined a class.
    whenever you want the logic to sum 2 variables, in all those cases you can make use of the SUM method in this class. This is what Reusability is.A very imp. feature of OO ABAP.
    So now comes Instantiation.
    you can't directly access a class.
    You have to create a reference variable of the type of the class, then create an object with the reference variable. (memory allocation).
    This step is called Instantiation or Instantiating the class
    For this go to se38, in which ever program you want to instatantiate the above class.
    do as below.
    data: obj type ref to zsow_cl1.
    start-of-selection.
    create object obj.
    Now object of the above class is ready for you.
    Now all the contents i.e either attributes or methods etc of the class can be accessed with this object
    now you have to call the method 'sum' of the above class using the above object in your program for the sum functionalty.
    for that click on Pattern button select 'Abap Object Patterns' press enter
    select 'Call method' radio button, give your object name ('OBJ')
    class name  ( ZSOW_CL1)
    give the method name (SUM)
    class and method names can be selected from the F4
    press enter.
    you will get the below line in your program
    CALL METHOD OBJ->SUM
      EXPORTING
        NUM1   =
        NUM2   =
    *  IMPORTING
    *    RES    =
    now define 2 variables of type i to pass the inputs to the method and one more vairable to hold the output coming from the FM
    on the whole code in your se38 is as follows.
    DATA: OBJ TYPE REF TO ZSOW_CL1,
          X TYPE I,
          Y TYPE I,
          Z TYPE I.
    START-OF-SELECTION.
      CREATE OBJECT OBJ.
      X = 10.
      Y = 10.
      CALL METHOD OBJ->SUM
        EXPORTING
          NUM1 = X
          NUM2 = Y
        IMPORTING
          RES  = Z.
      WRITE: Z.
    so Z will give the output.
    Next is Encapsulation
    while defining the method i asked you to give the visibility as Public.
    Visibility can be of 3 types:
                  Public
                  Protected
                  Private
    public means as i said above the method or varaibles can be used outside the class also.as you did above outside the class you have created an object to the class and
    accessed the method.
    private means the attributes/methods that you define in the class can only be accessed in/by the method of the same class, they cannot be accessed anywhere else and outside.
    change your 'a' parameter visibilty to private and try the below code in se38.
    obj->b = 10.
    obj->a = 10.
    1st line doesn't give error, since 'b' is public attribte,
    2nd line will give error since 'a' is now private.
    you can use 'a' in the 'SUM' method if you want.
    Protected means it can't be accessed outside of the class like with the help of object, but can be accessed in  the child class if defined to the above class.
    just post if you have any other doubts after trying this example.
    Do reward points if it helps you.
    Regards,
    Sowjanya

  • Where can i find BP "Portal User" and "Communication"??

    Hello,
    I have imported Business Package for mySAP CRM 4.0 (60.2) on EP 6.0 according to the installation guide and now i have started with the "Administration of the Business Package for SAP CRM 4.0 60.2" and in there it says that as a pre-requisite i must have imported "Portal User" and "Communication" business packages. I tried to search for these in SDN but no luck. Where else can i find these business packages? Thanks.
    Regards,

    Hi,
    as far as I know both BPs have been discontinued.
    The pure CRM 4.0 functionality is not comprised by the missing packages.
    Some features of the "Home" tab may not work properly...
    Hth,
    Michael

  • Do I need and how to secure the Unix/Linux agents authentication and communication to RMS?

    Hi everybody
    We have an environment including SCOM 2012 SP1, 10 windows server, 40 linux servers and 10 HP-UX servers. all of them are joined a trusted domain. I know the authentication method between windows agents and management server is kerberos. but not for linux and
    HP-UX servers.
    Now I want to secure the Unix/Linux agents authentication and communication to RMS. some questions:
    1- how much secure and credible is current authentication method? and in a high secure environment can I trust SCOM self signed Certificates?
    2- Considering this point that Unix/linux computers are joined to active directory domain and are using Kerberos to authenticate, can I use this
    authentication method between RMS and linux Agents? 
    3- if I make a decision to use certificates should I use gateway server? (considering all servers and RMS are in same trusted domain)
    any other suggestion?
    Thanks in advance

    nothing?

  • How to remove field in Change Office and Communication Data..

    Hi,
    In ESS->Emp Search -->Change office and communication Data..I have to remove a field "License Plate No" as we are not using it..
    How to do it..
    I have Netweaver studio installed in my pc but i dont know how to use it..
    could any one tell me the steps to do the above task in Netweaver Studio..or there is any other method that can be done..
    It would be great help for me..
    Thanks & Regards,
    Mahesh.M.R

    Hi ,
    I dont know why no one is replying to this question..
    Eagerly waiting for your valuable suggestions..
    Thanks & Regards,
    Mahesh.M.R

  • Unable to convert PSE11 catalogs to PSE13 Organizer. Windows 7 PC. 64 bit. Have tried all suggested solutions on forum and community. Other ideas?

    Windows 7 PC. 64 bit. Have tried all suggested solutions on forum and community. Other ideas?
    Conversion Log ends with "flattening 3gpp files, removing j2k files...An error was encountered in the sqlite database: unable to open database file
    conversion log: Conversion Failed.

    Log says “unable to convert SQLite db” and then “Conversion failed”. This is before it does anything with specific images.  The line right before the above is “gpp files flattened . . .” which I believe are sound files
    : Cheri Mason
    Unable to convert PSE11 catalogs to PSE13 Organizer. Windows 7 PC. 64 bit. Have tried all suggested solutions on forum and community. Other ideas?
    created by nealeh in Photoshop Elements - View the full discussion 
    What does the log file say? - Photoshop Elements catalog conversion failure.
    Cheers,
    Neale
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6850794#6850794
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
    To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Photoshop Elements by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • Add email from main address and communication to search result

    Hi everybody,
    I am currently trying to add the main address and communication email address from the contact person to the contact search result.
    What I've tried so far is enhancing the BP_CONT_SEARCH/SearchResult view and adding attributes to the context node Result.
    I added model attribute BuilContactPerson/BuilContactPersonStandardAddressRel/E_MAILSMT but that did not display the correct one.
    Also added BuilContactPerson/BuilGetHeaderforContactRel/BuilStandardAddressRel/E_MAILSMT but there nothing gets displayed.
    Anyone who knows how to get the email in the search results?
    Best regards
    Tom

    Solved it myself. The relation was wrong.
    it should have been
    BuilContactPerson/BuilGetPersonforContactRel/BuilStandardAddressRel/E_MAILSMT

  • Safari and community toolbar

    Why do I get the "We're sorry but the Safari browser version you are currently using does not support the community toolbar"? It pops up every time I open Safari. I have installed Lion but it is still there?

    That toolbar/ct plugin seems to cause problems for all who install it!
    If you are running Tiger or Leopard:
    Close Safari, then locate and delete the following files and it should be gone:
    /Library/Application Support/Conduit
    /Library/InputManagers/CTLoader
    /Library/Receipts/ctloader.pkg
    /Library/Receipts/<Toolbar name>.pkg
    /Library/Application Support/SIMBL/Plugins/CT2285220.bundle
    /Users/<User name>/Library/Application Support/Conduit
    where / is the root library on your Hard Disk.
    If you are running Snow Leopard you should also look here:
    Library/launchAgents/com.conduit.loader.agent.plist
    Library/Application support/conduit plugins
    Also, as mentioned by Gilli2000:
    Library/Receipts - If you read it, it has information in it at the bottom referring extensively to "CT" and "community toolbar".
    Maybe it is harmless, but trash those items anyway!
    If you are running Lion:
    From the Finder Menu bar, select Go ▹ Go to Folder, and in the box that opens write:
    ~/Library/Application Support/Conduit
    Delete the second item if it is there.
    Now select Go to Folder again and enter  /Library
    From the folder that opens, delete the following items if they are there (you may need your login password):
    Application Support/Conduit
    InputManagers/CTLoader
    LaunchAgents/com.conduit.loader.agent.plist
    ScriptingAdditions/ct_scripting.osax
    then close the folder. Now select Go to Folder again and write: /Applications/Toolbars
    Delete that item and close the Finder windows you opened. Log out then log back in, and you should be rid of it.
    Note: Safari does not support any third-party toolbars except those supplied as an extension to Safari via the Extension Gallery.

  • What kind of classes can be instantiated and how it can be done?

    Dear All,
    What kind of classes can be instantiated and how it can be done?
    Can you please explain me in brief and provide sample code for it?
    Thanks,
    Anup Garg

    Hi Anup,
    You can create instances of a Final class...its just that you cannot override its behaviour...
    btw...If you are coding the whole class, you can define a class as Final as below
    CLASS CLASS_NAME DEFINITION FINAL
    ENDCLASS
    Else, if you use the class builder (SE24), you just need to check the Final checkbox available in the Properties section of the class.
    ~ Piyush Patil

Maybe you are looking for

  • Error -200452 depends on channel order

    LV 2010, NI-DAQ 9.2.2, Win Vista, cDAQ 9172 chassis, NI-9211, NI-9219. My client has the same issue with LV 8.6.1, NI-DAQ 9.1.5, Win XP, same hardware. I am getting an error -200452 (Property not applicable) in a case where I don't understand why. I'

  • Looking for honest feedback from you the experts

    Hi,     I was hoping for some feedback of the below video. I have put together a couple very simple family birthday videos but this is my first attempt of a more professional video. This is a documentary of the Syracuse Youth Orchestra 2014/2015 seas

  • Total time for a netstream object?

    I'm making a video player, and I'm having trouble making a seek bar. There is the "time" property of the netstream, but there doesn't seem to be a way to find the total length of the video in seconds, making it difficult to find the fraction of the v

  • Problem with iPhone 3G 3.1.2 flight mode

    Hello together, since i updated to 3.1.2, i have a problem with the flight mode. I have a very old stereo in my bedroom (70s ghettoblaster with the iPod universal dock to listen to some music while falling asleep. Up to now, i just switched to the fl

  • Raw files to iPad

    Need to transfer raw files to ipad. How?!