1,105,242 Community Members

Best way to add a button type thing

Member Avatar
jasonw749
Newbie Poster
4 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

hi guys, first time posting here. so i have this menu for a game i am making and the image that i have for the menu background has text and things already loaded onto it.

what would be the best way to have the text clickable? would it be to delete the text and re add it or is there a way to add some sort of action listener that can deal with this in the form that it is currently in. thanks :)

Member Avatar
NormR1
Posting Sage
7,723 posts since Jun 2010
Reputation Points: 563 [?]
Q&As Helped to Solve: 793 [?]
Skill Endorsements: 16 [?]
Team Colleague
 
0
 

have the text clickable

What does "clickable" mean? Do you want an event when the text is clicked on?
Is the text part of an image, not a String you are adding to a component?

Where and what is the text and what kind of component is the text in?

Member Avatar
jasonw749
Newbie Poster
4 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

sorry i didnt explain properly. the text is part of a png file and i want another menu page to open up when certain parts of the image are clicked

Member Avatar
NormR1
Posting Sage
7,723 posts since Jun 2010
Reputation Points: 563 [?]
Q&As Helped to Solve: 793 [?]
Skill Endorsements: 16 [?]
Team Colleague
 
0
 

You could use a mouseListener on the component holding the image and get the x,y location of the mouse click and compare it to the location of the text on the image. Use a photo editor to map out the rectangles around the parts you want to be able to click on.

Member Avatar
jasonw749
Newbie Poster
4 posts since Mar 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

thanks :) i will do that. im really glad i stumbled among this forum, really fast replys. thanks again

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article