Do you only need the setVisible when you don't have a layout manager. Same with setBounds and setSize. Does the layout manager take care of that stuff for you? Do yo have to setBounds and setSize or one is enought? What purpose does te method show() have. do you use it instead of setvisible. My book uses it in its code but doesn't have any kind of definition or anything. thanks is advance Kourosh
Joined: Sep 29, 2000
setVisible, setBounds and setSize are all methods inherited from the Component Class. They will get default settings if you don't set them (false for setVisible and 0,0 for setBounds). I am not sure if setSize can replace setBounds. If you are running an Applet the size can be set in the HTML. show() is deprecated but also from component.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Nov 06, 2000
Also it is required only for top level components like window, frames etc. for components like buttons,textfields etc it is not a requirement to specify it.
Joined: Oct 23, 2000
Thanks Cindy and Subha. Koursh
Joined: Nov 07, 2000
Hi, One more addition... setBounds(int x,int y, int width, int height) is used for Moving as well as Resizing a component setSize(int width, int height) is only for resizing the component So, setSize cannot replace setBounds in some cases. Aparna
Joined: Oct 31, 2000
Correct me if I am wrong, but I think if you don't use a Window or a Frame. ie if you use an Applet you don't need to set it visible. I mean you don't have to do setVisible(true). Sudha