Java integration confused about mutators in some cases
------------------------------------------------------

                 Key: JRUBY-1838
                 URL: http://jira.codehaus.org/browse/JRUBY-1838
             Project: JRuby
          Issue Type: Bug
          Components: Java Integration
    Affects Versions: JRuby 1.x
            Reporter: MenTaLguY
         Attachments: sample.rb

The following code should draw an 8-pixel wide diagonal line, but draws a 
single-pixel line unless gfx.stroke = is changed to gfx.set_stroke.

{{require 'java'

EventQueue = java.awt.EventQueue
JFrame = javax.swing.JFrame
JPanel = javax.swing.JPanel
Color = java.awt.Color
Dimension = java.awt.Dimension
Path2D = java.awt.geom.Path2D::Double
BasicStroke = java.awt.BasicStroke

class MyPanel < JPanel
  def paintComponent(gfx)
    gfx.color = Color::WHITE
    bounds = self.bounds
    gfx.fill bounds
    path = Path2D.new
    path.move_to(0, 0)
    path.line_to(bounds.width, bounds.height)
    gfx.stroke = BasicStroke.new(8.0)
    gfx.color = Color::BLACK
    gfx.draw path
  end
end

EventQueue.invoke_later proc {
  frame = JFrame.new
  frame.default_close_operation = JFrame::DISPOSE_ON_CLOSE
  frame.minimum_size = Dimension.new(300, 300)
  frame.content_pane = MyPanel.new
  frame.show
} }}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to