Getting my head around DocumentListener and how inner classes work

So I'm trying to get my first Swing GUI up and running and I cannot get my head around the DocumentListener.
I have a JTextArea element called textArea which has the following code for it's listener:
public class Gui extends JFrame {
    public Gui() {
        // Add the Text area
        JTextArea textArea = new JTextArea(textDoc);
        add(scrollPane, BorderLayout.CENTER);
        textArea.getDocument().addDocumentListener(new DocumentListener() {
            public void changeUpdate(DocumentEvent e) {
            public void insertUpdate(DocumentEvent e) {
                saveText();
            public void removeUpdate(DocumentEvent e) {
            public void changedUpdate(DocumentEvent e) {
                throw new UnsupportedOperationException("Not supported yet.");
    public void saveText() {
        System.out.println("saving");
}Now of course this will not work. The method saveText() is in the parent class. So how do I invoke this method???
Instead of calling the saveText() method I could interact with the variables of the parent class so why can't I invoke the method?

OllieL wrote:
public void insertUpdate(DocumentEvent e) {
saveText();
}Now of course this will not work. The method saveText() is in the parent class. So how do I invoke this method???Really? What happened when you tried? What does "will not work" mean? A compile error?
Anyway, if there actually were a conflict (there isn't here, that's not why it's not working) you can always qualify the member further:
//for instance member
Gui.this.saveText();
//for static member
Gui.otherMethod();

Similar Messages

  • I am no musician, but have owned an iMac now for around four years. During that time I have had Garageband installed. I have dipped in and out very occasionally as I would like nothing more than to be able to get my head around it just for my own amusemen

    I am no musician, but have owned an iMac now for around four years. During that time I have had Garageband installed. I have dipped in and out very occasionally as I would like nothing more than to be able to get my head around it just for my own amusement really. I would at least like to be able to record my electric guitar with loops and tracks etc, just try to be a bit creative and see what comes out. The problem that I have is that perhaps its me, but every time I try to get to grips with this software, I just can't seem to get my head around it, even to begin to do something. I have now recently downloaded 10.0.2 which is confusing in itself, as, as far as I can ascertain that is actually version 11, but I'm not even sure about that. I have also recently purchased a Rocksmith RealTone Cable to connect my guitar. I can sometimes get a sound come out, but nothing to brilliant. And every time I try to set something up, it just doesn't seem to work out. I end up hitting buttons and controls in the simple hope that I may hit the correct control in order to get some sort of result. But I'm kind of fumbling in the dark with this. I have trawled the Internet just trying to find either a good manual or video tutorials for absolute beginners, but there just simply doesn't seem to be anything of that nature out there and what there is appears always to be very sketchy and not particularly detailed in explaining anything properly, and so I always find myself seemingly jumping in with both feet and just struggling to try and find a foothold with this on how to really begin. It is so frustrating as I can see the fantastic potential of this software, but just can't understand how to use it properly. If there is anyone out there who may be able to offer me some advice with this, I would be most grateful indeed... Many Thanks.

    I have now recently downloaded 10.0.2 which is confusing in itself, as, as far as I can ascertain that is actually version 11, but I'm not even sure about that.
    Version 10.0.2 is the newest version and the successor to GarageBand '11 (version 6.0.5).
    The '11 is referring to the iLife '11 suit of multimedia application - the older GarageBand was a part of this bundle.
    Have a look at Edgar's graphical enhanced manuals, the explain very detailed how things work and why. You can buy them as iBooks from the iBook store or directly from the page:
    http://DingDingMusic.com/Manuals/

  • Really cannot get my head around Apple ID and iCloud

    Hi
    I have been reading up on various posts and threads and it seems there is no one definitive answer.
    I have an Apple ID (this uses one email address) from the beginning of time when iTunes first  came out.  Subsequently, I then had a .mac account (this uses a different email address) which has grown and become iCloud.
    On my new iPhone 6, I cannot get my head around which affects what and which calendars, to dos are here or there.  It is a right mess.
    Can someone kindly tell me how can I simply my dumb existence?  Perhaps I am getting too old for tech.
    I think at one point I wanted the Apple ID for personal use and the iCloud account for business use.

    I spent FOUR hours on the phone with Apple yesterday and still no wiser.
    Few of my apps work.  I backed up my iPhone 4S on iOS 6.0 and restored it onto new iPhone 6 on iOS 8.
    The weather app shows all the 10 locations I have saved in there as 32 deg  Celsius yesterday but deleting and re-adding corrects that issue I think it was Steve Jobs that coined the phrase "It just works!" - God bless him!  He would turn in his grave I am sure at the state of affairs so few years on.
    The motto should be refreshed to "It just doesn't work".
    I am so frustrated with this that I reckon I am going to be returning the phone over the weekend if I cannot get any useful advice on this issue.
    I have no idea whether all 10,000+ photos I have are properly synced.  Apple advised me to use the iCloud Photo Beta but then said they cannot guarantee it.  Obviously as it is in Beta stage.  Why would anyone take that risk?

  • HT201263 my ipad is locked out however when i try to type my passcode the individual letter gets a box around it and will not let me type my passcode in.  how do i get rid of this.

    my ipad is locked out however when i try to type my passcode the individual letter gets a box around it and will not let me type my passcode in.  how do i get rid of this.

    Hello SeanySmith,
    It may be necessary to place your device into recovery mode and restore it as new.
    iOS: How to back up your data and set up your device as a new device
    http://support.apple.com/kb/HT4137
    Cheers,
    Allen

  • Getting my head around SOFS

    Hi,
    I am really struggling to get my head around how to actually build a SOFS using server 2012 R2 which is supposed to be able to use iSCSI disks. I am trying to provide high storage availability should a storage system fail in one of our buildings. this is
    what I have:
    Building 1:
    1 Server 2012 R2
    1 NAS which supports the creation of iSCSI targets and LUNs
    Building 2: - the same as above.
    what I want to achieve is a storage system (probably using SMB) for hyper-v virtual machines reside on, whereby any server and/or storage system becomes unavailable and the storage stays up in an active-active node. I have created 3 iSCSI targets and LUNs
    on each NAS, on server 1 i attached to NAS1 iSCSI targets, on server 2 i attached to NAS2 iSCSI targets.
    I am no unsure how to get these into one cluster shared pool/space. I have got as far as making a storage pool on each of my 2 nodes under "pools" in failover cluster manager I have cluster pool1 owned by node 1, and cluster pool2 owned by node2.
    I created a virtual disk for cluster pool1. then created a volume on that. under disks in FCM it shows assigned to available storage, owner node1
    I tried to create a virtual disk for cluster pool2 but it wont attach, in server manager i see an error and trying to attach it shows "Error attaching or detaching virtual disk. failed to attach virtual disk to node2. access denied"
    i can see in FCM it has been added to the disks as available storage but is offline and owned by node1 - i cant move the ownership.
    am I understanding SOFS wrong here or should my scenario be possible?
    thanks
    Steve

    Hi,
    thanks for such a great detailed answer, you have given a lot there. just a couple of things though:
    your point 3 states online VM's cannot be deduplicated - are you referring to Server 2012 or R2, as I believe in R2 they now can be Deduped. Does StarWind support Deduplication or is it best to use Microsofts version? can StarWind Dedupe be used in a HA
    image?
    in point 5 you have said about SQL and Exchange cant be used in Hyper-v replica. are you saying that if I had a SQL or Exchange virtual server I can't replicate it to a hyper-v replica server, why would this be? can StarWind be used to send a replica of
    the VM's to another destination server and function similar to hyper-v replica? I like the idea of 30 seconds replications for servers which are close enough for us to do this, and the 15 minutes for servers in further locations.
    thank you
    Steve
    1) With R2 MSFT had improved VDI scenarios. But still deduplication of a running VMs is not supported. See:
    What's New in Data Deduplication in Windows Server 2012 R2
    http://technet.microsoft.com/en-us/library/dn486808.aspx
    Important
    In Windows Server 2012 R2, the performance of VHDs optimized through Data Deduplication is fully tested and supported only on VDI workloads. The same performance gains are not guaranteed for non-VDI workloads running on Hyper-V virtual machines; nor does Microsoft
    offer support for these scenarios in Windows Server 2012 R2.
    Extending Data Deduplication to new workloads in Windows Server 2012 R2
    http://blogs.technet.com/b/filecab/archive/2013/07/31/extending-data-deduplication-to-new-workloads-in-windows-server-2012-r2.aspx
    Is Hyper-V in general supported with a Deduplicated volume?
    We spent a lot of time to ensure that Data Deduplication performs correctly on general virtualization workloads. However, we focused our efforts to ensure that the performance of optimized files is adequate for VDI scenarios. For non-VDI scenarios (general
    Hyper-V VMs), we cannot provide the same performance guarantees.
    As a result, we do not support deduplication of arbitrary in use VHDs in Windows Server 2012 R2. However, since Data Deduplication is a core part of the storage stack, there is no explicit block in place that prevents it from being enabled on arbitrary workloads.
    Sure we (StarWind) do support running VMs deduplication.
    2) You can replicate running VMs with SQL Server and Exchange with Hyper-V Replica the problem is you're not going to have consistent content on the destination side. See:
    Support policy for Microsoft SQL Server products that are running in a hardware virtualization environment
    http://support.microsoft.com/kb/956893/en-us
    If multiple SQL VMs are tightly coupled with one another, individual VMs can failover to the disaster recovery (DR) site but SQL high
    availability (HA) features inside the VM need to be removed and re-configured after VM failover. For this reason the following SQL Server features are not supported on Hyper-VM Replica: 
    Availability Groups
    Database mirroring
    Failover Cluster instances
    Log shipping
    Replication
    Does Exchange Support Hyper-V Replica
    http://blogs.technet.com/b/rmilne/archive/2013/07/29/exchange-and-hyper-v-replica-support.aspx
    In short, Exchange does not support the Hyper-V Replica feature.  Exchange has a long history of supporting virtualisation from Exchange
    2003 onwards.  It is fully supported to install Exchange 2007, 2010 or 2013 as
    a virtual machine on Hyper-V, but using the Hyper-V replica feature is not supported.
    The Exchange 2010 virtualization support requirements and Exchange
    2013 virtualization requirements pages are rather detailed in what must and must not be done on an Exchange virtual machine or hypervisor.  If what you want to do is not listed, then that should set an alarm bell off…. 
    The Exchange virtualization support statement has never listed Hyper-V replica, though some of the Hyper-V content has alluded to running Exchange as a replicated VM.  
    You cannot use StarWind to replicate VMs (not any more at least) as we're working on a LU level so you replicate all "linked" VMs located on LU/CSV.
    Hope this helped 
    StarWind VSAN [Virtual SAN] clusters Hyper-V without SAS, Fibre Channel, SMB 3.0 or iSCSI, uses Ethernet to mirror internally mounted SATA disks between hosts.

  • Can't get my head around creating audio

    Hi,
    It's all a bit too mathematic looking for me, and I should be ashamed of myself really as I can handle complicated music sequencers, but....I can't get my head around creating the files as detailed here:
    http://www.iwebformusicians.com/Website-Music-Movies/HTML5-Audio.html
    It's got codes listed, but what do I do with them, where do I put them, how do I put them in my page etc?
    I've already got video on my site which I converted and plays OK on a PC without quicktime, but my music MP3 files won't play on some PC's, so I was looking at the above as the solution. But I'm completely lost how to start?
    Can someone run through the process from step 1, step 2 etc - I would be very grateful.
    Thanks.

    The stuff that I wrote in the section of iWeb for Musicians that you are referring to was meant as an introduction to HTML5 and how it will be used in the future. I will update it when time permits!
    Right now, Safari, Chrome and Firefox support this although the last needs an OGG file which is a pain!. Internet Explorer, of course, hasn't even got around to HTML5 yet except in V 9 which is still beta as far as I know.
    There seems to be at least half of PC users still sticking with IE Vs 6 & 7 so there's a long way to go before HTML5 is the king.
    Flash is still the way to go to reach most viewers as QuickTime is far less popular and there are problems when you try to load more than two or three files onto a web page. Due to the fact that iOS does not support flash its a question of providing an alternative.
    My, short term, solution is to provide a flash player on a page with a link to one for iOS users which has the files loaded as HTML5. The other alternative is to provide both as shown in the second example on this page.....
    http://www.iwebformusicians.com/Website-Music-Movies/Wordpress-Flash-HTML5-Audio .html
    There are a number of solutions for video available which play them as flash and fallback to HTML5 or vice versa and I gave some examples of these and how they can be adapted to audio.

  • HT1751 On an old Mac I got this message while trying to burn a CD for the car: "The attempt to burn a disc failed.  The burn failed because of a medium write error."  What does this mean?  And how do I work around it?

    On an older Mac I got this message while trying to burn a CD for the car: "The attempt to burn a disc failed.  The burn failed because of a medium write error."  What does this mean?  And how do I work around it?

    I had been getting this all morning and checked other messages from the community. THe one which worked was trying a different brand of disc.
    I had been using Verbatim which had copied the music fine off the Real Player on my PC at school, but wouldn't work with I Tunes. Tried a Staples and an Office Depot CD-R , both of which did the job.

  • New itunes can't get my head around it

    Hello.
    Recently downloaded the latest version of itunes and I honestly have tried to get my head around it with plenty of good will but it just doesn't work for me. So i was wondering am I the only one or are there others? would love to hear about what you like and what you don't like here is my comments:
    genius playlist:
    why can't i see full list of previous songs played? if I would like to hear a specific previous song in the list I cannot just click it
    why can't i access song sub-menu? old itunes you could right click on the song and search for the file location for example?
    why do I need seperate windows to open when opening specific items such as downloads or genius why can't they just feature in the main screen?
    but my biggest gripe with it  is that it just generally feels overcroweded. the previous version was so clear and easy on the eye with enough information to know what was listed but not too much to make you lose focus on what you are after. This one offers so much information on everything that I cannot seem to focus any more (maybe not bright enough )
    but seriously as an example of overcrowding, it now lists all the TV series I have previously purchased and removed as already watched. Although no longer on my main hard drive it comes up as available through iclouds. I specifically stored them in a seperate hard drive to not overcrowed my itunes now they are back. and the fact that you can select to only show the non viewed TV episodes doesn't help as it shows series I have bought but haven't downloaded yet .
    am I the only one and starting to become a grumpy old man? should I just accept and adapt? looking forward to hear other peoples thoughts

    I love the new version of Grid view but some of the other changes feel like they still need some fine tuning. And I miss cover flow even if I didn't use it that often...
    You can restore much of the look & feel of the previous version with these shortcuts:
    Ctrl-B to turn on the menu bar.
    Ctrl-S to turn on the sidebar (your device should be listed here as before).
    Ctrl-/ to turn on the status bar.
    Click the magnifying glass top right and untick Search Entire Library to restore the old search behaviour.
    Use View > Hide <Media Kind> in the cloud or Edit > Preferences > Store and untick Show iTunes in the cloud purchases to hide the cloud items. The second method eliminates the cloud status column (but perhaps it does more)
    If you want to roll back to iTunes 10.7 first download a copy of the 32 bit installer or 64 bit installer as appropriate, uninstall iTunes and suppporting software, i.e. Apple Application Support & Apple Mobile Device Support. Reboot. Restore the pre-upgrade version of your library database as per the diagram below, then install iTunes 10.7.
    See iTunes Folder Watch for a tool to scan the media folder and catch up with any changes made since the backup file was created.
    tt2

  • How long does it take to get approval from iTunes Connect and how do I find out if they are working on it?

    How long does it take to get approval from iTunes Connect and how do I find out if they are even working on it? I'm not really sure if my application was even delivered - from the links in IBA. Any suggestions how one might push the right buttons at Apple?
    Also went around in a big circle trying to get beyond the confusion of not having the right Apple ID when I've had it a long time. Confusion abounds and learning this forum also takes a new degree of patience. Humbling to say the least :-)
    Anyone been there done that?

    [email protected]
    [email protected]
    …support phone number call +1 (877) 206-2092.
    Global Phone Support
    We have expanded English-language publisher phone support. To make contacting the iBookstore support even easier, new local phone numbers are now available for Australia, France, Germany, Italy, Netherlands, Spain, and the U.K. Support is available Monday to Friday, from 7 a.m. to 5 p.m. (PT).
    Country
    Phone Number
    Australia
    1300 307 504
    Note that this is a low tariff number.
    France
    0805 540 117
    Germany
    0800 664 5307
    Italy
    800 915 902
    Netherlands
    0800 0201 578
    Spain
    900 812 687
    U.K.
    0800 975 0615
    U.S.
    +1 (877) 206-2092
    Toll-free from U.S. and Canada.

  • I have insurance through apple for my iPhone 4. Last night my phone was stolen. Am I covered under insurance to get a new phone? And how much will it cost? Second- what should I do about it? I don't know if I should shut down the phone or what?

    I have insurance through apple for my iPhone 4. Last night my phone was stolen. Am I covered under insurance to get a new phone? And how much will it cost? Second- what should I do about it? I don't know if I should shut down the phone or what in case my iPhone is able to be located or what not?

    Jonryan21 wrote:
    I have insurance through apple for my iPhone 4.
    No, you simply do not.  Apple does not sell insurance.
    Apple offers an Extended Warranty called AppleCare.
    Warranties doe not cover lost or stolen devices.  Buy a new one.

  • Ok somehow my sister deleted all my photos off my photo booth and now all my pictures in my iphoto i cant view them i just see white dots and boxes can anyone tell me how i can get my deleted photos back and how can view my photos again please !!!

    ok so somehow my sister deleted all my photos off photo booth and now all my photos on iphoto i cant view them i want to know how i can get my deleted photos back and how to view the rest of my photos please help !!!!

    Phonebooth is in your home folder under pictures with Iphoto and Ichat. Deleting pigtures from phonebooth should not remove any from Iphoto library. Something else had to happen.

  • I am trying to type a password into a Pages document. The number goes in OK but when I hit return or any other key the numbers get transposed. What happens and how do I corret it?  Thanks

    I am trying to type a password into a Pages document. It types in OK, but when I press return or close the document some of the letters in the password get transposed. What happens and how can I fix this? Thanks.

    Are you just typing ordinary text into a word processing document or are you trying to set a password on the document itself?
    If it is the first perhaps Pages is trying to spell check the password. You can tell it to ignore that "word", or turn spellchecking off.
    Peter

  • Upon start up I get a start up disk full message and to delete files, now I only get a a blue screen on start up. How to I get past the blue screen and how do I delete files?

    Upon start up I get a "start up disk full message, delete files". Now on startup I only get a blue screen. How do I get past the blue screen and how do I delete files.

    That;s really not enough free space... you can use a tools such as OmniDiskSweeper to find out where your large files reside and begin pruning (or copying to an external if they're files that you want to keep).
    One thing is certain - if you're going to continue your current usage you're certainly going to need to install a larger boot drive.
    Clinton

  • My MacBook Pro came with Lion pre-installed so I can't re-download it from the app store. Is it possible to get the installESD.dmg file and how can I get it if I can't re-download Lion in Apple Store option?

    My MacBook Pro came with Lion pre-installed so I can't re-download it from the app store. Is it possible to get the installESD.dmg file and how can I get it if I can't re-download Lion in Apple Store option?

    FYI Mac OS X is not designed to be installed on additional Macs, unless you purchased it from the App Store, in which case you can make as many copies as you wish and install it on as many Macs as you own.
    From the Recovery Disk Assistant -
    Notes
    If the computer shipped with OS X Lion or Mountain Lion, the external recovery drive may only be used with the system that created it.
    If the system was upgraded to Lion or Mountain Lion purchased from the App Store, the external recovery drive can be used with other similarly-upgraded systems.

  • What is iTunes Match and how does it work?

    What is iTunes Match and how does it work? I have several tunes on my computer that do not show complete. The source of these tunes are from my own CDs.

    iTunes match - http://www.apple.com/itunes/itunes-match/ - see FAQ at end too
    Basically it looks at the music you have in iTunes.  If it sees the equivalent on the iTunes Store site it does nothing, but it makes that copy accessible to you to download.  If you have music  it doesn't it will upload a version from your computer to the site that only you can access from anywhere online.
    In your case if you have incomplete tracks it will not fix them.  It does some kind of audio fingerprinting to make sure you aren't just feeding it a bunch of 60s demonstration cuts and trying to get whole tracks back.

Maybe you are looking for

  • How to install DW 8 Patchpackage.msp for Windows 7?

    I have DW 8 which ran great on Vista Home Premium. I have upgraded to Windows 7 and have many issues with DW 8. I would like to install the 8.02 patch, but it will not install via usual method. I then downloaded Patchpackage.msp and have attempted to

  • Dynamic Column Names in Trigger

    I have a trigger which fires on each row. The issue is that I have a lot of duplicate code because there are many columns. Is it possible to abstract the new and old column name references? CREATE OR REPLACE TRIGGER a BEFORE INSERT OR UPDATE ON table

  • Incrementing number in psd AND file name

    Hi, I would like to create files that contain a number (aka title n°1, title n°2, title n°3...) and save them with that same number. I don't seem to find any info on the subject. Can anyone help ? Thanks.

  • HT1386 Each time I try to sync my iPhone it says "Waiting for changes to be applied" even though I have clicked the 'apply' button

    I have downloaded some music from the iTunes store and that has gone over onto my phone but the albums from CD's that I own are not going onto my phone as it will not sync. Your help is very much appreciated

  • CONNECTION ISSUES

    I have been receiving the following error message since updating iTunes to 7.6.0.29: iTunes could not connect to the iTunes Store. The connection timed out. Make sure your network connections are correct and your network connection is active, then tr