Does a member class have to be within the same source file?

Hi there,
I have this application that extensively uses two classes. The main class setsup the GUI, and the second main class is responsible for handling all of the actions that arise from the GUI.
I could have done this by making all of my handler methods be of the first main class, but this class really is just for the GUI setup, the logic doesn't fit into this class' behaviour.
The class that handles the GUI actions is required to use the fields of the main class e.g. to get values of a text field. The problem is that since the class that handles the actions is getting very big, I would kind of like to move this class into a different source file - because currently it is a member class of the first one, so that it can access all of its fields.
Is there some way that I can move this handler class into another source file, and still have it access all of the fields of the main GUI class - without making the fields public, or using millions of get/set methods? Also, I can't use inheritance because the both the GUI class creates an instance of the handler class in its constructor, and so leads to an infinite loop when trying to instantiate the GUI class.
Can I ask.. would a static class or something be of use here? Do they exist? I'm confused as to how to do this without getting the mother of all source files (in size that is - nothing to do with cooking or baking).
- Anyway, thanks in advance for any help that you could give me -
BYEE, Edd.

You can't have an inner class that is not in the same source file. However, you could use package-protected (default) access to give another class in the same package access to things without making them public. Actually, that's how inner classes are actually compiled. Package-protected access is underused IMHO. It's a great tool that most people (including myself) are suspicious of at first.

