Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-beta-6
-
None
-
None
Description
The following script
http://jroller.com/comments/jurberg/Weblog/not_so_groovy
fails since drawString() has methods which can take int or float. The MetaClass should choose the one with ints if the difference between the two is purely numerical precision.
import java.awt.*
import javax.swing.*
class TestPanel extends JComponent {
property text = "Testing"
TestPanel()
{ setBackground(Color.black) }void paintComponent(Graphics g)
{ r = this.getBounds() g.setColor(Color.black) // TODO remove the Integer! g.fillRect(0, 0, (Integer) r.width, (Integer) r.height) g.setColor(Color.white) g.drawString(text, 50, 50) } static main(args) {
cv = new TestPanel()
fr = new JFrame(title:"Groovy Test Panel", size:[260, 200])
fr.windowClosing =
fr.getContentPane().add(cv)
fr.show()
cv.repaint()
}
}