9 Years
Discussion Span
Last Post by javaAddict

What do you mean when you say button tip? If you want a message appearing when you put the mouse on the button then use this:

JButton button = new JButton("Save");
button.setToolTipText("Click to Save the file");

If you want to have the button activated from the keyboard:
JButton button = new JButton("Save");
The 'S' will be underlying at the button and if you press Alt-S it will activate the button.


Ehmm, are we forgetting to use code tags??

I usually don't use code tags when writing 1 or 2 lines of code. I mean all I wrote were 2 commands what were easy to read and understand. Of course for larger blocks of code I always use tags.

Yes Jbutton belongs to swing and sorry, but I didn't see that your question was about AWT. I use JButtons from the swing package for my GUIs

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.