Changing a JPanel, remove () - add () - validate () only works once

I have a JPanel with several JTextFields. When the user clicks a button, I need to replace it with a different JPanel. I only have two of these JPanels so far, but will add more later. Both of my JPanel objects are singletons; they are created the first time they are used and every time after that the object returns the same instance. I am using the following code to swap from one JPanel to another (the variable dialog is the containing JPanel).
dialog.remove (0);
dialog.add (otherPanel, 0);
dialog.validate ();This works fine, but only the first time. If I continue clicking the button to tell it to swap back and forth, the second panel remains displayed. I have a feeling this has something to do with me using singleton JPanels because after they have both displayed once it stops working, but I can't figure out why it would matter that they are singletons. If you remove a component, can you add that same component back again later? Is there something else I could be missing?

If you can't use a CardLayout, then the general format of your code should be:
panel.remove(...);
panel.add(...);
panel.revalidate();
panel.repaint();If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
http://homepage1.nifty.com/algafield/sscce.html
Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
http://forum.java.sun.com/help.jspa?sec=formatting
Better late than never :)
Edited by: camickr on Feb 24, 2008 12:22 AM

Similar Messages

  • Event only works once

    Hi all!
       I'm trying to do a movieclip that has 2 buttons that change the content of a flvplayer.
       The problem is that the buttons only work once, after that the event listener isn't triggered (I think) I have no removeEventListener in my code for those events so I'm totally lost as to why is this happening.
       My code is this:
    stop();
    var correr:Boolean = true;
    Globals.vars.videoP = CM_player;
    SnowManInst.addEventListener(MouseEvent.MOUSE_DOWN, mudarVideo_SM);
    bananaKingInst.addEventListener(MouseEvent.MOUSE_DOWN, mudarVideo_BK);
    addEventListener(MouseEvent.MOUSE_DOWN, pararFilme);
    function pararFilme(e1:MouseEvent){
        trace("pararFilme "+Globals.vars.videoP);
        Globals.vars.videoP.stop();
        correr = false;
        removeEventListener(MouseEvent.MOUSE_DOWN, pararFilme);
        addEventListener(MouseEvent.MOUSE_DOWN, correrFilme);
    function correrFilme(e1:MouseEvent){
        trace("correrFilme");
        Globals.vars.videoP.play();
        correr = true;
        removeEventListener(MouseEvent.MOUSE_DOWN, correrFilme);
        addEventListener(MouseEvent.MOUSE_DOWN, pararFilme);
    function mudarVideo_BK(e1:MouseEvent){
        trace("mudar video BK");
        Globals.vars.videoP.stop();   
        gotoAndStop(2);
    function mudarVideo_SM(e1:MouseEvent){
        trace("mudarVideo_SM");
        Globals.vars.videoP.stop();   
        gotoAndStop(3);
    Any help would be greatly appreciated.

    it's not clear what you're trying to accomplish with that code but there are a few reasons that might fail.
    to starty, you should understand that first a button event is dispatched, then a main timeline event is dispatched (and the main timeline listener toggles between two listener functions) and finally you go to a different frame and any code in the other frame is executed.
    so, that's a pretty screwy setup.  you should remove the main timeline listeners and their functions and it's not clear you need to direct the main timeline to another frame.

  • Command Windows.open only works once

    Hi all,
    Iu2019m using javascript command window.open to open a new browser window from a html link webui and is working fine.
    The issue I have is this only works once. If you close the window that you had opened, and click again in the link it doesnu2019t work. It only works if you call another link before. It seems there is a kind of cache in somewhere.
    Do you have any idea?
    Thanks in advance.
    Fernando.-

    Fernando,
      Change ur mywindow name every time.Kindly go through following code. 
    CALL FUNCTION 'GENERAL_GET_RANDOM_STRING'
      EXPORTING
      number_chars        = 3
      IMPORTING
      RANDOM_STRING       = mywindow
    var lr_window;
    lr_window = window.open("<%= lv_id%>","<%= mywindow%>","resizable=1,width=1100,height=674,fullscreen=yes");
    if (window.focus)
    {lr_window.focus()}
    lr_window.moveTo(0, 0);
    <%
      clear lv_id.
    %>
    <%-- delete lv_window; --%>
    <%-- mywindow.close(); --%>
    <%
      endif.

  • JCOM only works once

    I have a web application that was originally developed using J-Integra
    1.5.3 -- it works great in tomcat 4.1, and the classes themselves can
    also be tested/exercised outside of tomcat, where they work perfectly
    as well.
    Now that the application is mostly finished with development, we want
    to deploy this to our BEA Weblogic 8.1 servers. The problem
    is that, after turning on JCOM, and removing the external jintegra
    jars (using only the weblogic versions now), I can get the app to
    work properly exactly once after startup. That is, I can start
    Weblogic, load the JSP page I use as a tester in my browser, and it
    works as it should. If I hit the refresh button, I get a
    RuntimeException like this:
    java.lang.RuntimeException:
         at com.linar.jintegra.StdObjRef.invoke(StdObjRef.java:55)
         at com.linar.jintegra.Dispatch.vtblInvoke(Dispatch.java:763)
         at jsp_servlet.__index._jspService(__index.java:181)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
         at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:1053)
         at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :387)
         at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :305)
         at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:6291)
         at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:317)
         at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
         at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3575)
         at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2573)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
    I also see this in my weblogic logs:
    <Jul 8, 2003 2:14:05 PM EDT> <Error> <COM> <BEA-210000> <100680] *: >
    and thats all the information I get.. I have tried to crank up the
    jintegra logging as high as I can (using both "
    com.linar.jintegra.Log.logImmediately(3, "c:\\temp\\jintegra.log");
    " in the constructor, and by supplying
    "-DJINTEGRA_LOG_FILE="c:\temp\jintegra2.log" -DJINTEGRA_LOG_LEVEL=3"
    on the startup line for weblogic, but gotten only as far as
    c:\temp\jintegra.log being created.. no contents in it, and
    jintegra2.log (the one created from the command line) isnt created at all.
    so, I am at a loss... it does work once, and I absolutely no
    information as to why it fails after that first time. Any ideas would
    be appreciated. thanks.

    not sure exactly why it would only work once, but I
    personally dont like using a listener for simple button actions.
    If it were me, i would just use standard button actions and
    make the caption fade in and out with an alpha tween.

  • Pinch zoom-in/out only works once in Safai

    Outside of Safari, the pinch gesture works normally. In Preview it will zoom in or out as deep as I need. But when I try and use the gesture in Safari, it will only work once until I 'CMD' + '0' or click "Actual Size" in the View tab. It doesn't zoom on a gradient either. Pinch-open is the equivalent of 'CMD' + '+' and pinch-close is the the equivalent of 'CMD' + '-'. After I make the gesture once, I can pinch all I want and nothing happens. I need to revert the page to its original size for the gesture to work again (still only once).
    I have an i7 Macbook Pro running 10.6.8. Can anybody help me out?

    Sorry, I didnt do a good enough job explaining my issue/bug above. I can't attach a screen shot becuase of where I work and what this content is so I will do the best I can explaining it in text.
    I have a row of buttons created in InDesign that have no effects, no rollovers and lets just call them Apple In, Apple Out, Orange In, Orange Out, Banana In, Banana Out, etc.
    The Apple In button invokes an animation called Apple Fade In. Apple Out simply fades out the content animation. All of the other buttons function the same way. In my exported .swf I can click Apple In and I get my content as expected, I click Apple Out and away it goes. All other buttons work the same way, as expected. If I go through all my fruit and now I want to go back and display the Apples again. I click Apple In and NOTHING happens! If I click Apple Out the fade out animation works just fine, as many times as I want to click it, I get a flash of the content and it fades right out. The "In" buttons no longer work for any of the fruit after the initial "In" animation plays.
    In the Animation Panel I have the animations set to Play Once and Dont Hide. In the Layers Panel I have a layer called Apple Fade. In that Layer Group/Set I have Apple Fade Hack which consists of a native ID square no stroke and no fill grouped with my Apple content on "the stage." Also in that Layer Group/ Set is a collection of bitmap images, text, and vectors called Apple. I created the content first on a layer Apple, when I created the group with the blank square ID bumped the original content group under the parent layer and added another sub-layer called Apple Fade Hack. These two are indented and under the top level Apple Layer. I could probably get away with attaching a screen shot of the timing, layer, and animation panels if I had to.
    Thanks

  • Help! My iMessage doesn't work on my new iPhone 5s, I've changed my sim twice, but iMessage only works with my Apple ID.

    Recently got a new iPhone 5s and the iMessage doesn't work. I tried the sim in another phone and it didn't work either so I put a completely new sim in my iPhone and iMessage doesn't work. It will only work when I use my Apple ID for received messages. I don't know what to do. I have reset everything and it still doesn't work. My software is up to date. Please help!

    ACTIVATING FACETIME AND IMESSAGES
    Activating Facetime and Imessages on your phone requires the ability to send SMS messages and depending upon where you are that might be an international SMS.  Check with your carrier to see if your plan supports sending of international SMS messages.  If you are having trouble activating Facetime or Imessages turn them both off on your device and reset the device (Hold down the Sleep/Wake button and the home button together until the apple logo appears (ignore the ON/OFF slider) then let both buttons go and wait for device to restart (no data will be lost)).  Wait for the device to restart and wait a minute and turn Facetime and imessage back on and wait for activation.  If that does not fix things read the following articles:
    http://support.apple.com/kb/TS4268
    http://support.apple.com/kb/ts3367

  • HTTP GET only works once

    Web UI Builder:
    I have a device that responds to HTTP GET messages.
    I made a simple vi that uses the HTTP GET String function connected to a string constant and WireShark to monitor Ethernet traffic.
    When the vi is first run an HTTP message is sent and replied to.
    If the vi is run again the message is not transmitted.
    If the HTTP GET message is changed the new message will be transmitted. But not twice.
    If LabVIEW Web UI Builder is closed and restarted the message will again be sent just once when run.
    Why is the message only being sent once? It's like all outgoing messages are being tracked and only sent once.

    I think this is standard (but not always desirable) behavior of the networking stack that Web UI Builder uses. (On Windows, it's basically the built in/  Internet Explorer networking stack). After the first GET request with the same URL, if the server doesn't send no-cache headers, a cached result will be returned.
    If you control the server that you're connecting to (and can add HTTP headers), try adding a no-cache header to the GET response. ("Cache-Control: no-cache" is the first one I'd try).
    If you don't control the server you're connecting to / that doesn't work, another workaround is to append a query string parameter with a random number or timestamp. With this approach, the GET URL is always changing, so the caching behavior is disabled and the request should always go to the server.
    (Something like this appended to the end of the URL:
    or, "&n=[timeInTicks]" if you're already using other query parameters)

  • Spry Tab link only works once... why?

    Hi all,
    I have a spry tabbed area with 4 tabs on my page. Each tab contains data that is dragged from an MSAccess table. A couple of the tabs have repeat regions. This all works fine.  One of my tabs has a repeat region where I can click on a button image to change a record status from True to False (or visa versa). The click runs the associated vbscript which executes the SQL update statement no problem. However I noticed that when I changed the data on this tab and reloaded the page using a Response.redirect after the sql update was executed, it would default to the 1st tab and not the one I was viewing that contains the repeat region. A quick search led me to the SpryURLUtils.js file which solved that problem by allowing me to specify which tab to load. I appended the relevant code to give me this:
    Response.Redirect("myrecord.asp?" & Request.QueryString & "&tab=1#TabbedPanels1"
    As I mentioned, the tab contains a repeat region. If I click on a button to change the status of that record the page reloads fine and displays the correct tab. But this only happens once... each subsequent time I try to change another record my tab contents disappear. The tabs are still visible and if I click on the tab where I've changed the data the tab content is dispalayed, but obvioulsy this isn't right... it should reload and display the correct tab with each call of the code.If I navigate away from this page and then come back to it I can successfully chnage one record and the results are displayed. Change another record and the changes are made, but the tab contents are not displayed again. The interesting thing is that if I reload/refresh the page the problem occurs staright away on the first record change.
    So my question is 2-fold... Why is this happening and how do I solve the problem?
    Here is the vbscript that updates the record and  does the Response.redirect
    <%
    'Change Notification
    If (CStr(Request("ToggleNotify")) = "ToggleNotify") Then
    dim strSQL
    'check to see if notification is currently true or false
        If cstr(Request.Form("NotifyChanges")) = Cstr("True") Then
        'change notifiaction to false
            strSQL = "UPDATE tblUserAccess SET NotifyChanges=0 WHERE AccessID = " & Request.Form("hiddenAccessID")
        else
            strSQL = "UPDATE tblUserAccess SET NotifyChanges=-1 WHERE AccessID = " & Request.Form("hiddenAccessID")
        end if
        Set MM_editCmd = Server.CreateObject ("ADODB.Command")
        MM_editCmd.ActiveConnection = MM_VBUsers_STRING
        MM_editCmd.CommandText = strSQL
        MM_editCmd.Execute
        MM_editCmd.ActiveConnection.Close
        Response.Redirect("myrecord.asp?" & Request.QueryString & "&tab=1#TabbedPanels1" )
    End If
    %>
    Here is my Repeat region with the associated form
    <%
    While ((Repeat3__numRows <> 0) AND (NOT rsAccessRights.EOF))
    %>
    <form name="frmNotifications" method="post" action="">
      <tr class="PageText">
        <td width="200"><%=(rsAccessRights.Fields.Item("SectionTitle").Value)%>
            <input type="hidden" name="hiddenAccessID" id="hiddenField2" value="<%=(rsAccessRights.Fields.Item("AccessID").Value)%>">
        </td>
        <td width="200">
                    <%If (CStr((rsAccessRights.Fields.Item("NotifyChanges").Value)) = CStr("True")) Then %>
              <input type="image" src="../sitegraphics/accept.png" alt="Submit button">
            <%else%>
              <input type="image" src="../sitegraphics/cross.png" alt="Submit button">
            <%end if%>
        <input type="hidden" name="ToggleNotify" value="ToggleNotify">
        <input type="hidden" name="NotifyChanges" id="test" value="<%=cstr((rsAccessRights.Fields.Item("NotifyChanges").Value))%>">
       </td>
    </tr>
    </form>
      <%
      Repeat3__index=Repeat3__index+1
      Repeat3__numRows=Repeat3__numRows-1
      rsAccessRights.MoveNext()
    Wend
    %>
    And here is the bit at the bottom that specifies the default tab if nothing is passed in the URL
    <script type="text/javascript">
    <!--
    var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1", {defaultTab: params.tab ? params.tab : 0});
    //-->
    </script>
    Sorry for the long post!
    This is my first dabble with Spry stuff, so I'm a bit green. If anyone can explain to me why this is happening that would be most apopreciated. If anyone can tell me how to solve the problem I'll send them a big e-kiss!
    Not sure how impotant this is but it happens in both Firefox and IE8.
    Thanks in advance
    Dan

    Hi Ben, thanks for taking the time to read my query.
    The site in question is an intranet site, so I am unable to give you a link to the page. Would the entire page of code rather than just the odd bits help?
    Cheers
    Dan

  • Canon MF4270 Scanning Function only works once

    After my upgrading to 8.1 my canon MF4270 scanning function will only work one time when it is installed. Any subsequent boot (cold or warm) and it fails to work.  The software (canon toolbox or windows scan) will just hang indefinitely.  Sometimes
    I get an error msg, sometimes I do not.
    1. Have the latest driver from the Canon website
    2.  Tried reinstalling the driver several times
    3.  Tried the Windows scan utility
    4.  Tried different USB ports.
    5.  When I do get an error msg it is usually a "USB device is not recognized"
    6.  In Device Manager>Universal Serial Bus controllers>Unknown USB Device (Device Descriptor Request Failed
    7.  When I call up the properties for the yellow triangled usb device, event tab in the scrollable window:
    Device USB\VID_0000&PID_0002\5&e658374&0&9 was configured.
    Driver Name: usb.inf
    Class Guid: {36FC9E60-C465-11CF-8056-444553540000}
    Driver Date: 06/21/2006
    Driver Version: 6.3.9600.16442
    Driver Provider: Microsoft
    Driver Section: BADDEVICE.Dev.NT
    Driver Rank: 0xFF0000
    Matching Device Id: USB\DEVICE_DESCRIPTOR_FAILURE
    Outranked Drivers: usb.inf:USB\DEVICE_DESCRIPTOR_FAILURE:00FF2000
    Device Updated: false
    8.  Also received a "
    Windows has stopped this device because it has reported problems. (Code 43)
    A request for the USB device descriptor failed."
    9.  Canon tech support stated it was an MS WIA service issue and not there problem.
    10.  Also tried compatibility routine.
    We run a paperless office so this is pretty huge.  Need your expertise. 
    Thank You!
    * * * UPDATE:  The above discussion was with the MFC4270 fully powered or in energy savings mode and PC fully powered.  Any reboot of the PC would result in no scanner.  Tried turning off the MFC, reboot the PC, then turn on the scanner,  and
    the scanner worked just fine.  A subsequent reboot with MFC remaining on would fail the scanner.  Any reboot with MFC off, then turned on after booting would work.
    So something amiss with driver and/or USB.

    Hi,
    Code 43 means that a device driver notified the operating system that the device failed, this circumstance can occur if the device hardware fails or if the device driver fails.
    To resolve this problem, take the following steps:
    1. To open Device Manager, click Start, click Search programs and files, and then type Device Manager. A list of available matching items appears above the search box; click Device Manager.
    2. Locate the malfunctioning device in the list of devices, right-click the device, and then click Uninstall. When a warning message appears that you are uninstalling a device from your system, click OK. Device manager uninstalls the device.
    3. Right-click your computer name in Device Manager and click Scan for hardware changes. Device manager scans your system and automatically reinstalls your device.
    4. Right-click the device and click Properties. On the General tab of the device Properties dialog box, in Device status, you should see the message This device is working properly.
    For more troubleshooting steps you can find it here:
    http://technet.microsoft.com/en-us/library/cc725873(v=ws.10).aspx
    Regards
    Wade Liu
    TechNet Community Support

  • Quick Find only works once in a Firefox session

    Suddenly, "Quick Find" only works the first time I type in a Firefox session. From the second time onward, the Quick Find bar no more appears. I tried clicking on the "/" key, but no good.
    I have tried un-check and then check again the "Seacrh for text when I start typing" option. But no good, either.
    How can I get it fixed?

    Have you seen
    * [[searching within a page#w_quick-find]]_quick-find
    Try using the single colon ' instead of the slash /
    I also note you may still be on Firefox 9, so it may be worth updating to the current firefox 11. <br/>There is also an old article
    * [[quick find bar opens when typing in text fields]]
    Try Firefox in [[safe mode]]
    * no need to make changes in the first window just click on continue.
    * if problms continue then whilst in safe mode also ensure you are only using the defult theme, and disable all plugins.

  • CallResponder CREATE only work once

    Hi all!
    Im using Flash Builder 4 to create a new project. Im really happy with the new connection methods, but Im getting an issue really strange. When i create a new service call that include data in my base, it only works on the first time! When i try to include another value, it simply dont work. I dont receive any error message, alert.... nothing. Is there anybody that had this problem? any idea to fix it?
    Explaining the issue in example: I create a Employee service. I generated the employee form, and associated it with the CreateEmployee service. I fill the form with the employee data, and submit. It include the data on my database correctly, but when i try to input another data, the button just dont work. I have to refresh the page to it work again. I tryed to find some answer on the web, but until now i didnt find it. I know that FB4 has been released very recently, so we dont have already a huge knolegment on it.
    Thanks,
    Williams

    Hi,
    I haven't worked a lot with the data wizards but one thing I notice is when you set a form to create a record it will produce a very standard template that uses a valueobject of 'name'. Now on the assumption that you have a new record you wish to enter, the first step is not to try and edit any automatically generated primary keys
    i.e. a mysql table
      ID = int (autoincrement) primary key
      Surname = varchar(25)
      Name = varchar(25)
      DOB = date; 
    the form template would offer all these fields for updating/creating) - so delete the ID option as you don't want to touch that
    Next with the value object once its populated it would possibly update the existing record rather than create a new one so when you enter your create option reseting the value object would be a good idea -  names = new Names(); this gives you a clear object for the create record process.
    Last thing, if you are displaying the records in a grid you would refetch the records in an eventlistener for the createrecord function.
    If you would like a test case for this let me know and i'll put something together.
    David

  • Why does search engine drop down menu only works once?

    I'm quite happy with the new Safari 4 (first time user) but I'm frustrated by only being able to select once with my mouse from the 'Recent Searches' drop down window.
    Let me explain. After I launch Safari 4, I'm able to use my mouse and select one of the recent searches in the drop down menu in the normal fashion - go to an item on the menu and press the LH mouse button.
    However, after I've done this once, I can't do it again. When I select an item from the list and click my LH mouse button, the search window goes blank. The previous Google search results stay the same. If I highlight an item from the drop down menu and press the Enter key on the keyboard, it works fine. A mystery!
    The funny part is that it works fine on my other laptop.
    I've unistalled and reinstalled twice but with no success. When I do reinstall, my previous preferences/settings are still there. Where's the preference file so I can delete it? Don't know, but this might help my problem.
    Anyone else seen this problem?
    Regards
    John

    Hi mach37, can you delete the Vosteran search engine by highlighting it on the Search panel of the Options dialog and using the Remove button?
    ''If it comes back:'' I would suspect a bad add-on. Here's my suggested procedure for tracking down and cleaning those up:
    (1) Open the Windows '''Control Panel''', Uninstall a Program (on XP: Add/Remove Programs). After the list loads, click the "Installed on" column heading to group the infections, I mean, additions, by date. This can help in smoking out undisclosed bundle items that snuck in with some software you agreed to install. Take out as much trash as possible here.
    (2) Open Firefox's '''Add-ons page''' using either:
    * Ctrl+Shift+a
    * "3-bar" menu button (or Tools menu) > Add-ons
    In the left column, click '''Plugins'''. Set nonessential and unrecognized plugins to "Never Activate".
    In the left column, click '''Extensions'''. Then, if in doubt, disable (or Remove, if possible) unrecognized and unwanted extensions.
    Often a link will appear above at least one disabled extension to restart Firefox. You can complete your work on the tab and click one of the links as the last step.
    Any improvement?
    (3) You can search for remaining issues with the '''scanning/cleaning tools''' listed in our support article: [[Troubleshoot Firefox issues caused by malware]]. These on-demand scanners are free and take considerable time to run. If they finish quickly and especially if they require payment, you may have a serious infection. I suggest the specialized forums listed in the article in that case.
    Success?

  • Firefox will not open unless I run it in compatibility mode (Windows XP SP 3), run it as an administrator, or launch it immediately after a reinstall (the reinstall thing only works once.) How do I fix this?

    This morning, Firefox crashed. After this, when I click the Firefox icon, the hourglass appears and then nothing happens. Firefox does briefly appear in the task manager when I do this.
    I tried rebooting. I tried reinstalling multiple times. (Firefox will run when I select "Launch Firefox" from the installer. Then the problem occurs again.) I tried safe mode. I have found that Firefox will work if I select Windows XP compatibility mode from the icon properties menu or if I run the program as an administrator. When I do this, Windows asks me if I want a program to be able to make changes to my computer.
    I have noticed that a Windows Error Report is being generated each time Firefox will not open.

    A possible cause is security software (firewall,anti-virus) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox and the plugin-container from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process and the updater process.
    See:
    *https://support.mozilla.org/kb/Server+not+found
    *https://support.mozilla.org/kb/Firewalls

  • Spry Accordion only works once and doesn't redraw after content update

    Hello,
    I am constructing an Accordion via inner.HTML.  I finally got this to work, HOWEVER, it will only execute correctly once.  When I call "doSpryData" the first time all is well.  When it gets called the second time, the "alerts" fire but the Accordion does not redraw itself and no data is displayed (function doSpryData below).
    I would appreciate any ideas on what I'm doing wrong!!!!
    Thanks and cheers!
    function doSpryData(){
              alert("in spry data!");
              var thisWhat = document.getElementById("searchByWhat").value;
        var currentid = document.getElementById("thisid").value;
              var myStr = "";
              var Acc1 = "";
              Mailings.url = "GetXML1.asp?what="+thisWhat+"&thisid="+currentid;
              Mailings.loadData();
              Mailings1.url = "GetXML2.asp?what="+thisWhat+"&thisid="+currentid;
              Mailings1.loadData();
              if ((thisWhat =="1") || (thisWhat =="2")){
              myStr += "<div id='example1Region' spry:region='Mailings1' >";
                        myStr += "<div id='Acc1' class='Accordion' tabindex='0'>";
                                  myStr += "<div id='Panel1'  class='AccordionPanel'>";
                                            myStr += "<div class='AccordionPanelTab'>{CompanyName} - Info</div>";
                                            myStr += "<div class='AccordionPanelContent'>{CO_Address1}<br>{CO_Address2}<br>{CO_City} <br>{CO_Country}</div></div>";
                        myStr += "<div  class='AccordionPanel'>";
                                  myStr += "<div class='AccordionPanelTab'>{CompanyName} - Trainees</div>";
                                  myStr += "<div class='AccordionPanelContent'>";
                                  myStr += "<table width='969' id='MyResults1' border='0' cellspacing='2' cellpadding='2' >";
                 myStr += "<tr id='thead' height='25' bgcolor='#FFFFFF' '>";
                 myStr += "<th width='20'   class='contactinfo'>Edit</th>";
                myStr += "<th width='20' class='contactinfo' align='center'>Select</th>";
                 myStr += "<th width='170' class='contactinfo' spry:sort='TraineeLastName'>Trainee</th>";
              myStr += "<th width='160' class='contactinfo' align='center'>Title</th>";
                 myStr += "<th width='160' class='contactinfo'>Phone</th>";
                 myStr += "<th width='250' class='contactinfo'>Email </th>";
                 myStr += "<th width='95' class='contactinfo'>Internal Code </th>"; 
                 myStr += "<th width='30' class='contactinfo'>Active</th></tr>";
              myStr += "<tr><td style='padding-bottom:20px;'></td></tr>";
              myStr += "<table class='scrollTable' border='1' cellspacing='2' cellpadding='2' >"
               myStr += "<tr  spry:repeat='Mailings1' spry:setrow='Mailings1' spry:hover='hover' spry:even='even' spry:odd='odd'>";
                myStr += "<td  width='23' align='center'><input name='SelectedProspect' id='SelectedProspect' type='radio' onclick = 'OpeniFrameURL('EditCandidateForm.asp?pid='+{CKeyNew}, 600,800); return false;'></td>";
                myStr += "<td  width='23' class='detail' align='center'><input type='checkbox' name='SelectedOne' id='SelectedOne' value='{CKeyNew}'/></td>";
                myStr += "<td  width='180'class='detail'>{TraineeLastName},  {TraineeFirstName}</td>";
                 myStr += "<td  width='165'class='detail'>{JobTitle}</td>";
                 myStr += "<td  width='160'align='center'  class='detail'>{TR_CellPhone} / {TraineePhoneNumber}</td>";
                myStr += "<td  width='250'class='detail'>{TraineeEmail}</td>";
                myStr += "<td  width='105' class='detail'>{InternalCode}</td>";
                myStr += "<td  width='30' class='detail'>{TraineeActive}</td>";
                myStr += "</tr>";
                myStr += "</table></table>";
                                  myStr += "</div></div>";
              myStr += "</div></div><scr"+"ipt type='text/javascript'>var Acc1 = new Spry.Widget.Accordion('Acc1');Spry.Data.initRegions('example1Region');</"+"script>";
              alert(myStr);
              var div = document.getElementById("mainContent"); 
       div.innerHTML = myStr;
       var x = div.getElementsByTagName("script");
       for(var i=0;i<x.length;i++) 
           eval(x[i].text);
    var observer = { onPostUpdate: function(notifier, data) { alert("post update!");var Acc1 = new Spry.Widget.Accordion('Acc1'); } };
    Spry.Data.Region.addObserver("example1Region", observer);
    /*Spry.Data.initRegions("example1Region");
    Spry.Data.updateAllRegions();*/

    Hello to all,
    I have spent HOURS trying to figure this out....
    I know the above code is messy, but it does correctly do the accordions via innerHTML.  I have a dropdown on my page and when the user changes the input there, I call "doSpryData" and it is supposed to 1) reload XMLDataSet and 2) redraw the Accordion (I would like to have different data displayed on the same page depending on what user selects).  For some reason, it will not redraw the accordion and show the data after it has been done once. 
    I am really desperate so any ideas would be much appreciated!
    Cheers,

  • Input only working once with JTextField

    Hi,
    I've created an GUI with one JTextField, a JTextArea and a JLabel that I use to display an imageIcon. I want the user to be able to input text into the JTextField without having to click on it with the mouse. I've used requestFocus() to do this and it works the first time. I then clear the JTextField using setText(""), so the user can enter more input. After I do this the cursor is still flashing but when I type nothing comes up in the JTextField. I've tried calling requestFocus() after setText() as well but it didn't work either. Does anyone have any ideas?
    Thanks in advance
    JFrame frame = new JFrame("SubjectGUI");
    JPanel pane = new JPanel();
    ImageIcon icon;
    JLabel diagram;
    JTextArea task;
    JTextField textField;
    boolean done = false;
    public SubjectGUI(){
         diagram = new JLabel(icon, JLabel.CENTER);
         icon = new ImageIcon("images/blank.JPEG");
         textField = new JTextField(10);
         task = new JTextArea(new String(""));
         textField.addActionListener(this);
    pane.setLayout(new BorderLayout());
         pane.add(diagram, BorderLayout.NORTH);
         pane.add(task, BorderLayout.CENTER);
         pane.add(textField, BorderLayout.SOUTH);
         task.setEditable(false);
         frame.getContentPane().add(pane);
         frame.pack();
         frame.setVisible(true);
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    public void setTextField(String text){
         textField.setText( setTexttext);
    public void setGraph(String filePath){
         ImageIcon icon = new ImageIcon(filePath);
         diagram.setIcon(icon);
    public void setTask(String taskString){
         task.setText(taskString);
    public void focus(){
         textField.requestFocus();
    public static void main(String args[]){
         SubjectGUI sgui = new SubjectGUI();
         long start = System.currentTimeMillis();
         sgui.focus();
         for(int i=0;i<3;i++){
         if(i==0){
              sgui.setTextField("");
              sgui.setTask("2+2");
              sgui.setGraph("./images/graph1.JPEG");
         if(i==1){
              sgui.setTextField("");
              sgui.setTask("4+4");
              sgui.setGraph("./images/graph2.JPEG");
         // sgui.focus();
         while((System.currentTimeMillis()<start + 10000) && !(sgui.done())){

    Sorry,
    Here is the entire code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class SubjectGUI implements ActionListener{
    JFrame frame = new JFrame("SubjectGUI");
    JPanel pane = new JPanel();
    ImageIcon icon;
    JLabel diagram;
    JTextArea task;
    JTextField textField;
    boolean done = false;
    public SubjectGUI(){
         diagram = new JLabel(icon, JLabel.CENTER);
         icon = new ImageIcon("images/blank.JPEG");
         textField = new JTextField(10);
         task = new JTextArea(new String(""));
         //textField.setActionCommand(this);
         textField.addActionListener(this);
    pane.setLayout(new BorderLayout());
         pane.add(diagram, BorderLayout.NORTH);
         pane.add(task, BorderLayout.CENTER);
         pane.add(textField, BorderLayout.SOUTH);
         task.setEditable(false);
         textField.setMinimumSize(new Dimension(200,400));
         task.setMinimumSize(new Dimension(200,400));
         diagram.setMinimumSize(new Dimension(200,400));
         pane.setPreferredSize(new Dimension(200,400));
         frame.getContentPane().add(pane);
         frame.pack();
         frame.setVisible(true);
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    public void setTextField(String text){
         textField.setText(text);
    public void setGraph(String filePath){
         ImageIcon icon = new ImageIcon(filePath);
         diagram.setIcon(icon);
    public void setTask(String taskString){
         task.setText(taskString);
    public void focus(){
         textField.requestFocus();
    public void close(){
         frame.dispose();
    public void actionPerformed(ActionEvent evt){
    String text = textField.getText();
         System.out.println(text);
         done=true;
    public static void main(String args[]){
         SubjectGUI sgui = new SubjectGUI();
         long start = System.currentTimeMillis();
         sgui.focus();
         for(int i=0;i<3;i++){
         if(i==0){
              sgui.setTextField("");
              sgui.setTask("2+2");
              sgui.setGraph("./images/graph1.JPEG");
         if(i==1){
              sgui.setTextField("");
              sgui.setTask("4+4");
              sgui.setGraph("./images/graph2.JPEG");
         //sgui.focus();//see previous focus() outside loop
         while((System.currentTimeMillis()<start + 10000) && !(sgui.done)){

Maybe you are looking for