Can't get rid of JDialog buttons!

Hey all,
I just figured out how to use JDialogs and I'm having trouble with adding buttons on them. Specifically, once I kill the dialog, I want everything on it to go away so I can remake it again when I need to. However what happens is, when I re-add the buttons to the dialog, the old buttons are still there and I'm not sure why. Here's some of my code:
class JMenuAction extends AbstractAction
        private final JDialog d = new JDialog(new JFrame(),ResourceFile.getString("AddPlayerText"));
      //Constructors etc.
        public void actionPerformed(ActionEvent arg0)
            if(myKill)//remove everything
                System.out.println("HERE");
                getContentPane().removeAll();
                d.getContentPane().removeAll();
                d.removeAll();
                myButtons.clear();
            else if(myInstances<2 && myInstances>0)//Adding another player
                d.setLayout(new GridLayout(0,4));
                JButton one = new JButton(ResourceFile.getString("ComputerEasyCommand"));
                JButton two = new JButton(ResourceFile.getString("ComputerMediumCommand"));
                JButton three = new JButton(ResourceFile.getString("ComputerHardCommand"));
                JButton four = new JButton(ResourceFile.getString("EasyCommand"));
                JButton five = new JButton(ResourceFile.getString("MediumCommand"));
                JButton six = new JButton(ResourceFile.getString("HardCommand"));
                myButtons.put(one, new EasyComputerPlayer(myModel));
                myButtons.put(two, new MediumComputerPlayer(myModel));
                myButtons.put(three, new HardComputerPlayer(myModel));
                myButtons.put(four, new HumanPlayer(myModel,JottoModel.EASY));
                myButtons.put(five, new HumanPlayer(myModel,JottoModel.MEDIUM));
                myButtons.put(six, new HumanPlayer(myModel,JottoModel.HARD));
                ActionListener buttonAction = new ActionListener()
                    public void actionPerformed(ActionEvent e)
                        JButton source = ((JButton)e.getSource());
                        myPlayer = myButtons.get(source);
                        d.dispose();
                for(JButton b:myButtons.keySet())
                    d.add(b);
                    b.addActionListener(buttonAction);
                d.pack();
                d.setModal(true);
                d.setVisible(true);
                setUpView();
    }Is it because its final?

Is it because its final? No. Final only prevents the object reference of a variable from being changed.
Did you revalidate and repaint? If not, I recommend that you do these things.
I wonder if you need to use a CardLayout? I wonder if you just need to create a JDialog at the time it is needed and stuff the appropriate JPanel in it at that time?

