How to resize the content of a frame when te frame is resized.
1 posts in topic
Flat View  Flat View

Posted By:   NItindra_Dindorkar
Posted On:   Sunday, June 2, 2002 10:16 PM

I have a frame to which I add panel which has few labels at diffrenet position. I want to make the frame such that the labels (the text within ) will get resized when the frame is manually resized? I am using AWT.

Please use html tags to format code blocks.

Re: How to resize the content of a frame when te frame is resized.

Posted By:   Anonymous  
Posted On:   Tuesday, June 4, 2002 06:06 AM

I have made something similar in swing maybe you can use it.
The basic idea is to redraw the components into an appropriate size

In order to know when the frame has been resized you use the componentListener


new ComponentAdapter()


public void componentResized(ComponentEvent ce)


WIDTH = getWidth();

HEIGHT = getHeight();

resizeWindow(HEIGHT, WIDTH);



You just need to define the resizeWindow method. Note also that you may have to add the componentListener to a specific object instead of just this.

There is a Font class with which you can control the font sizes of the text in your text areas, labels and the like. Just instansiate a Font object with the parameters that you want and use that Font object in all your components. The online java documentation shows you how to do this as I don't remember... I do remember that it's no biggie though.

Hope it helps

- Peter
About | Sitemap | Contact