Message1067

Author mlh
Recipients
Date 2005-10-25.15:38:46
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
The following code is a "literal" translation from a
Java 2D API example (from a book on the subject):

class Drawing(JComponent):

    def paint(self, g):
        shape = Rectangle(40, 40, 200, 100)

        g.paint = Color.orange
        g.fill(shape)

        g.stroke = BasicStroke(10)
        g.paint = Color(128, 0, 0)
        g.draw(shape)

It does not work as it should. When the shape is drawn
(using g.draw) the stroke and color have reverted to
what they were at some earlier point. I.e., the color
reverts to Color.orange, and the stroke reverts to the
default (1 point wide). If, however, the line

        g.stroke = BasicStroke(10)

is replaced with

        g.setStroke(BasicStroke(10))

the example works. As far as I can tell from the Jython
docs, these two statements are supposed to be
equivalent. Also, the fact that it's only necessary to
change *one* of these statements (and not, say, the
assignment to g.paint) makes this seem like a bug to me...
History
Date User Action Args
2008-02-20 17:17:26adminlinkissue1337592 messages
2008-02-20 17:17:26admincreate