harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4803) [classlib][awt] firepropertyChange only when it really change?
Date Tue, 18 Sep 2007 13:20:43 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528379
] 

Alexei Zakharov commented on HARMONY-4803:
------------------------------------------

Chunrong, I've reworked your test a little bit, please see below. IMO my version shows that
RI doesn't schedule component to be repainted after setBackground(). Shouldn't we get rid
of repaint() completely from set/getBackgound()? I have missed something probably.

MyFrame.java:
---
import java.awt.* ;
import java.awt.event.* ;
    
class MyPanel extends Panel{
    
  public void paint(Graphics g){
    System.out.println ("paint");
    super.paint(g);
  }

  public void repaint() {
    System.out.println ("repaint");    
    super.repaint();
  }

  public void repaint(int x, int y, int width, int height) {
    System.out.println ("repaint(int,int,int,int)");    
    super.repaint();
  }

  public void repaint(long tm) {
    System.out.println ("repaint(long)");    
    super.repaint();
  }
  
  public void repaint(long tm, int x, int y, int width, int height) {
    System.out.println ("repaint(long,int,int,int,int)");    
    super.repaint();
  }

  public void update(Graphics g) {
    System.out.println ("update");    
    super.repaint();
  }
}
    
public class MyFrame extends Frame{
  MyPanel panel;

  MyFrame(){
    panel = new MyPanel();
    add(new MyPanel());
    setSize(300,200);    
    setVisible(true);
  }

  public static void main(String args[]) throws Exception {
    MyFrame myFrame = new MyFrame();
    Thread.sleep(1000);
    System.out.println("Control point 1");
    myFrame.panel.setBackground(Color.blue);
    System.out.println("Control point 2");
  }
} 
---

On RI it outputs:

>java MyFrame
paint
Control point 1
Control point 2

On the current Harmony version:

>%DRLVM_HOME%\bin\java MyFrame
Control point 1
repaint
Control point 2
paint


> [classlib][awt] firepropertyChange only when it really change?
> --------------------------------------------------------------
>
>                 Key: HARMONY-4803
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4803
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Win32 + Linux32
>            Reporter: Chunrong Lai
>            Assignee: Alexei Zakharov
>         Attachments: H4803.fixedforeground.patch, H4803.fixedreproducer.patch
>
>
>  Below reproducer shows the reaint and  firePropertyChange triggered from setBackground().
>  Harmony falls into a dead loop setBackground()->repaint()->update()->paint()->setBackground().
>  It is easy to break the loop if we only repaint (and firepropertyChange) when the old
background does not equal to the new background.
>  I believe there are other similar issues like this.
> import   java.awt.*   ;   
> import   java.awt.event.*   ;   
>     
> class   MyPanel   extends   Panel{   
>   int   flag   =   0   ;   
>     
>   public   void   paint(Graphics   g){   
>     setBackground(Color.blue)   ;   
>     System.out.println   ("hi")   ;   
>   }   
> }   
>     
> public class   MyFrame   extends   Frame{   
>   MyFrame(){   
>     add(new MyPanel())   ;   
>     setSize(300,200)   ;   
>     setVisible(true)   ;   
>   }   
>   public   static   void   main(String   args[]){   
>     new   MyFrame()   ;   
>   }   
> } 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message