can someone tell me how to make string button ?
i have tried but it is not working ??? please help
Hello and welcome to JGO !
Are you working in Java2D?
Did you implemented a button? How?
Are you using Swing?
As you can imagine, there are thousands of ways to do anything, you need to narrow us the posibilities. Please provide more info, because it’s just imposible to help you out from what you said
Do you know What strings are ?
if you do i joust want to make a string to be a button ?
can yo help me ?
Your question is extremely vague. Are you using Swing?
I think he doesn’t know what is swing ;D. What I have read i understood that he may just render string on screen and want that it would work like button (be clickable and so on)
I do know what strings are my friend
Maybe you want to make a link in the forum?
By the way, is it too difficult to give us more info?
Is your game 2d or 3d? What libraries are you working on?
Maybe he wants to make a button on a string:
http://www.laits.utexas.edu/hebrew/personal/toolbox/acm/button/button1.gif
;D
You’re RIGHT!
It’s the string INTO the button! I mean, multiple buttons!
Jokes apart, please don’t take us wrong, we really want to help you! But we need more info to help you out, that’s all friend
Yup, this is how you put strings into buttons:
http://www.laits.utexas.edu/hebrew/personal/toolbox/acm/button/button2.gif
I like where this thread go ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D ;D
In all seriousness, I am poking fun because the OP asked super vague questions, doubted our knowledge of strings, and has yet to reply. I am smelling either a troll or a super n00by n00b.
Let’s be nice with super n00by noobs, because all have been one when we first started
By the way, threds into buttons anyone?
If you dont wont to help me thx a lot
did you played minicraft ?
not minecraft
minicraft
that kind of button or
joust img button !
Yey! more info!
Do you use the mouse to press the button? Or the keyboard?
If you use the mouse, you need a mouse listener and in the onClick event check the coordinates and see if they are within the button.
If you use the keyboard, the approach is different, you could do some kind of variable that holds which button is “active” and the arrows will cycle between each of them, then, in the keyboard listener, check if the Enter key is pressed and activate the button that is active.
Did this help a bit? We can move forward now we have more info
By the way, check at my game:
http://dl.dropbox.com/u/67463565/main%20menu%20-%20highlighted.png
Although it uses the mouse (that isn’t drawn in the screenshot >_<), is this what you aim to do?
There was no use of the mouse in Minicraft at all. You just want buttons that you can hit ‘ENTER’ on? If so, then simply have a variable that contains the currently highlighted String, and update it when a key is pressed.
EDIT:
Minicraft uses the keyboard. And it’s mouseClicked not onClick
String[] MENUS = {"NEW GAME", "EXIT"};
...
//on your keyPressed method
if (e == KeyEvent.UP) index++;
else if (e == KeyEvent.DOWN) index--;
else if (e == KeyEvent.SPACE){
if (index == 1) newGame();
else if (index == 2) System.exit(0);
}
//on your draw
for (int i=0; i<MENUS.length; i++){
g.setColor(Color.white);
if (i == index) g.setColor(Color.yellow);
g.drawString(MENUS[i], x, y, null);
}