Similar Messages

  • How do I get rid of the "Downloads" button on my bookmarks toolbar? Somehow it just appeared and I can't get rid of it.

    How do I get rid of the "Downloads" button on my bookmarks toolbar? Somehow it just appeared and I can't get rid of it.

    Firefox 20 changed from the old Download Manager to a new Download Panel. You can find a complete write-up here: [[Find and manage downloaded files]].
    I suggest keeping that arrow around since it provides handy notifications. You can use the Customize feature to drag it down to the add-on bar where it won't take up as much space. To start customizing:
    * right-click a blank area of the tab bar > Customize
    * tap the Alt key > View menu > Toolbars > Customize
    If you really don't need it, just drag it to the Customize dialog. You can always come back for it later if you like.

  • When taking a picture with home button and sleep button can you get rid of the tool and task bar??

    When taking a picture with home and sleep button can you get rid of the tool and task bar?? (the search bars)

    No, but you can use any picture editing tool to crop out the bars.  (Many are free in the App Store.)  Me personally, I use PhotoPad, which I use to crop as well as rotate the screen shot.  Takes less than a minute to do both with PhotoPad.

  • I have an iCloud backup notice on my screen.  If I hit the OK button nothing happens.  How can I get rid of the notice so I can continue using my iPad?

    I have an iCloud backup notice on my screen.  If I hit the OK button nothing happens.  How can I get rid of the notice so I can continue using my iPad?

    I found answer in right column.  Thanks.

  • I recently downloaded new Firefox; an option was a new top of the page skin. I don't like ; can't get rid of it. what to do?

    After downloading newest firefox an option showed up: do you want one on these new skins to top your opening page? I opted for one of them and now can't get rid of it. I prefer the old . What's there now looks like a background for several toolbars. Contrast is bad.

    You can set Firefox back to using the default theme. Open the add-ons manager (in the tools menu select Add-ons), in the add-ons manager go to the Themes panel. Click on the Default theme in the list of themes then click on the "Use Theme" button.
    For more details see using themes with Firefox.

  • How can I get rid of the sign in prompt when I use google?

    I just upgraded firefox. I am searching in google and every time I put in a search or turn a page I get a sign-in box asking for my goole password. How can I get rid of this, it is a nuisance.

    Do you use any add-ons to enhance your privacy on Google? To make sure those also are the latest versions, try updating your extensions on the Add-ons page. Either:
    * Ctrl+Shift+a
    * orange Firefox button (or Tools menu) > Add-ons
    In the left column, click Extensions. Then, above the list, click the "gear" button and "Check for Updates".
    When you have a problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
    (1) Bypass Firefox's Cache
    Use Ctrl+Shift+r to reload the page fresh from the server.
    Alternately, you also can clear Firefox's cache completely using:
    orange Firefox button (or Tools menu) > Options > Advanced
    On the Network mini-tab > Cached Web Content : "Clear Now"
    If you have a large hard drive, this might take a few minutes.
    (2) Remove the site's cookies (save any pending work first). While viewing a page on the site, try either:
    * right-click and choose View Page Info > Security > "View Cookies"
    * Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
    In the dialog that opens, you can remove the site's cookies individually.
    Then try reloading the page. Does that help?
    Also, I believe Google requires third party cookies. This support article has the steps for making sure you are accepting website cookies: [[Websites say cookies are blocked - Unblock them]].

  • HT4847 How do I unlock my ipad. It Wants me to back up icloud but can't get rid of message to try

    My ipad is showing a message that advises icloud has not been backed up for 2 weeks and the ipad needs to be plugged in and charging to enable back up. However, I can't get rid of the message so that I can turn on wi-fi and start back up. This has happened to me before and I ended up having to pay a one off fee of £25.00 for advice to clear the message that was quick to do. Can't remember how to do it though. Does anyone know how to unfreeze the screen please? I have tried holding the wake up button but that just brings up the swipe to power off screen, which does not react to a swipe. Please help.

    Reset it by holding the power and home buttons at the same time until you see the Apple logo, then release.  This just restarts it, you won't lose any data by doing this.

  • Desktop Manager "disconnected" and I can't get rid of the error message

    I just purchased a Blackberry Curve 8530, running v5 software, my computer is Windows 7. I installed the 501_b073_multilanguage software that I downloaded from Blackberry's website. When I launch the Desktop manager I get this message: "Before you begin, verify that your current BlackBerry device is connected to your computer." The troubleshooting posts I've seen on this forum include many tips (the ones I've tried are below). One in particular I can't do is "The desktop manager is showing "disabled."
    -Make sure that the user has gone into the desktop manager and selected options > connection settings > detect."
    ... because I can't get rid of the error message dialoge box, and I can't click on the options menu in the BB Desktop Manager.
    I have tried the following:
    uninstalled it and reinstalled it twice - 2nd uninstall was a "hard" uninstall where I deleted the registry files by hand
    moved the cable to the USB port in the back (after trying both the ports in the front) of the computer
    restarted the computer many times
    hard booted the phone by removing the battery
    plugged in, removed, and replugged in the phone.
    Also:
    The phone is installing correctly when I plug it in, but the software still doesn't seem to see it.
    In the Device Manager, the BlackBerry is showing up under Portable Devices. Double-clicking on it gives me the reassurring "This device is working properly." message.
    The Com1 port is working properly also, according to the Device Manager.
    Double-clicking on the device manager icon to get the properties shows that the Com1 port is "disconnected" -- when I try to configure it it just pops back to the disconnected state.
    If someone has an idea or something I haven't tried I'd sure appreciate it!!
    Thanks!
    K
    Solved!
    Go to Solution.

    Okay, folks, after a 3 1/2 hour phone call with a (very patient) telephone support person at Blackberry, here's what I learned.
    You can check your USB drivers this way:
    Plug in your phone into your USB drive. Assuming your Blackberry is "seen" by your computer...
    Go into the Device Manager on your computer (control panel)
    Expand the Universal Serial Bus controllers item on the bottom of the list
    Right-click on BlackBerry Smartphone and choose Properties
    Click on the Driver tab
    Click on the Driver Details button
    You should see one driver. I saw two. The one the BlackBerry likes is the RimUsb one.
    So here's what NOT to do: We tossed the entire driver that was the "extra". This effectively made using my mouse and keyboard impossible, as they are USB, and sent my poor husband into the basement to find a million-year-old keyboard (and then a mouse) with the old fashioned kind of connectors (PS2). Bleh. Don't do that.
    Here's what I did that worked (not saything this will work for you -- this modifies the Registry so better do a system backup with that backup and restore if you're nervous about this sort of thing):
    From the start menu, choose run, and type regedit to get into the Registry editor.
    Follow this file path: Computer, HKEY_LOCAL_MACHINE, SYSTEM, CurrentControlSet, Control, Class
    Click on: {36FCE60-C465-11CF-8056-4445535400000}
    If there's an item on the right called "UpperFilters", delete it. (see pictures)
    Hope this helps someone.
    Karin
    First pic: shows "before"
    Second pic: shows full file path and "after"

  • I have a pop up which I can't get rid of which states: "There is no application set to open the URL ximadpzl://save_ximad_token----/"

    I can't get rid of a message which keeps popping up which says:
    There is no application set to open the URL ximadpzl://save_ximad_token/(etc)
    I have no idea to what they are referring and I can find no application which satisfy this requirement. How do I get rid of this message? It won't go away. I have tried turning off the computer, closing Safari, etc.

    All of these suggestions (delete caches, restart, terminal commands, etc) do nothing to actually LOCATE the problem. They are just standard purging processes, and they have all failed to achieve resolution.  And it is NOT Little Snitch either (tried turning that off and nothing changed).  All these forums on this matter have been speculative and useless.
    Ladies and Gents... I have found and isolated the ACTUAL PROBLEM.  It is a Safari Extension that is doing it... specifically "VideoCatcher 5.3.8" which for me was installed with MovieSherlock.  The extension adds the ability to download YouTube movies directly from Safari (by showing a small download button next to any embedded movie). When I remove that extension, all the annoying pop-ups go away.
    MovieSherlock is not the only utility that does this however. There are several YouTube downloaders out there that ALL install an extension that detects YouTube videos on the page. I bet my hat that many (if not all) of you who are experiencing this pop-up issue... have installed one of those downloader utilities.
    So, the solution is simple: disable that extension. If you need to download a YouTube video from a page, either temporarily enable that extension again as needed, or leave the Safari integration disabled and launch the actual utility itself and enter the URL into it for your download.
    I would expect that MovieSherlock and the other YouTube downloading utilities will need to update their extensions (soon?) to deal with Yosemite's new browser script management.
    PROBLEM SOLVED.

  • There's a not enough storage message appearing and I can't get rid of it.

    There's a not enough storage message appearing and I can't get rid of it.

    A reset may help: Tap and hold the Home button and the On/Off button at the same time for approximately 10-15 seconds, until the Apple logo reappears. When the logo appears, release both buttons and await restart.

  • Please help. How can I get rid of this red dotted border around my navigation bar images?

    If you go to my site here...
    http://metalwolf92.zymichost.com/
    And left-click and hold down your mouse, but don't release, on any of the navigation button images. Notice the red dotted border? How can I get rid of those?
    All images already have border set to 0.

    I just noticed your page has no css. so in Code View, replace this closing tag:
    </head>
    with this:
    <style type="text/css">
    a:active {
      outline: none;
    </style>
    </head>
    E. Michael Brandt
    www.divahtml.com
    www.divahtml.com/products/scripts_dreamweaver_extensions.php
    Standards-compliant scripts and Dreamweaver Extensions
    www.valleywebdesigns.com/vwd_Vdw.asp
    JustSo PictureWindow
    JustSo PhotoAlbum, et alia

  • How can I get rid of search history in Safari on my iPad?

    When I highlight one to delete, the search kicks in. How can I get rid of the history?

    You can go to Settings>Safari>Clear History, cookies and data and then delete every bookmark and that should clear it temporarily, but it will only be temporary. As soon as you starting using the search again, then suggestions will appear again.
    I think that I may have misread your question - if you want to clear all of the history - use the Clear History button in the upper right corner of the History window. You cannot delete one item at a time.

  • I can't get rid of the "Install OS X" disk image...

    Several months ago (I think it was when upgrading from 10.6.2 to 10.6.3) I had trouble with two machines - my wife's MBA (Rev. A - 1.6 GHz, 2GB ram, 80 GB HDD), and my MBP, but our iMac did fine. Eventually I got both the MBA and MBP updated and they work fine. Since then I've updated the MBA so that it's running 10.6.4.
    Here's my problem: during the difficult software update somehow I was left with two (2!) "Install OS X" disk images on the MBA desktop. I cannot get rid of them no matter what I do. I've tried ejecting (and they eject - but then when you reboot the computer they come right back), I've tried using disk utility to erase them, I've tried numerous things but I can't get rid of the darn things.
    I'd given up because they weren't causing any harm. However, I've just realized I can't run TimeMachine because of the disk images - TimeMachine stops with an error message saying it can't back up two disks with the same name. I can't change the name or delete the disk images so I can't do backups.
    Any ideas on how to get rid of these silly things?

    OK, then open Disk Utility. Click on the main drive entry at the top of the sidebar list, then click on the Partition tab in the DU main window. You should see a window in which you have the three partitions displayed as rectangles one on top of the other. I'm assuming that in your case the largest rectangle is the uppermost one with the two mystery partitions at the bottom. Click in one of the smaller rectangles. You should see it become outlined in blue. Then click on the [-] Delete button. Repeat for the second small rectangle. You will now have a gray area below your OS X partition. Now click on the Apply button. It may take several minutes for the process to complete so be patient and wait until it's done. When it's finished you should see the topmost OS X partition and the remainder of the window is gray space. In the lower right corner of the OS X partition should be a sizing gadget that looks like a triangle. Use the mouse to drag the corner all the way to the bottom of the window. Click on the Apply button and wait for the process to be completed.
    This should restore your drive to it's original single volume state and get rid of the two mystery items.

  • Yahoo toolbar appeared without my consent. Can't get rid of it. Does not appear in list of add-ons or in list of programs installed for uninstall. (Win7; FFx5) Please help me delete this annoyance.)

    I was prompted to update Java. I got a YAHOO toolbar which I did and do not want. I can't get rid of it. It does not appear on the Add-on list, not in the programs list (to uninstall). Can't find anything with Yahoo in the name. I do not want to use View, because it keeps coming back into view without my consent -- I want it gone permanently.
    The uninstall directions in Yahoo help call for click on pencil tool (which tool is not found on this toolbar). Firefox instructions say go to Add-on list, but the Yahoo bar is not there. There are several Java add-ons, but I don't know what they are and what happens if they are uninstalled.
    Win 7; Firefox 5.0; Yahoo toolbar ver 2.3.8.20110620112826
    Perhaps it is disguised as something else. If so please tell me what to uninstall.

    Try RIGHT clicking on different areas of the toolbars on Firefox, mainly try right clicking on/around the url bar & forward/back navigation buttons. When you get the correct spot if will give you a menu with the toolbars available (whether or not they're active) and a couple other options. Just uncheck the Yahoo one & you should be all set.
    As you say though it may be some other bar disguised as a yahoo bar. Any chance you can get a screen shot of it & post it here?

  • ClamXav detecting phishing email (can't get rid of them)

    I received an email from my wife that she did not send me. It was an email that made no sense. It just had a bunch of words in a very long document. I assumed that her email program (Mac Mail) must have become infected with something that sent this email out to everyone in her address book. I deleted the email and downloaded ClamXav to check my system and make sure everything is ok.
    Whenever I run ClamXav, it detects 8 files with the following infection name: (Heuristics.Phishing.Email.SpoofedDomain)
    I ask ClamXav to quarantine the files, then I go into that folder and delete them. But if I run a check later, those 8 files are back. I can't get rid of them.
    I'm wondering if they are reinfecting my Mac Mail program via Apple's mail servers. I'm not sure if all my mail messages are kept on Apple's server, and them somehow these malware files get re-downloaded to my computer. I tried to figure out if there is a setting in my mail program that allows me to uncheck a box that says, "save mail files on server".....but I can't find any such setting. I thought I remember seeing something like that in the past.
    Does anyone have any idea what is causing my computer to be continuously reinfected and what I should do about it? I don't notice any problems with my computer, but obviously these files that I can't permanently delete has me worried.

    Randall Olson1 wrote:
    Whenever I run ClamXav, it detects 8 files with the following infection name: (Heuristics.Phishing.Email.SpoofedDomain)
    I ask ClamXav to quarantine the files, then I go into that folder and delete them. But if I run a check later, those 8 files are back. I can't get rid of them.
    First, I would encourage you to come to the ClamXav Forum to more quickly and efficiently answer questions such as this.
    My standard guidance for handling reported e-mail infection is as follows (pay particular attention to #6):
    Never use ClamXav (or any other A-V software) to move (quarantine) or delete e-mail. It will corrupt the mailbox index which could cause loss of other e-mail and other issues with functions such as searching. It may also leave the original e-mail on your ISP's e-mail server and will be re-downloaded to your hard drive the next time you check for new mail.
    So, if you choose to "Scan e-mail content for malware and phishing" in the General Preferences, make sure you do not elect to either Quarantine or Delete infected files.
    When possibly infected e-mail files are found:
    Right-click/Control-click on either the infection or file name in the ClamXav window.
    Select "Reveal In Finder" from the pop-up menu.
    When the window opens, double-click on the file to open the message in your e-mail client application.
    Read the message and if you agree that it is junk/spam/phishing then use the e-mail client's delete button to delete it (this is especially important when the word "Heuristics" appears in the infection name).
    If you disagree and choose to retain the message, return to ClamXav and choose "Exclude From Future Scans" from the pop-up menu.
    If this is a g-mail account and those messages continue to show up after you have deleted them in the above manner, you may need to log in to webmail using your browser, go to the "All Mail" folder, find the message(s) and use the delete button there to permanently delete them from the server.
    To fix corrupted mailbox index(es), highlight each one that was corrupted and choose Rebuild from the appropriate menu.

Maybe you are looking for

  • How do you clear an SSL State in a Firefox version 20 web browser?

    When browsing PKI-enabled websites, the session will timeout so ofter. To re-enable your session in Internet Explorer your Clear SSL state by going to Tools>Internet Options>Content(tab)>Clear SSL State. When this option is used, I use my Common Acce

  • Migrating production oracle 9.2.0.6 datawarehouse from HP to Solaris

    Hi, I am planning to move my production data warehouse(oracle 9.2.0.6) with size 600GB from Hp to Solaris.Could you please help me figure out the steps.

  • 1 year old Z30 keeps freezing

    I have had my phone for a year without a problem. The last few weeks my freezes at random points in the day without warning. Any ideas why this has started? I have completely wiped the phone and restart it once a week. It's incredibly infuriating whe

  • Urgent!!! 5.0.1 Still Won't Start

    I upgraded from iTunes 4.9 to 5.0.1, and like many others in the group, it simply won't start. I do have digidesign software, but I did all the latest upgrades. I followed the instructions for the reinstall, but had to use the following variations. M

  • ESS user Authorzation

    Hai Gurus I have assigned the standard Composite role(ZSAP_EMPLOYEE_ERP) of ESS to a user.But if he logs on to his ECC, he is able to create and view the data of the selected infotypes assigned in the role.But i want restrict his permission to view a