Sajha.com Archives
Java

   Any java guru out there? This could be a 04-Mar-02 CupOfJava
     It's not allowing the spaces... Now I n 04-Mar-02 CupOfJava
       & NBSP ; altogther and I think its lo 05-Mar-02 sunakhari
         Thanks. The following code from Sun's 07-Mar-02 java


Username Post
CupOfJava Posted on 04-Mar-02 11:03 PM

Any java guru out there? This could be a simple question (and too dumb to put in sun's forum). I need to make my Applet (not JApplet) look like below. The tricky part is I am adding the components on the panel dynamically, so the sizes of these components are not known beforehand. The panel seems to be resized according to the component sizes. And thats causing the problem. I need to make sure that the size of each panel is always constant. How can I do this? I tried Border layout and gridbag layout but couldn't make it to work. Any sample would be of great help?


**********************************
* Panel 1 *
* *
**********************************
* p * *
* a * *
* n * *
* e * *
* l * Panel 3 *
* * *
* 2 * *
* * *
**********************************
CupOfJava Posted on 04-Mar-02 11:06 PM

It's not allowing the spaces...
Now I need to know what is the HTML tag for space.
sunakhari Posted on 05-Mar-02 11:27 AM

& NBSP ;

altogther and I think its lower caps
java Posted on 07-Mar-02 03:31 PM

Thanks.

The following code from Sun's discussion forum answered my original question:

public Panel createSizedPanel(final int width, final int height)
{
return new Panel() {
public Dimension getPreferredSize() {
return new Dimension(width,height);
}
};
}