Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 26th, 2013, 08:02 AM
javanewkid javanewkid is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 3 javanewkid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 49 sec
Reputation Power: 0
Moving(translate) a g.fillPolygon()

Ok, so I have limited coding experience and have only done basic stuff in VB

So basically i convert my string to char then loop through each char if a char is S i want it to display my own poly.

I think my problem is calling the method(?) to draw it. If i comment out the loop and just display the chars it works fine.

===========================================
edit:
I have figured it out, my poly was an invalid shape thus not displaying.

now after drawing a poly how do i "translate" (move it) in my applet window?

Reply With Quote
  #2  
Old February 26th, 2013, 03:46 PM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: SW Missouri
Posts: 2,958 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 3 h 7 m 10 sec
Reputation Power: 345
Can you explain what the problem is?

If letter is a char[], then you can test one of its elements directly using the == operator:
letter[i] == 'S'
and not have to convert it to a String.

Reply With Quote
  #3  
Old February 26th, 2013, 03:54 PM
javanewkid javanewkid is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 3 javanewkid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 49 sec
Reputation Power: 0
Quote:
Originally Posted by NormR
Can you explain what the problem is?

If letter is a char[], then you can test one of its elements directly using the == operator:
letter[i] == 'S'
and not have to convert it to a String.


The problem is that my polygon doesnt replace my "S" char.

basically

the user enters a word

i then add the word to a char array

i then use a loop to check each char in the array and display it exept when the char is "S" i want to display an "S" shaped poly using " fillPolygon(); ".

all my code for this so far is good exept displaying my own "S" shaped fillPolygon(); instead of the single char "S"


my code above takes each char and displays each one in a horizontal line exactly 20px away. my hope were that if my if statement sees and S it was draw my drawS polygon

Reply With Quote
  #4  
Old February 26th, 2013, 04:00 PM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: SW Missouri
Posts: 2,958 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 3 h 7 m 10 sec
Reputation Power: 345
Quote:
my polygon doesnt replace my "S" char.

Do you want to clear the graphics area before each time you draw?
Call the super.paint() method.

Where does the code change the location of where the polygon will be drawn?

Reply With Quote
  #5  
Old February 26th, 2013, 05:03 PM
javanewkid javanewkid is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 3 javanewkid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 49 sec
Reputation Power: 0
Quote:
Originally Posted by NormR
Do you want to clear the graphics area before each time you draw?
Call the super.paint() method.

Where does the code change the location of where the polygon will be drawn?




I have figured it out, my poly was an invalid shape thus not displaying.

now after drawing a poly how do i "translate" (move it) in my applet window?

Reply With Quote
  #6  
Old February 26th, 2013, 06:40 PM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: SW Missouri
Posts: 2,958 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 3 h 7 m 10 sec
Reputation Power: 345
Change the x,y values that define its location.

Reply With Quote
  #7  
Old April 8th, 2013, 12:55 PM
sulty28194 sulty28194 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2013
Posts: 1 sulty28194 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 m 16 sec
Reputation Power: 0
Quote:
Originally Posted by javanewkid
I have figured it out, my poly was an invalid shape thus not displaying.

now after drawing a poly how do i "translate" (move it) in my applet window?


Hey, how did you go about this issue?.. i have the same problem but for mine, i have drawn out the polygon, but instead of the letter being replaced, the polygon is drawn underneath the entered text.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Replace specific char in string with fillPolygon()

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap