JFrame opening multiple times - strange bug

Hi there
I'm having this problem whereby a window (a JFrame) is opened multiple times - it works as follows:
- I've got one JFrame which is opened via a button in my main JFrame (I'll call it JFrame 1)
- A second one is opened from within the first in a similar way (JFrame 2)
- The first time one opens JFrame 1 one can open and close JFrame 2 fine as many times as one wants
- But when one closes JFrame 1 (this with JFrame 2 closed) and then reopens it (JFrame 1) and then clicks the button to open JFrame 2, JFrame 2 then opens twice - except one of them contains no components while the other contains everything it is meant to
- The same thing happens as many times as I close JFrame 1 - except that when it is closed again JFrame 2 opens 3 times, then 4 and so on
This is what I have for JFrame 1 (the actionlistener in the main window just calls showDebateRound(int roundID):
public void showDebateRound(int roundID) {
        JFrame roundWindow=new JFrame("Round Draw");
        roundWindow.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        showRoundTitle.setFont(new java.awt.Font("Dialog", 1, 18));
        showRoundText.setColumns(20);
        showRoundText.setEditable(false);
        showRoundText.setRows(5);
        showRoundScroller.setViewportView(showRoundText);
        //showRoundPrint.setEnabled(false);
        //work out the title
        showRoundTitle.setText("Round: "+getRoundTitle(roundID));
        //work out the draw output
        showRoundTexts = "Motion: "+round[roundID].getMotion()+"\n\n";
        for (int i=0;i<debateCount;i++) {
            if (debate.getRoundID()==roundID) {
showRoundTexts=showRoundTexts+"Prop: "+team[debate[i].getTeamOneID()].getTeamName()+"\nOpp: "+team[debate[i].getTeamTwoID()].getTeamName()+"\n\n";
showRoundText.setText(showRoundTexts);
//layout
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(roundWindow.getContentPane());
roundWindow.getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(showRoundScroller, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(showRoundTitle)
.addComponent(showRoundDrawLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 78, Short.MAX_VALUE)
.addComponent(showRoundPrint)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ShowRoundEnterResults)))
.addContainerGap())
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(showRoundTitle)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(showRoundDrawLabel))
.addGroup(layout.createSequentialGroup()
.addGap(31, 31, 31)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ShowRoundEnterResults)
.addComponent(showRoundPrint))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(showRoundScroller, javax.swing.GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE)
.addContainerGap())
roundWindow.pack();
roundWindow.setVisible(true);
//debate round only actionlisteners
ShowRoundEnterResults.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
enterResults();
}JFrame 2 is constructed in the same way as JFrame 1
Does anyone have any idea why this could be happening? I can post more code if need be. Thanks.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

