You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Igor V. Stolyarov (JIRA)" <ji...@apache.org> on 2008/02/19 08:46:43 UTC

[jira] Created: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

[classlib][awt] Canvas paint method works incorrectly
-----------------------------------------------------

                 Key: HARMONY-5527
                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Igor V. Stolyarov


Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.

Simple reproducer:
import java.awt.*;
import java.awt.event.*;

public class CanvasTest extends Frame implements ActionListener{

    boolean clicked = false;
    Canvas c;
    Button b;

    public CanvasTest(){
        setLayout(new BorderLayout());

        Panel p1 = new Panel();
        p1.setPreferredSize(new Dimension(200, 200));
        c = new TestCanvas();
        p1.add(c);

        Panel p2 = new Panel();
        p2.setLayout(new BorderLayout());
        p2.setPreferredSize(new Dimension(200, 50));
        b = new Button("Click me");
        b.setPreferredSize(new Dimension(70,30));
        b.addActionListener(this);
        p2.add(b, BorderLayout.CENTER);

        add(c, BorderLayout.CENTER);
        add(b, BorderLayout.SOUTH);

        addWindowListener(new WindowAdapter(){
            public void windowClosing(WindowEvent e){
                System.exit(0);
            }
        });
    }

    public void actionPerformed(ActionEvent e){
        if(e.getSource() == b){
             clicked = true;
             c.repaint();
        }
    }

    class TestCanvas extends Canvas{
         public void paint(Graphics g){
             g.setFont(g.getFont().deriveFont(Font.BOLD));
             if(!clicked){
                 g.drawString("Test started!", 50, 20);
             } else {
                 super.paint(g);
                 g.drawString("Button clicked!", 50, 50);
             }
         }

         public void update(Graphics g){
             paint(g);
         }
    }

    public static void main(String[] argv){
        CanvasTest test = new CanvasTest();
        test.setSize(200, 250);
        test.setVisible(true);       
    }
}

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


[jira] Commented: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Igor V. Stolyarov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571036#action_12571036 ] 

Igor V. Stolyarov commented on HARMONY-5527:
--------------------------------------------

Yes, of course.

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Assigned: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov reassigned HARMONY-5527:
----------------------------------------

    Assignee: Alexei Zakharov

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Commented: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Igor V. Stolyarov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570669#action_12570669 ] 

Igor V. Stolyarov commented on HARMONY-5527:
--------------------------------------------

Alexei, this patch fixes Canvas.paint issue, as you may to know there are issues related to redundant clearing background on Linux, which need further investigation. On Win all works fine.

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Commented: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Igor V. Stolyarov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570668#action_12570668 ] 

Igor V. Stolyarov commented on HARMONY-5527:
--------------------------------------------

Alexei, this patch fixes Canvas.paint issue, as you may to know there are issues related to redundant clearing background, which need further investigation.

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Commented: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570711#action_12570711 ] 

Alexei Zakharov commented on HARMONY-5527:
------------------------------------------

Ok, I see. So I suggest to commit your current patch and open another JIRA about extra background clearing on Linux. 
BTW, Igor what is the purpose of p1 and p2 in the above test case? I can't find the place where these panels are used. You probably mean
        add(p1, BorderLayout.CENTER);
        add(p2, BorderLayout.SOUTH); 
instead of
        add(c, BorderLayout.CENTER);
        add(b, BorderLayout.SOUTH); 
?

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Commented: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12571033#action_12571033 ] 

Alexei Zakharov commented on HARMONY-5527:
------------------------------------------

Ok, I see. Well, I'm going to commit your patch after the code freeze is over. Is it ok with you?

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Updated: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Igor V. Stolyarov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor V. Stolyarov updated HARMONY-5527:
---------------------------------------

    Attachment: Harmony.JPG
                RI.JPG
                H-5527.patch

Fix attached.

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Commented: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Igor V. Stolyarov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12594074#action_12594074 ] 

Igor V. Stolyarov commented on HARMONY-5527:
--------------------------------------------

Works for me.
Thank you Alexei.

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Resolved: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov resolved HARMONY-5527.
--------------------------------------

    Resolution: Fixed

Igor, the patch was applied at the revision  640914. Please verify.

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Closed: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov closed HARMONY-5527.
------------------------------------


verified by Igor

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Commented: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Igor V. Stolyarov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570991#action_12570991 ] 

Igor V. Stolyarov commented on HARMONY-5527:
--------------------------------------------

Alexei, I thik it may to reduce my test, like this: 

        setLayout(new BorderLayout()); 

        c = new TestCanvas(); 
        c.setPreferredSize(new Dimension(200, 200)); 
  
        b = new Button("Click me"); 
        b.setPreferredSize(new Dimension(70,30)); 
        b.addActionListener(this); 

        add(c, BorderLayout.CENTER); 
        add(b, BorderLayout.SOUTH); 


> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Updated: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Igor V. Stolyarov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor V. Stolyarov updated HARMONY-5527:
---------------------------------------

    Comment: was deleted

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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


[jira] Commented: (HARMONY-5527) [classlib][awt] Canvas paint method works incorrectly

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12570652#action_12570652 ] 

Alexei Zakharov commented on HARMONY-5527:
------------------------------------------

Igor, I've tried your patch on Ubuntu Linux IA32. Yes, it fixes the original issue about not-clearing the old text while repainting. However, if your patch is applied I don't see any text at all after clicking on button. It appears only if I touch mouse and move it a little bit away. My assumption is this is not a 100% correct behavior too. 

> [classlib][awt] Canvas paint method works incorrectly
> -----------------------------------------------------
>
>                 Key: HARMONY-5527
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5527
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>            Assignee: Alexei Zakharov
>         Attachments: H-5527.patch, Harmony.JPG, RI.JPG
>
>
> Canvas paint method works incorrectly. According to Specification "... default operation is simply to clear the canvas", in Harmony implementation method paint does nothing.
> Simple reproducer:
> import java.awt.*;
> import java.awt.event.*;
> public class CanvasTest extends Frame implements ActionListener{
>     boolean clicked = false;
>     Canvas c;
>     Button b;
>     public CanvasTest(){
>         setLayout(new BorderLayout());
>         Panel p1 = new Panel();
>         p1.setPreferredSize(new Dimension(200, 200));
>         c = new TestCanvas();
>         p1.add(c);
>         Panel p2 = new Panel();
>         p2.setLayout(new BorderLayout());
>         p2.setPreferredSize(new Dimension(200, 50));
>         b = new Button("Click me");
>         b.setPreferredSize(new Dimension(70,30));
>         b.addActionListener(this);
>         p2.add(b, BorderLayout.CENTER);
>         add(c, BorderLayout.CENTER);
>         add(b, BorderLayout.SOUTH);
>         addWindowListener(new WindowAdapter(){
>             public void windowClosing(WindowEvent e){
>                 System.exit(0);
>             }
>         });
>     }
>     public void actionPerformed(ActionEvent e){
>         if(e.getSource() == b){
>              clicked = true;
>              c.repaint();
>         }
>     }
>     class TestCanvas extends Canvas{
>          public void paint(Graphics g){
>              g.setFont(g.getFont().deriveFont(Font.BOLD));
>              if(!clicked){
>                  g.drawString("Test started!", 50, 20);
>              } else {
>                  super.paint(g);
>                  g.drawString("Button clicked!", 50, 50);
>              }
>          }
>          public void update(Graphics g){
>              paint(g);
>          }
>     }
>     public static void main(String[] argv){
>         CanvasTest test = new CanvasTest();
>         test.setSize(200, 250);
>         test.setVisible(true);       
>     }
> }

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