File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Change font size of button if button size changes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Change font size of button if button size changes" Watch "Change font size of button if button size changes" New topic
Author

Change font size of button if button size changes

Nilu Deshmukh
Greenhorn

Joined: Aug 03, 2009
Posts: 22
Hi All,
I want to change font size i.e increment or decrement , if button size is incremented or decremented..

I am using Component Listner.

Sriraman Srinivasan
Greenhorn

Joined: Jul 08, 2010
Posts: 10
You can use componentResized method of Component Listener to know resizing of the component. In this method you can change the font and repaint the component.
Nilu Deshmukh
Greenhorn

Joined: Aug 03, 2009
Posts: 22
Thanks Shreeram,
I am using component listner... and it changes values also. but the issue is i could not determine how to change font size..




In getFormatLable method I wrote function to set font size and other parameters.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19693
    
  20

Use getFont, Font.deriveFont and setFont.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Change font size of button if button size changes