Solved: How to display a certain char in a string as a polygon?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

ElementOfMagic

Thread Starter
Joined
Dec 30, 2012
Messages
52
Hello. :)

Programming language I am using: Java (not JavaFX, Swing or anything else of that nature. Just regular Java).

Here's how my program works:

  • A user is asked to enter some text into a textfield.
  • The entered text is then read in by the program.
  • The program checks whether a specific character (in my case 'h' or 'H') is present in the entered text.
  • If so, the program removes that character from the string and instead, displays it as a drawn polygon (not a Unicode character) and displays the rest of the string using the drawString() method.

Basicially, what I'm stuck on is how I would go about coding step 4 in the above list. ^^

So far, I have managed to remove the character I wish to replace (called 'sl1' )from the string when it occurs in the entered text (code below):

Code:
if(pr_word.indexOf(sl1)!=-1)
		{
		   pr_word = pr_word.replace(sl1, "");
		   g.setColor(Color.red);
		   g.drawPolygon(x,y,5);
		}
Any help/guidance will be greatly appreciated. :) (y)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top