Confusion about how object interact and are aware of each other

I have this java applet
Two of the classes it contains are the main class with the init method and a UI class that is code for the interface.
the main class instantiates the UI class anonymously (i think you call it that) i.e it does not put it into a named reference it just creates it by calling new without assigning it to anything.
When I click on a button from the UI class I want to call a method in the main class...but how so?
At first I tried to make the function i want to call in the main class static so I could easily call it from the UI class...but then it began to get complex...so i just sent a reference of the main class to the UI class via its constructer.
Now i want the main class to update a JTable in the UI class, but how? It does not have any reference to the UI class.
What is really the standard method of operation for this sort of thing when objects have to be calling methods of each other. How do I make them aware of each other.

the best way to do it is like this:
public class Main {
  //this is the main class
  private static class MyUIFrame extends JFrame {
    //create the class. It is useable within Main this way
    //static means it doesn't implicitly 'know' about the Main class. You can also
    //remove this and call Main.this to use Main's methods
}Edited by: tjacobs01 on Apr 11, 2009 2:28 AM

Similar Messages

  • I've got a G5, OS 10.5, and an IBook OS 10.4.  Both can reach the internet wirelesly.  How can I make them aware of each other, so they can exchange files

    I've got a G5, OS 10.5, and an IBook OS 10.4.  Both can reach the internet wirelesly. 
    How can I make them aware of each other, so they can exchange files?  Both have network
    icons in the systems peferences, but I can't see how to hook them up.

    That got me closer, but I'm not quite there yet.  On each ofthe two computers I've allowed all users File Sharing and Remote Management.  Each computer has an address 192.168.1.2 (or 4).  When I enter those addresses into "connect to server" the reponse is either 'drop box' or 'public folder'.  So it seems that only very basic sharing is allowed. I have'nt  set up a public folder on either one.

  • I have a document made up of separate PDF files which reside in a folder and are linked to each other via hyperlinks. Each pdf file is set to open with bookmarks displayed, however if I link from one PDF file to another and use the "Previous View" button

    I have a document made up of separate PDF files which reside in a folder and are linked to each other via hyperlinks. Each pdf file is set to open with bookmarks displayed, however if I link from one PDF file to another and use the "Previous View" button to navigate back to my starting point the bookmarks are replaced by "page thumbnails". Is there anyway to stop this from happening?

    Hi Pusman,
    While setting up the links, if you choose to open the file in a new window then you won't face this issue, then you can simply switch to the previous file and bookmark view will remain as it is.
    Does that helps with your query?
    Regards,
    Rahul

  • How do iPhoto and iTunes work with each other

    I am very confused about how iPhoto (which is located in the file structure on my Macair under pictures) interacts with iTunes and Photos on my iPad.  The management (including synching and moving photos) is not very intuitive.  Anyone care to shoot me a link on where to find a good explanation or try their hand at explain this?  Thanks.

    Instructions here >  iTunes: How to share music between different accounts on a single computer
    And here >  iPhoto: Sharing libraries among multiple users

  • Both my macbook and iphone say they are aware of each other, but they won't connect.  Help!!

    Both my macbook and iphone say they are paired but they won't connect???  Help???

    Bluetooth Texter is not compatible with the iPhone:
    http://www.happymakinggames.com/downloads/BluetoothTexter/faq.php#iphone

  • Confused about passing by reference and passing by valule

    Hi,
    I am confuse about passing by reference and passing by value. I though objects are always passed by reference. But I find out that its true for java.sql.PreparedStatement but not for java.lang.String. How come when both are objects?
    Thanks