hiding the form is probably more efficient than creating a new one each timeI rather think OP's both hiding the form and creating a new one each time.
I would really like to know why it is not workingYeah, so would I.But where's the code that brings up the second JFrame? the actionListener.actionPerformed of the button that opens it?
Better still, post a SSCCE limited to the minimum code that shows the problem.
{color:#0000ff}http://homepage1.nifty.com/algafield/sscce.html{color}
db

Similar Messages

  • Photoshop is opening multiple times...WHY??? (please help).

    When I double click on an image (from Bridge for example) to open in Photoshop it will open up CS6 and then sometimes when I open another image, instead of opening up in the same open Photoshop program, it will open up an additional Photoshop program.  Both CS6, Version 13.0.6 x64.  Super frustrating when sitting with a client and trying to add an image to a document and it opens up in a different program...   Is there a way to see where Photoshop is opening from?  Why would CS6 be opening multiple times???
    I don't think I noticed this happening before I upgraded to Mavericks (yes, this has been happening for a while).  I also have a back-up program called SuperDuper that mirrors my system on a separate hard drive.  Could Photoshop be opening from there, too?
    Thanks for any possible help!
    Deron

    Use Lion Recovery to reinstall the Mac OS X.

  • Dps file automatically opening multiple times when working on another file in the same folio?

    dps file automatically opening multiple times when working on another file in the same folio? Can anybody please help

    Can you try resetting your preferences first and see if that helps - see Troubleshooting 101: Replace, or "trash" your InDesign preferences

  • The finder is opening multiple times 30  as well as creating 40 to 50 files at random while reading mail.

    The finder will open multiple times 30 plus as well as create 40+ blank file folders on the desktop at random. Please help!

    Use Lion Recovery to reinstall the Mac OS X.

  • Same file opening multiple times

    When I open a folio file in DPS, it opens the same file 100 times. I've tried reinstalling and force quitting InDesign but every time I reopen InDesign the file keeps opening multiple times. What can I do to stop this?

    There are hyperlinks on all of the folio pages. I'm using InDesign CC and the error starts when I open the Folio Overlays panel. This panel is no longer included in the Digital Publishing interface.

  • Outlook opens multiple times

    Outlook opens multiple times on my macbook pro.   How can I get this to stop?

    Problems such as this are normally caused by javascript, so I can only suggest that you check your javascript code, especially those associated with the onLoad event.
    PZ

  • Same file opening multiple times in indesign cc

    Hi - I'm getting the same file opening multiple (20-30 times)
    try closing and it just keeps opening new copies
    Have to force quit in the end
    Any idea's

    Hi Rob
    Thanks for getting back
    From what I can see there are no links to other documents.
    I often copy and paste elements like images from one document to the next
    The multiple files that open - open as 'Untitled' indesign docs - almost like they're new documents or from a template.
    They open very rapidly - around 10-20 - if you try to close them sometimes new ones open. This often repeats
    I have to force quit indesign.
    It doesn't happen all the time - so I think it may be to do with links somewhere along the line.
    I've noticed when I work on DPS indesign docs - they often open the original 'source' for print design docs in the same way. The same multiple file opening of the same doc happens
    Let me know if I should look anywhere in particular - I'll try and repeat the glitch and get more info
    Many Thanks

  • Same document opening multiple times.

    When I double click a file that is already open in my files
    browser it opens an instance of that document again.
    So I can have the same document open numerous times. I am
    just on a new system and have the update also installed.
    Anybody that can help me out?

    bump

  • Template opens multiple times in Firefox

    Help!
    I made a template in Dreamweaver CS4 on Mac os10.4.11.  When I preview the page in Firefox 3.0 it opens multiple blank pages and only stops adding pages when I quit.
    The template opens correctly in Safari.
    How do I make it stop?
    Thank you
    Ann

    Problems such as this are normally caused by javascript, so I can only suggest that you check your javascript code, especially those associated with the onLoad event.
    PZ

  • File opening multiple times in a book

    Hello.
    Something has gone crazy in indesign for me. Not sure if its the recent update.
    In osx if you open a book and double clikc one of the files, it opens, if you double click it again, it opens another copy, changes made in one reflect in the other. If you make lots of changes to the first document then open it again by accident it overwrites all the changes you made.
    I can open many multiples of the same document and its totally confusing me!
    Anyone else spotting this bug?

    Hi Rob
    Thanks for getting back
    From what I can see there are no links to other documents.
    I often copy and paste elements like images from one document to the next
    The multiple files that open - open as 'Untitled' indesign docs - almost like they're new documents or from a template.
    They open very rapidly - around 10-20 - if you try to close them sometimes new ones open. This often repeats
    I have to force quit indesign.
    It doesn't happen all the time - so I think it may be to do with links somewhere along the line.
    I've noticed when I work on DPS indesign docs - they often open the original 'source' for print design docs in the same way. The same multiple file opening of the same doc happens
    Let me know if I should look anywhere in particular - I'll try and repeat the glitch and get more info
    Many Thanks

  • JSAM opening multiple times

    HI,
    Currently we are running Juniper 6.5 I have no problems logging into Juniper and starting any Citrix applications, but every time a new app starts a new secure manager starts. So if I have 5 Citrix apps running I have 5 JSAM's running as well. Im not sure if this could be a configuration issue on the Juniper box or on the MAC. I am also going to have our admins give Juniper a call to see if they have an answer's. Any ideas would be appreciated.
    Thanks
    Tony

    hiding the form is probably more efficient than creating a new one each timeI rather think OP's both hiding the form and creating a new one each time.
    I would really like to know why it is not workingYeah, so would I.But where's the code that brings up the second JFrame? the actionListener.actionPerformed of the button that opens it?
    Better still, post a SSCCE limited to the minimum code that shows the problem.
    {color:#0000ff}http://homepage1.nifty.com/algafield/sscce.html{color}
    db

  • Office Documents are able to open multiple times

    I have a few users who can open Microsoft Office documents more than once.   The warning prompt to the user to alert them that opening the document the second time will cause changes to be disregarded does not pop up or warn the user.  
    Once the document is open, the 1st document can not be saved even if it has changes and saving the 2nd document will overwrite the 1st document.
    Why is this standard warning message not working?  Any ideas?

    I'm not familiar with this particular message, just spitballing here..
    What's the scale of the message not appearing? By that I mean, is it possible the few that are experiencing this have already selected the typical "Do not show this again" box? (I'm not even sure that is an option, just putting the idea out there).
    Also, when this box is supposed to pop up, are there any errors in the browser window, or something that might be blocking it?
    EDIT - Nevermind.. After messing with it myself I realize that the error is from Office, not the browser, and indeed does not have the option of not showing again. Back to the drawing board!

  • Mail and Safari are opening multiple times

    Help! I am getting two open icons, two instantiations, and actually two open sets of windows in different safari at the same time. When you command tab you see two of each icon for them. What causes this, and how do I stop it from happening? It just started a few days ago. (on macmini 10.6.6)
    Thanks!

    Looks like it is fixed. My version of iKey had imported the same set of macros, so every time mail was launched, it launched twice. Oy vey!

  • Boingo certification page opens multiple times when I open Safari and how can I delete?

    When I was at Detroit Delta airport lounge, I got on their wifi. A boingo message corrupted something and now appears each time I open Safari. dtw-macboingohotspot.net is the page that opens.  Thank you.

    Hi...
    Open System Preferences > General
    Deselect:  Restore windows when quitting and re-opening apps
    Restart your Mac.

  • Firefox opens multiple times (many windows) when click once, even after a reinstall in Windows 7.

    There really isn't much more to say, except that the situation occurs even after restarts.

    The cause is most likely the preferences file in your profile folder. That file contains your personal settings, so it doesn't get deleted when you reinstall/update Firefox. The reset feature also retains your preferences file.
    Instead of doing a mass delete of all your settings, you can try identify the culprits and reset them individually.
    # In the [[Awesome Bar - Find your bookmarks, history and tabs when you type in the address bar|Location bar]], type '''about:config''' and press '''Enter'''. The about:config "''This might void your warranty!''" warning page may appear.
    # Click '''I'll be careful, I promise!''', to continue to the about:config page.
    # Click on the '''Status''' column, to sort your preferences by status, and group all the ''user set'' preferences together. They should appear in bold.
    # If you see any preference that look suspicious, just '''right-click''' on it, and select '''Reset'''.
    If you're still not sure which ones to reset, you can post most of them here easily. Go to '''Help > Troubleshooting Information''' then click '''Copy text to Clipboard'''. Open a reply to this post, and go to '''Edit > Paste''' to paste the info from your Troubleshooting Information page.

Maybe you are looking for

  • Can not open JPEG files and can not create JPEG files from other software

    Can not open JPEG files and can not create JPEG files from other software (For example from Solidworks). When I try to right click on a JPEG, a notice window appears written: "Windows Explorer has stopped working - Windows is checking for a solution

  • Error whlle translating Amount into Arabic

    Hi, I designed SAP SCRIPT for Automatic Payment Transactions (F110). this transaction is using standrd driver program RFFOD__T. When Im executing into arabic i get the error Entry AR H 3 in table T015Z does not have a delimiter (;). I have already Ch

  • Problems with NVL in sql plus

    Hello. I get error message when i use NVL function in sql statement. Example: select something from table1, table2 where table1.id = table2.t1_id and NVL(table1.temp,1) I get:ORA-00920: invalid relational operator

  • Dynamic Form field name

    I have a shopping cart that creates a dynamic field for the quantity of each product in the cart. I need to be able to make sure the user does not submit a blank value. I can not use cfinput as per client instructions. The field is: <input name="Quan

  • My iphone donot appear the name of the caller although the caller name saved on my mobile

    my iphone donot appear the name of the caller although the caller name saved on my mobile if i save any number with its name.......when its number call me the name donot appear