button text?
Hey, i tried to create a button in a java application but something went wrong. The button is created on the dialog only the text in the button is '...'
How can i set a custom text for the button?
This is a part of my code:
keyPad = new JButton[11];
keyPad[0] = new JButton("Test");
keyPad[0].setBounds(20,20,40,40);
jpanel.add(keyPad[0]);
The button text should be 'test' but i get '...' instead
[514 byte] By [
vivendi] at [2007-11-20 8:05:19]

# 2 Re: button text?
Londbrok is right - '...' is the standard way of showing that there isn't enough space to show all the tex...
As soon as we started programming, we found out to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs...
M. Wilkes
dlorde at 2007-11-10 2:16:33 >

# 3 Re: button text?
oh yeah you're right. But i want to use smaller buttons. How can i make a button that's 30 by 30 and that still shows text? Just a number is good enough in my case.
BTW, where can i find manifest files for Java. I want to change the original look to something else.
# 4 Re: button text?
You can set all kinds of things to a JButton. For one, you can try different, or smaller, font. There are getFont() and setFont() methods in all instances of Component. Then of course, there is the option of using just an icon.
what do you mean by "changing the look"? If you mean Look and Feel, you dont need manifest file for that. You can ask UIManager for look and feels currently supported, and process the list, untill you find the one you want. This is best done in the main method, that boots your application. While LAF can be changed in fly, it is most sensible to do prior you set your GUI visible.