    Hi,
    I am confuse about passing by reference and passing
    by value. I though objects are always passed by
    reference. But I find out that its true for
    java.sql.PreparedStatement but not for
    java.lang.String. How come when both are objects?
    ThanksPass by value implies that the actual parameter is copied and that copy is used as the formal parameter (that is, the method is operating on a copy of what was passed in)
    Pass by reference means that the actual parameter is the formal parameter (that is, the method is operating on the thing which is passed in).
    In Java, you never, ever deal with objects - only references to objects. And Java always, always makes a copy of the actual parameter and uses that as the formal parameter, so Java is always, always pass by value using the standard definition of the term. However, since manipulating an object's state via any reference that refers to that object produces the same effect, changes to the object's state via the copied reference are visible to the calling code, which is what leads some folk to think of java as passing objects by reference, even though a) java doesn't pass objects at all and b) java doesn't do pass by reference. It passes object references by value.
    I've no idea what you're talking about wrt PreparedStatement, but String is immutable, so you can't change its state at all, so maybe that's what's tripping you up?
    Good Luck
    Lee
    PS: I will venture a guess that this is the 3rd reply. Let's see...
    Ok, second. Close enough.
    Yeah, good on yer mlk, At least I beat Jos.
    Message was edited by:
    tsith

  • How the tables are  linked to each other in ERP and CRM?

    Dear All,
    Can anyone provide the info for the below query ?
    "How the tables are  linked to each other in ERP and CRM"
    Quick response is highly appreciated.
    Best Regards
    Succhi

    Dear Buijink      ,
    Thanks for the info.
    Here in this table SMOFTABLES , it is  giving the CRM adopter objects with R/3 tables . But my requirement is  more on corresponding CRM Tables , the data fetching from R/3 tables will store in which CRM tables.To be clear the adopter objects extract the data from different R/3 tables but stores in to which tables?
    Thanks in advance
    Best Regards
    Succhi

  • HT204053 Our family uses one Apple ID for all of our iPhones.  We installed the update and now we are all getting each others photos and texts.  How do we stop this?

    Our family uses one Apple ID for all of our iPhone 5's.  We installed the update and now we are all receiving each other's pictures and texts.  How do we stop this? 

    Have a look here...
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l

  • I have two apple id's because my hotmail account is no longer active. How can I delete the old one and use or update the new one?  Every time I try it won't allow me and now my iPad thinks there are two accounts and they are arguing with each other. Help!

    I have two apple id's because my hotmail account is no longer active. How can I delete the old one and use or update the new one?  Every time I try it won't allow me and now my iPad thinks there are two accounts and they are arguing with each other. Help!

    You can't merge accounts or copy content to a different account, so anything that you bought or downloaded via the old account is tied to that account - so any updates that those apps get you will only be able to download via that account. You can change which account is logged in on the iPad via Settings > Store

  • Updated IOS 8 to mine and my sons phone and we share an Apple ID but we are now getting each others pictures how do I fix that?

    I Updated my iPhone 5s and my sons iphone 5 to the IOS8 and after we did that we started getting each others text messages which I thjnk I fixed but we are still getting each others pictures, I want to keep him on my Apple ID I just don't want to share pictures and text messages. before the update we didn't have this issue but now we do please help fix this situation!

    Hello cmdenham97
    The question I have is how are using your Apple ID on both of the iPhones. If it is just for purchases, then you can just have that Apple ID for purchases and then have separate accounts for iCloud to sync that data. Check out the article below for more information.
    Using your Apple ID for Apple services
    http://support.apple.com/kb/HT4895
    Regards,
    -Norm G.

  • Confused about how to display a rectangle on JFrame

    i'm a little confused about how to display a rectangle on a jframe.
    I know there is a class called Rectangle. is there a way to use it to display a rectangle on a JFrame? i couldn't find a way to do that.
    i found a way to display a rectangle in the internet:
    CODE:
    public class RectangleFrame extends JFrame {
        public RectangleFrame() {
            super("My Rectangle");
            setSize(300,400);
            setLocation(300,300);
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            JButton button = new JButton("Button");
            JPanel panel = new JPanel();
            panel.add(button);
            getContentPane().setLayout(new BorderLayout());
            getContentPane().add(new Rect(), BorderLayout.CENTER);
            getContentPane().add(panel, BorderLayout.SOUTH);       
            setVisible(true);
        public static void main(String[] args) {
            new RectangleFrame();
    public class Rect extends JComponent {
        public void paint(Graphics g) {
            g.drawRect(50,50,200,200);
    }is this the only way to do that? isn't there an easier way? do i have to write this new class Rect i wrote?
    i don't really know how this Rect class i wrote works. could someone explain?
    then another question: can i put a rectangle on a JPanel or do i have to add it directly onto the ContentPane as i did above?
    i hope everything i asked is clear enough.
    thanks for your effort.

    Take a look at the 2D graphics tutorial:
    http://java.sun.com/docs/books/tutorial/2d/index.html

  • How to sync 2 different Mac users using the same Apple ID and with out mixing each other info?

    How to sync 2 different Mac users using the same Apple ID and with out mixing each other info?
    We are two people using three difrent Macs, 1 Iphone and 1 Ipad with separate USERS  on each Mac but sharing the same Apple ID: xxxxxx
    I set up the first user to iCloud and it was OK but when I set up the second user to use iCoud the first users's info gets mixed with the second user's info?
    Do we have to set up a diffrent Apple ID for each other?
    Sometime ago I added my friends E mail (yyyyy) to the main Apple ID (xxxx) as for using his E mail account (to separate our e mail accounts, and it's working ok) but now when I try to create a new apple ID whith the same friend's e mail (yyyyyy)  it says that his mail (yyyyy) is already an apple ID when the Apple ID is really my E mail (xxxxx)... any clue?
    Thanks

    I believe because you migrated from a Nokia to an iPhone you need to register the Bn phone number with your Apple ID so it can be used for iMessage. The Pn number seems to be the only one registered
    Go here > https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/
    Manage your Apple ID and see if that does the trick
    Hope that helps

  • How can I rasterize a spot color file without creating "border" pixels between areas that are adjacent to each other but should not be overlapping?

    We use Illustrator to create circuit layouts. For part of our process, we create an image of all of the layers using spot colors to show the printed layers overlapping each other. We then rasterize the file and send the image through a Matlab routine that performs some analysis of the circuits based on the colors of the pixels.
    In some cases, I have created images with areas next to each other, but not overlapping. When rasterizing the image, the rasterizing process appears to treat the borders as overlapping and creates a single pixel wide border between the 2 areas when there is none. This is playing havoc with our Matlab routine.
    I can manually go in and remove the rasterized border, however on some projects, this is a very lengthy process. Has anyone experienced anything like this, or have any ideas on how to prevent this?

    Would align to pixel grid help?
    Left is not aligned, Right is aligned to pixel grid

  • Why are Adobe Premiere Pro CS6 source and program monitors playing each others footage?

    Why are Adobe Premiere Pro CS6 source and program monitors playing each others footage? I import my footage into the project like normal. I drag it to the source monitor on the left hand side to set in and out points then I drag it to the time line. The footage drops into the time line with no problem but when I go to play the footage in the time line it plays back on the source monitor and not on the program monitor like it is suppose to. Other times ill drag the clip to the time line and trim it there and it will be fine and show up on the program monitor.  Then ill go try to set a clip to have in and out points (which is suppose to show up in the source monitor) but it shows up in the program monitor. The clip is not even in the time line it should not be on that monitor! I have updated the program to the late update. I have re installed the program numerous times and I have even ran the Adobe Clean up program. Couldn't find much on this problem. Please help thank you! I have a PC. My computer is also way over the recommended minimum specifications to have the program installed on.

    Definitive Answer (I believe): It's all about this setting, "Write XMP ID To Files On Import" - which confirms that Adobe Premiere Pro is deliberately modifying the .mov file: http://helpx.adobe.com/premiere-pro/using/preferences.html#WSE3BD4A43-7022-4fe6-97F5-95313 935347B
    These posts give some background as to why having this setting enabled would be beneficial: one benefit being to be able to skip conforming files by matching the conformed file with the original using the embedded XMP tag :-
    http://helpx.adobe.com/premiere-pro/using/preferences.html#WSE3BD4A43-7022-4fe6-97F5-95313 935347B
    http://www.dvinfo.net/forum/adobe-creative-suite/498627-why-premiere-modifying-video-files .html
    https://forums.creativecow.net/thread/205/876064
    (Found using Google search term "adobe premiere pro date modified")

  • How can i get my items to stay in place and not cross over each other when readjusting the browser s

    How can i get my items to stay in place and not cross over each other when readjusting the browser size.
    Basically on my site when i go from a small screen to a big screen everything doesn't adjust to the screen size. I don't know what im missing
    Here's the link to the page all the pages & they all do it
    http://theatricalworkslive.com/
    Thanks in advance

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, or by a peripheral device. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem.  Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Post for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

Maybe you are looking for

  • Factors influencing creation of a planned order

    Hi,         What are the factors that lead to creation of  a planned order during a Heuristic run? When does a system decides to create a planned order? at what stock level? and how is the planned order qty. decided? I have a material in a location t

  • How to send a pdf/tiff file to spool

    Hi all, can anyone tell me how to send a pdf file to spool.  There will be forms attached to activity(the forms can be pdf/tiff format). Thank You, Vichu

  • Will any Macbook Pro 13" hard case fit my regular Macbook that is aluminum also?

    I am trying to find a hard case that fits my aluminum 13" macbook. It is not a pro and Apple doesn't make them anymore. Will the Macbook pro 13" fit my Macbook 13"

  • VRAM Difference?

    Hi, Could some one who has an Intel imac 20" with 256MB VRAM help me out here? When I run the hardware test from imac CD it says 128 MB VRAM installed and in "About this Mac" box it states 256 MB ( as I ordered). It is quite strange. So if one of you

  • What would happen if remove containers in UPS connection

    We are using SP2013 on-premise. Currently our farm have setup UPS connection to entire domain. Hence, some non-users account like other system's service accounts have been sync and user profiles have been generated. I think it is not a good security