Getting the "New" MenuItem to work.

Posted this one in the Programming section before with no luck, maybe it will be easier to acquire an answer here considering I assume many here must have done this exact thing.
I have a GUI, in that GUI a selfmade Menu and mainarea is put. The Menu has a "New" option which is meant to replace the current mainarea with a new fresh one.
Simplified, the below describe what I got atm. I know it doesn't work and most likely cause lack of pointer-equivalent-code. Question is though, how can the Menu perform that task?
Any help greatly appreciated.
public class MyGui extends JFrame
     MyMenuBar menuBar;
     MyPanelWithStuff stuff;     
     public PaxGui()
          super();
          menuBar = new MyMenuBar(this);
          setJMenuBar(menuBar);
          buildStuff();
          pack();
          setVisible(true);
          // End of constructor PaxGui().
     public void buildStuff()
          stuff = new MyClassWithStuffExtendingPanel();
          getContentPane().add(stuff);
          // End of method buildStuff().
     // End of class MyGui extends JFrame.
public class MyMenuBar extends JMenuBar
     JMenu fileMenu;
     JMenuItem newMenuItem;
     ActionHandler actionHandler;
     MyGui myGui;
     public MyMenuBar (MyGui aMyGui)
          super();
          myGui = aMyGui;
          actionHandler = new ActionHandler();
          fileMenu = new JMenu("File");
          add(fileMenu);
          newMenuItem = new JMenuItem("New");
          fileMenu.add(newMenuItem);
          newMenuItem.addActionListener(actionHandler);
          // End of consrtuctor MyMenuBar().
     private class ActionHandler extends AbstractAction
          public void actionPerformed(ActionEvent aActionEvent)
               if (aActionEvent.getSource == newMenuItem)
                    {myGui.buildStuff();}                              
          // End of inner class ActionHandler extends AbstractAction.
// End of class MyMenuBar extends MenuBar.

It worked like a charm and just have a little follow
up. Both setVisible(true) and revalidate() work, so
which should one use and what is the difference.the (re)validate() goes up the chain of components and does layout and stuff (afaik). so if setVisible() works use that (it might trigger validate() anyway).
And Thanks alot for putting me back on track =).no problem ;)
thomas

