This week's book giveaway is in the Other Open Source APIs forum. We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line! See this thread for details.
I am required to enter a word/sentence into a text box and then print out what I have input, however when I have a special character (in my case 'H' or 'h') it will print out my fillPolygon shape.
I have used an array to try and replace the character H/h with the polygon using an If statement, however I keep on getting the error message: "[line: 49]
Error: method drawH in class Stringpoly cannot be applied to given types;
reason: actual argument int cannot be converted to int by method invocation conversion
Thanks in advance. I have literally spent hours trying to work out the problem.
Making the display class implement a Listener interface is usually poor practice, and I think this is no exception. Create a class which implements the Listener.
As for the compiler error: if you read the message it is quite clear. You must pass an int, not an int.
Why do you need to use fillPolygon? Why are you using that particular technique?
Joined: Oct 13, 2005
And welcome to the Ranch
Joined: Feb 27, 2013
I have changed the code now that my special character 'h' is now printed, however it appears in the top corners where I initially plotted it with the co-ordinates to create the shape.
For example, when I print "elephant", the H is missing but is instead in the top left hand corner, and when I type in 'Morning' a'h' won't appear.
Also in regards to the previous answer, I am using fillpolygon because I need it to be a block of the letter to replace the original special character.