Similar Messages

  • Multiple classes in the same source file

    I'm not sure what this is called, having multiple classes in the same source file. At first I thought it ws called subclassing but then I googled it and found that subclasses are just derived classes. Here's an example of what I'm talking about.
    public class A {
    class B {
    class C {
    }So first of all, what is having multiple classes in the same source file called?
    Secondly, what are the advantages/disadvantages of this?
    Thirdly, can you have a class completely WITHIN a class (same source file but inside the class not outside) and what are the advantages/disadvantages of this?

    Advantage: You can reduce the number of source files specialy when your secondry classes are used only in the public class of the file.
    Disadvantage: Normaly it make things more clear if we have one-to-one correspondance of class and source files. This make things easy when you want to find the java file of a perticuler class file. Also If you later wanted to create a seperate public class with a same name as one of those secondry classes you got lots of changes to do.
    You can avoid this by creating them as nested classes
    ex:-
    public class MyPublicClass{
       private static class MyInnerClass{
    }this way the inner class will create a class file with name "MyPublicClass$MyInnerClass.class" instead of just "MyInnerClass.class"
    And also if you declare the inner class as public you can access them from out side

  • How to duplicate a sequence in Premiere Pro CS3 within the same project file ?

    Hi there,
    How do I duplicate a sequence in Premiere Pro CS3 within the same project file ?
    Thanks

    If you are new to Premiere CC start here:
    https://helpx.adobe.com/creative-cloud/learn/tutorials/premiere.html#get-started

  • I have been working on the same numbers file for the past few weeks.  The last time I opened it was 1 week ago.  Today when I tried to open it I am unable and getting a message that the file is invalid and the index.xml file is missing.

    I have been working on the same numbers file for the past few weeks.  The last time I opened it was 1 week ago.  Today when I tried to open it I am unable and getting a message that the file is invalid and the index.xml file is missing. 

    Hi Tracie,
    I upgraded to Maverick OS X 10.9.5, numbers spreadsheet is saved. Upon re-opening, it appears to be frozen, a warning "file is invalid as index.xml file is missing". I checked, and the file is not "locked". This appears to occur only with using the new numbers app. When I open previous spreadsheets from old iWorks, no such problem occurs.
    How did you resolve your problem?
    Would appreciate any help here.
    Thanks,
    Deehay

  • IPad2... after synch with my Mac, I now have numerous duplicates of the same PDF files in Books.  Can't select them to delete them.  Can't move them.  Any suggestions?

    iPad2... after synch with my Mac, I now have numerous duplicates of the same PDF files in Books.  Can't select them to delete them.  Can't move them.  Any suggestions?
    <Email Edited by Host>

    Hi sdfulbright,
    Open iTunes, and under View, select "Show Sidebar". The old sidebar you are used to will show up, and everything will work the way it did under the old iTunes.
    Hope this helps!
    Cheers,
    GB

  • How to have two actions in the same ResourceAction file?

    I have 2 Domino Gateway actiontypes in 1 ResourceAction file. When I import this into IDM, the 2nd action always gets truncated. Can I name each actiontype to differenttiate them to IDM?

    You can create a 2nd profile with: firefox -ProfileManager (you have to close all firefox instances to do that)
    Then, you can start a 2nd firefox with the new profile: firefox -P <profilename> -no-remote

  • I subscribed to iTunes Match and would like to sync my music on multiples devices that have different Apple IDs within the same iCloud family.

    I subscribed to iTunes Match and would like to sync my music on multiples devices that have different Apple IDs within the same iCloud family.
    Can someone indicate the way to proceed?
    Thanks.

    Hi,
    You can't use family sharing or multiple Apple IDs with iTunes match.
    ITunes match is only attached to Apple id that you used to subscribe.
    Jim

  • How can I POST data within the same page if I have a A HREF -tag as input?

    How can I POST data within the same page if I have a <A HREF>-tag as input? I want the user to click on a line of text (from a database) and then some data should be posted.

    you can use like this or call javascript fuction and submit the form
    <form method=post action="/mypage">
    cnmsdesign.doc     
    </form>

  • Is there any way of exporting a clip (example 1 hour) into 4 seperate 15 min clips at the same time? Or does anyone have any ideas along the same lines to save time? Add my skype baconhousevidz if you can help or are unsure of what im asking

    Is there any way of exporting a clip (example 1 hour) into 4 seperate 15 min clips at the same time? Or does anyone have any ideas along the same lines to save time? Add my skype baconhousevidz if you can help or are unsure of what im asking
    thanks everyone

    BaconHouseVidz wrote:
    … at the same time…
    in hope to speed things up?
    no, no effect.

  • I bought an iphone 5 about 4 months ago and got applecare. yesterday I had to get on a different plan within the same company so i traded in my phone and got a new iphone 5. can i transfer my applecare to this new phone or would I have to buy it again?

    I bought a 16gb iphone 5 about 3 months ago and got applecare. yesterday I had to get on a different plan within the same company so i traded in my phone and got a new 32gb iphone 5. can i transfer my applecare to this new phone or would I have to buy it again?

    As this is a WW forum with different AppleCrare offerings you need to specify which Country
    as in North America has AppleCare+ and everywhere else AppleCare ,very different products
    So to avoid incorrect guidance suggest you specify Country

  • WHY does the finder insist on rearranging the files in a folder in alphabetical order even when I have selected "none" in the preferences for file organization?

    WHY does the finder insist on rearranging the files and/or documents in a folder in alphabetical order even when I have selected "none" in the preferences for file organization? Even after I numbered the documents/folders to keep them in my preferred order, it will still displace them occasionally. This is becoming increasingly frustrating!
    Is this a "Pages" issue or "FInder"? The vast majority of documents I use are in Pages, but there are also Numbers, PDFs, jpegs and a few other applications involved. This never happened before I upgraded to Mountain Lion; in Tiger, the documents (mostly Appleworks) and files stayed where I wanted them to be.
    I am visually oriented, and prefer to arrange items in a folder in an order that makes them easier for me to access, which is often NOT alphabetical.
    Can anyone suggest a solution? Please??
    Thank you.
    Sara

    nbar,
    Thank you for your reply.
    However, I do not understand what you mean by "user account." I am the only user, and can find no options for "user" or "guest." The parental controls have always been off, as there are no other people who have access to my computer.
    Frank,
    Thank you for your reply.
    All my documents, files and folders are in icon view, Arranged By: none in both view and view options. This arbitrary rearranging does not happen all the time, only when I make a substantial change to one of the documents in the file or folder. I'm not sure what you mean by "column heading."
    MichaelLAX,
    Thank you for your reply.
    I know, to my sorrow, that Appleworks does not work with Mountain Lion. I spent at least three months converting approximately 2,000 Appleworks documents to Pages, Numbers, Bento (for databases) and Touchdraw (for drawings). So this is not the problem; but as I said, I did not have this rearranging problem with Appleworks - the icons stayed where I wanted them to be. I still miss the ease and reliability of Appleworks, darn it!
    Frank,
    Thank you for your second reply.
    I do have the Sort By: in view options as well as in view set to "none."   The finder still insists on rearranging, but only when I have made a substantial change to a document in that file or folder.
    Any futher thoughts?
    xdab, 
    Thank you for your reply.
    "Are you are using icon view, but for some reason the finder moves files around? is that the problem?"
    YES!! This is exactly the problem.
    "If this operation is successful then erase the original and rename the new one to the name originally chosen by the user."
    This seems like a lot of trouble, especially as I often work on several documents at the same time.
    "By the way, the finder has a "clean up by" menu that rearranges icons in one of the standard orders, there are shortcuts that produce the same effect, for example <option><cmd>1 sorts them by name. Is it possible that this shortcut was typed by mistake without you noticing?"
    I do know about this "clean up by" option, and avoid it like the plague! So I doubt this is the issue, and I infrequently use keyboard shortcuts like this anyway.
    Thanks all who replied. None of the suggestions seem to work, however. Any others out there?
    Regards,
    Sara

  • Can I use multiple p class="logos" tag with the same name within the same html page?

    I was told not to use <div class> tags too many times. I was using them for text, images, to clear floats, I basically built my website using multiple <div class> tags. So if I can't use multiple <div class> tags could I use <p class> tags multiple times in the same html page?
    I have a string of logos at the bottom of my webpage which will all be using the same css characteristics for all logos. Would this be the proper way to write the code:
    HTML
    <p class="logos">Logo1<a href="...></a></p>
    <p class="logos">Logo2<a href="...></a></p>
    <p class="logos">Logo3<a href="...></a></p>
    <p class="logos">Logo4<a href="...></a></p>
    <p class="logos">Logo5<a href="...></a></p>
    <p class="logos">Logo6<a href="...></a></p>
    CSS
    .logos {
    margin-left:10px;
    Here's my website: http://www.darbymanufacturing.com/test_website/index.html - this is the website built with all div class tags
    I restarted the website in order to write the code properly so that I don't come to errors when uploading on the server like I am having with the website link above.

    Instead of writing something like this -
    <p class="logos">Logo1<a href="...></a></p>
    <p class="logos">Logo2<a href="...></a></p>
    <p class="logos">Logo3<a href="...></a></p>
    <p class="logos">Logo4<a href="...></a></p>
    <p class="logos">Logo5<a href="...></a></p>
    <p class="logos">Logo6<a href="...></a></p>
    Why not have something like this -
    <div id="logodiv">
    <p>Logo1<a href="...></a></p>
    <p>Logo2<a href="...></a></p>
    <p>Logo3<a href="...></a></p>
    <p>Logo4<a href="...></a></p>
    <p>Logo5<a href="...></a></p>
    <p>Logo6<a href="...></a></p>
    </div>
    with CSS like this -
    #logodiv p { ... }

  • ITunes randomly stops playing purchases that have previously viewed on the same hardware. It has an error message about HD. How can this issue be resolved?  What information is available besides the "learn more" option that does not deal with the problem?

    iTunes randomly stops playing purchases that have previously viewed on the same hardware. It has an error message about HD. How can this issue be resolved?  What information is available besides the "learn more" option that does not deal with the problem?
    Many people have the same problem. However, there is little or nothing readily available to users. This problem has existed for two or more years. Does anyone have anything to offer about this disturbing problem?

    Thanks for the suggestion kcell. I've tried both versions
    9.0.115 and 9.0.124 and both fail with the policy permission error.
    I also tried with and without your crossdomain.xml file but
    with the same result. It looks like this file is intended for URL
    policy, instead of socket policy. Recently Adobe separated the two.
    When I run with the files installed on my dev PC, it does
    work, which makes sense because the flash player isn't loaded from
    an unknown domain.
    I did get one step closer. If a crossdomain.xml in the server
    root exists and the socketpolicy file is loaded from the app folder
    then the first two warnings disappear. The logs now show:
    OK: Root-level SWF loaded:
    https://192.168.2.5/trunk/myapp.swf
    OK: Policy file accepted: https://192.168.2.5/crossdomain.xml
    OK: Policy file accepted:
    https://192.168.2.5/trunk/socketpolicy.xml
    Warning: Timeout on xmlsocket://192.168.2.5:843 (at 3
    seconds) while waiting for socket policy file. This should not
    cause any problems, but see
    http://www.adobe.com/go/strict_policy_files
    for an explanation.
    Warning: [strict] Ignoring policy file with incorrect syntax:
    xmlsocket://192.168.2.5:993
    Error: Request for resource at xmlsocket://192.168.2.5:993 by
    requestor from https://192.168.2.5/trunk/myapp.swf is denied due to
    lack of policy file permissions.
    Which basically says, everything is okay, but you stay out
    anyway.
    PS: I found the XML schema files here:
    http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security_02.html
    and the socket policy schema:
    http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd.
    UPDATE: When serving up the policy file on port 843 using the
    example perl script then the socket connection seems to be accepted
    and the connect succeeds. After that flex hangs trying to logon to
    the IMAP server.

  • HT1695 Wi-Fi to your iPhone does not work with the knowledge that I have worked Restart for the same purpose network does not work What is the solution please help as soon as

    Wi-Fi to your iPhone does not work with the knowledge that I have worked Restart for the same purpose network does not work What is the solution please help as soon as

    Okay, the Wi-Fi doesn't work.  Turn it on.
    Beyond that, we cannot offer any other assistance as you've failed to provide useful details of the problem.
    When responding, post in your native language as your English makes very little sense.

  • HT3371 My Macbook Pro does,nt seem to have any life in the battery does it need a new one

    My Macbook Pro does,nt seem to have any life in the battery does it need a new one

    You can check the actual capcity by opening the "System Information" application in the folder "/Applications/Utilities".
    Then you can select the information section "Hardware > Power" to see the information regarding the battery:
    The important information is highlighted in the image above.  The ratio of Charge Remaining (when fully charged) to Full Charge Capacity is a good metric of how "healthy" the battery is.  The Number if cycles is another indicator.  The higher the number of cycles the lower I would expect the ratio of Charge Remaining (when fully charged) to Full Charge Capacity.

Maybe you are looking for

  • Apple ID / Family Sharing for Kids: Change Requests

    My 12 year old has been given an iPhone and I wanted to include him into our Family Sharing. I stumbled over a number of Problems that are a bit disappointing for an Apple user: 1. Asfar as I understand: As he reaches 13, the restriction that the par

  • PowerPoint Makes File Read-only After Saving

    Hello all, A couple of end users have encountered the above problem. They make changes to pptx files and after the file saves, the file becomes read only (says so on the program window). If they are not paying attention, then any other changes they m

  • Home Hub 3 A.. BT's best ever home hub?

    Hi, I signed up for Infinity 2 (coming from sky) on the 31st May.  I timed it just before the line rental increase (yay) but also just before the home hub 4 was being supplied by default to new customers (doh).   On sign up BT clearly advertised they

  • Edi partner profile is not found!!!!

    Hi I have created an info package in development and i have transported to quality. And trying to load the data from flat file. And i have simulated it and it works fine. but after loading the data in the monitor it is still yellow. And i got the mes

  • How to send a link to a phone for downloading

    Sorry for the obvious noob question, but I've been plaing with win32 forthe last 2 years. I have a basic jar and jad that work on the emulator, but my phone still doesnt have an easy drive type file upload system. I can put the jad and jar in a web d