Similar Messages

  • How do I get the new iPod to work with iTunes

    I recently purchased a new iPod--I think it's the "Shuffle," whichever one retails for $150. When I plugged it into my iMac, it said I needed to install iTunes 10 to run it. When I checked for updates, it said that iTunes 9.xyz (whatever came after the 9) was the latest version.
    How do I get this new iPod to work. As you can tell, I am not much of a gadget junkie, and I'm a bit of a technology incompetent, which is why I purchased the Mac to begin with. I have an iMac, have no idea what operating system I am using--whatever came with it when I purchased it in November, 2008.
    TIA!

    Okay, I just looked and I do have 10.411. How do I upgrade to get the new iPod to work, and how much does the new operating system cost?

  • I'm stumped, can't get the new ipod to work.

    I bought a new ipod 30g after my mini started to die. I had no problems with the mini or itunes. Now I wan't to add the new ipod to my computer and I can't get it to work. I installed the new software and registered the ipod. But when I connect it to the cable it doesn't come up on itunes. So I guess what I'm wondering is if I have to uninstall the old itunes then reinstall the new software? And if I do can I keep my library?
    Is there a way to have 2 ipods on 1 computer?
    I'm not very computer savy and I've tried everything that I can think of.
    Jeniene
    Dell   Windows XP  

    Sure, easiest way to backup, is to move the songs onto another hard drive if you have another hard drive and enough space.
    I burn data CDs and DVDs because lots more will fit on one disc than audio CDs.
    Backing Up Music Files in iTunes
    Always good to have a backup!
    I've reinstalled numerous times and not lost my songs.
    It is also a good idea to back up your library files so you can save your playlists, ratings, etc.
    What are the iTunes library files?

  • I have an old email associated with my apple store. It has been closed. How do I get the new email to work with my account?

    I want to associate my old purchases with the new email and not loose my history.

    You should be able to update the primary email address on your account either via the Store> View Account menu option on your computer's iTunes (there should be an Edit button to the right of your account id on your account's details page), or via http://appleid.apple.com - you might then need to log out of the account on each comuter/device and log back in with the new version to 'refresh' the account on them

  • A website that i use quite frequently will not work with the newer versions of firefox. Is there a compatability mode of some way to get the newer version to work?

    All the website says is this browser is not supported. Only version 3.5 is. I can list the url because it is a work url

    You can install the portable Firefox 3.6.x version to access websites that do not work with Firefox 5+.
    *http://portableapps.com/apps/internet/firefox_portable#legacy
    *http://portableapps.com/apps/internet/firefox_portable/localization#legacy36

  • How do I get the new Flashplayer to work?

    followed all the steps and tried Everything I found in the support.
    The bar asking if I want to run it at the bottom of the page does pop up right after I accept. and nothing happens.

    [discussion moved to Installing Flash Player forum.]

  • After downloading 6.0 continue to receive a crash message below when opening the broswer; tried to unintall & reinstall, ran all available updates and plug ins. I have also read all the FAQs and tried those. How do I get the new version to work?

    Crash Report Info
    AdapterDeviceID: 0847
    AdapterVendorID: 10de
    Add-ons:
    AvailableVirtualMemory: 4090585088
    BuildID: 20110830092941
    CrashTime: 1314808349
    EMCheckCompatibility: true
    Email: [email protected]
    FramePoisonBase: 00000000f0de0000
    FramePoisonSize: 65536
    InstallTime: 1314808322
    Notes: AdapterVendorID: 10de, AdapterDeviceID: 0847, AdapterDriverVersion: 8.15.11.8640
    ProductName: Firefox
    ReleaseChannel: release
    SecondsSinceLastCrash: 2
    StartupTime: 1314808348
    SystemMemoryUsePercentage: 23
    Theme: classic/1.0
    Throttleable: 1
    TotalVirtualMemory: 4294836224
    URL: http://www.mozilla.com/en-US/firefox/6.0.1/firstrun/
    Vendor: Mozilla
    Version: 6.0.1
    Winsock_LSP: MSAFD Tcpip [TCP/IP] : 2 : 1 :
    MSAFD Tcpip [UDP/IP] : 2 : 2 : %SystemRoot%\system32\mswsock.dll
    MSAFD Tcpip [RAW/IP] : 2 : 3 :
    MSAFD Tcpip [TCP/IPv6] : 2 : 1 : %SystemRoot%\system32\mswsock.dll
    MSAFD Tcpip [UDP/IPv6] : 2 : 2 :
    MSAFD Tcpip [RAW/IPv6] : 2 : 3 : %SystemRoot%\system32\mswsock.dll
    RSVP TCP Service Provider : 2 : 1 : %SystemRoot%\system32\mswsock.dll
    RSVP UDPv6 Service Provider : 2 : 2 :
    RSVP UDP Service Provider : 2 : 2 : %SystemRoot%\system32\mswsock.dll

    Crash Report Info
    AdapterDeviceID: 0847
    AdapterVendorID: 10de
    Add-ons:
    AvailableVirtualMemory: 4090585088
    BuildID: 20110830092941
    CrashTime: 1314808349
    EMCheckCompatibility: true
    Email: [email protected]
    FramePoisonBase: 00000000f0de0000
    FramePoisonSize: 65536
    InstallTime: 1314808322
    Notes: AdapterVendorID: 10de, AdapterDeviceID: 0847, AdapterDriverVersion: 8.15.11.8640
    ProductName: Firefox
    ReleaseChannel: release
    SecondsSinceLastCrash: 2
    StartupTime: 1314808348
    SystemMemoryUsePercentage: 23
    Theme: classic/1.0
    Throttleable: 1
    TotalVirtualMemory: 4294836224
    URL: http://www.mozilla.com/en-US/firefox/6.0.1/firstrun/
    Vendor: Mozilla
    Version: 6.0.1
    Winsock_LSP: MSAFD Tcpip [TCP/IP] : 2 : 1 :
    MSAFD Tcpip [UDP/IP] : 2 : 2 : %SystemRoot%\system32\mswsock.dll
    MSAFD Tcpip [RAW/IP] : 2 : 3 :
    MSAFD Tcpip [TCP/IPv6] : 2 : 1 : %SystemRoot%\system32\mswsock.dll
    MSAFD Tcpip [UDP/IPv6] : 2 : 2 :
    MSAFD Tcpip [RAW/IPv6] : 2 : 3 : %SystemRoot%\system32\mswsock.dll
    RSVP TCP Service Provider : 2 : 1 : %SystemRoot%\system32\mswsock.dll
    RSVP UDPv6 Service Provider : 2 : 2 :
    RSVP UDP Service Provider : 2 : 2 : %SystemRoot%\system32\mswsock.dll

  • Print from ipad if i connect a usb connector to my ipad can i connect my printer to it and print??as im thinking of buying the new ipad for work but i must be able toprint

    hi can any one help i want to get the new ipad for work but i need to print.i see i can buy a usb connector can i print if i plug my printer into the usb.

    If you have a USB printer connected to your computer, Mac or PC, you can activate or install AirPrint and print from your iPad over wifi without any special apps.
    Activate AirPrint in Mac OS X;
    http://netputing.com/airprintactivator/
    Add AirPrint to Windows;
    http://jaxov.com/2010/11/how-to-enable-airprint-service-on-windows/

  • Saved download for Camera Raw update. still can't open Raw pic in CS5. How do I get the downloaded files to work so I can open Raw images? thanks, Artist Ray

    Bought new camera to work with Raw images in CS5 but file would not open so I downloaded latest update. It only allowed me to save in a file ( could have OPENED instead of saving so I don't know those results). How do I get the new download to work in CS5?
    Thanks for your help, Artist Ray

    Bought new camera
    Which camera make and model?
    Supported cameras
    Camera Raw plug-in | Supported cameras
    Compatible Adobe applications
    Camera Raw-compatible Adobe applications
    Why doesn’t my version of Photoshop or Lightroom support my camera?

  • I cannot get the new mac mini to wake from sleep and trigger the displays - this is the second mac mini I have had and both have had the same issues. It worked before on my macbook extremely well...

    I cannot get the new mac mini to wake from sleep and trigger the displays - this is the second mac mini I have had and both have had the same issues. It worked before on my macbook extremely well...
    Using 2 displays, connected via HDMI and thunderbolt
    Been on to support a number of times now - is anyone experiencing the same issues?

    BUMP.
    I actually showed this to Apple geniuses when I took my computer to the apple store, and it's still here. In console it says:
    kernel[0]: Previous Shutdown Cause: -128
    I don't know if that's related or not, but maybe helps?

  • Every time i connect my iphone to itunes and trying to do a backup or get the new update it says i have to restore my iphone. and then that doesnt work, i tried to reinstall itunes but it doesnt work. i get this all the time. fix it please.

    Every time i connect my iphone to itunes and trying to do a backup or get the new update it says i have to restore my iphone. and then that doesnt work, i tried to reinstall itunes but it doesnt work. i get this all the time. fix it please.

    iTunes states " There's a problem with your Iphone, please contact apple service center " Also i took my iphone to a local service man and he told me the IMEI code has been corrupted and there's nothing that can be done about it. Please help, if you have any solution.
    Thank you

  • IPad 3 and older digital av adapter. It works, but is there reason to get the newer model?

    I have an iPad 3. I also have an older model digital av adapter. It's model MC953ZM/A. Although its older it still works fine with my iPad 3 even though it says it's not supported when I plug it in. Is there any benefit to purchasing the newer model digital av adapter?
    Thanks.

    Other than not getting that message, or having Apple perhaps not support it should you call or visit them asking for assistance (I don't know if they'd just tell you to get the newer adapter, but it's possible), no, there's no reason I know of to buy the newer version of the adapter.
    Regards.

  • My macbook is 4 years old, i havent bought any upgrades but now i cant download the new itunes. Can i buy one upgrade and will it work or is there a way to get the new itunes?

    My macbook is 4 years old, i havent bought any upgrades but now i cant download the new itunes. Can i buy one upgrade and will it work or is there a way to get the new itunes?

    Even a four-year-old MacBook should have come with Mac OS X 10.5 Leopard. Leopard can run the latest version of iTunes; it will download and install pretty much automatically if you run Software Update.
    You might first have to be sure that you are running the latest version of Leopard, which is 10.5.8. This, too, will download and install for you if you run Software Update. Just keep running Software Update until there is nothing left to download and install (you might have to run it more than once because some updates require previous updates to be installed first).
    If you have a version of Mac OS X earlier than 10.5, then you can't run the latest version of iTunes. You will need to buy a more recent version of Mac OS X. You must be running at least 10.4 Tiger, and you can upgrade directly to Snow Leopard from Tiger. Apple still sells Snow Leopard for about $30 and you might find it slightly less at a retailer or on eBay. After upgrading to Snow Leopard, you will be able to upgrade to Lion using the Mac App Store for another $30 or so if your MacBook meets the minimum system requirements.

  • My itunes won't work on my mac. When I try to download all my songs to my iPad it says I need to get the new version when I already have it already

    When I try to download all my songs to my iPad it says I need to get the new version when I already have it already

    Are you sure you have the newest version of iTunes 11 and newest version of iOS6? Go to Software Update and make sure you do.

  • It's happened twice in the last month- I suddenly can't open my Pages documents unless I get the new version (for $20!) What is going on??!!

    Some documents, but not others, that I've created/edited/printed and worked with JUST RECENTLY suddenly won't open UNLESS I get the new version of Pages (for $20!!) I just edited some of these a couple of days ago! I edited one, printed it, etc. Now I need to look at it again and it WON'T open! I "need the new version of Pages??! What if I don't want to suddenly shell out $20 to work with documents I made on the version I already have? And why do SOME documents now look different (in a new style) while others look like they always have, and function normally?

    You have 2 versions of Pages on your Mac.
    Pages 5.2 is in your Applications folder.
    Pages '09/'08 is in your Applications/iWork folder.
    You are alternately opening the wrong versions.
    Pages '09/'08 can not open Pages 5 files and you will get the warning that you need a newer version.
    Pages 5.2 can open Pages '09 files but may damage/alter them. It can not open Pages '08 files at all.
    Older versions of Pages 5 can not open files from later versions of Pages 5.
    Once opened and saved in Pages 5 the Pages '09 files can not be opened in Pages '09.
    Anything that is saved to iCloud and opened in a newer version of Pages is also converted to Pages 5 files.
    All Pages files no matter what version and incompatibility have the same extension .pages.
    Pages 5 files are now only compatible with themselves on a very restricted set of hardware, software and Operating Systems and will not transfer correctly on any other server software than iCloud.
    Apple has removed almost 100 features from Pages 5 and added many bugs:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    Peter

Maybe you are looking for

  • How do I use my Nokia Lumia 635 with Target's Brig...

    I purchased my 635 on eBay and the seller said it was an unlocked phone. When I put the Brightspot SIM card into the phone, it asks me which "Cellular Connection Profile" I want to use for the SIM card, and the only two options are T-Mobile or MetroP

  • LOst! mail,photo booth and app store on my macbook pro plz anybody help me out

    please help meee

  • VMware Fusion question - Multiple Monitors

    I apologize if this is in the wrong area, but I am desperate for some help. I have also posted this same question in the VMware communities but I have not had any luck with anyone responding yet. It seems that I am having an issue with my virtual mac

  • Windows XP to Windows 7 move of iTunes

    I'm trying to move my iTunes library from an older desktop tower running Windows XP to a new small laptop running Windows 7. Over the years I've kept a USB hard drive in sync with the desktop holding a back up of the folder simply called iTunes. (con

  • HP laserjet 1200 series not responding

    I just got an hp laserjet 1200 series printer from a friend that used it on his pc. I can't seem to get my computer to recognize it. I have tried going to the hp page and downloading the driver and the software, which I thought I did, but when I open