Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dynamic resize of JButton and JFrame in response to Font

807603Dec 11 2007 — edited Dec 13 2007
Im supposed to increase the font size of the text with JButton by 1 within each click.
Eventually the text becomes shorter and less visible like WORD becomes WOR... then WO... etc

How to make the button always resize with text so that the text is fully visible and JFrame always resize with button so that the button doesn't change its position within the Frame ?

edit:
I managed to make buttons resize with increasing font
by making
JButton b = new JButton("button");
b.setHorizontalTextPosition(CENTER);
b.setVerticalTextPosition(CENTER);
However the window size doesnt increase with components ;[

any help would be appretiated.

Edited by: pimpcane on Dec 11, 2007 12:16 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 10 2008
Added on Dec 11 2007
7 comments
1,067 views