1 Reply Latest reply: Dec 9, 2013 3:27 PM by TPD-Opitz RSS

    UI flickrs continously jdk1.7.25 EventdispatchThread's pumpEventsForFilter goes to infinite while loop

    6fefb8d7-5840-4513-8ae9-ec9211b7f655

      I am migrating a project from Java 1.3 to Java 1.7 update 25 and there is one search button functionality in which search is performed correctly but the UI flickers continuously because EventdispatchThread's pumpEventsForFilter goes to infinite while loop.

       

      This same code works correctly in java 1.3.

       

      Below is the part of the code related to searchbutton. Can you please suggest regarding this because the issue is within java api and not sure how to solve this.

       

       

      SearchButton.java:

       

      private JButton searchButton; 

        

      private String textsearchButton = 

            search.util.Language.getString("buttonStartSearch"); 

             

             

      searchButton = new JButton(textsearchButton); 

       

      buttonPanel.add(searchButton); 

        

      searchButton.addActionListener(this); 

       

      searchButton.addActionListener(actionListener); 

             

       

      actionListener.actionPerformed( 

                     new ActionEvent( 

                        searchButton, 

                        ActionEvent.ACTION_PERFORMED, 

                        "toFront")); 

                  actionListener.actionPerformed( 

                     new ActionEvent( 

                        searchButton, 

                        ActionEvent.ACTION_PERFORMED, 

                        "searchComplete")); 

               

      setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); 

        

          if (hasSearch) { 

                  actionListener.actionPerformed( 

                     new ActionEvent( 

                        searchButton, 

                        ActionEvent.ACTION_PERFORMED, 

                        "searchComplete")); 

               } 

               else { 

                  actionListener.actionPerformed( 

                     new ActionEvent( 

                        searchButton, 

                        ActionEvent.ACTION_PERFORMED, 

                        "search")); 

               } 

            } 

      searchButton.setEnabled(!hasSearch && hasCriterions()); 

       

       

      public void actionPerformed(ActionEvent ae) { 

            Object source = ae.getSource(); 

           

            else if (source == searchButton) 

               startSearch(); 

       

            else if (source == exportButton) 

               exportSearch(); 

       

             

            else { // ActionEvents from the panels occur 

               changesOccured(); 

            } 

         } 

       

      -----

      EventDispatchThread:


      void pumpEventsForFilter(int id, Conditional cond, EventFilter filter) { 

              addEventFilter(filter); 

              doDispatch = true; 

      //This while goes to infinite loop 

             [b] [color=red]while (doDispatch && !isInterrupted() && cond.evaluate()) { 

                  pumpOneEventForFilters(id); 

              }[/color][/b] 

              removeEventFilter(filter); 

          }