Hi, I am trying to update some really old code that still uses the old java.awt.Color and java.awt.Font libraries.
The automatic converter did 90% (I think?) but I was left having to comment out every import line in every file.
Anyways, it's come down to a few key lines where the old code is still expecting a java.awt.Color object. For instance:
The main problem is that these external libraries still expect a java.awt.Font object. This line in particular:
Is there a way to convert the greenfoot.Font object into a java.awt.Font object? Is there a better way to address this?
1 2 3 4 5 6 7 8 9 10 11 | /** * Gets a graphics context for this component from this Actor's image. * * @return a graphics context for this component. */ public Graphics getGraphics() { Graphics g = getImage().getAwtImage().getGraphics(); if (getFont() != null ) g.setFont(getFont()); if (getForeground() != null ) g.setColor(getForeground()); return g; } |
1 | if (getFont() != null ) g.setFont(getFont()); |