# Solved: JAVA: How to use JSeparator



## sepala (May 20, 2010)

Hi all,

I want to know how to use JSeparator. I had a look at oracle documents regarding this, but I got nothing. Please help.


----------



## sepala (May 20, 2010)

Can someone please help me?


----------



## sepala (May 20, 2010)

bump...


----------



## sepala (May 20, 2010)

Ok here is the code for JSeperator

*new JSeparator(JSeparator.VERTICAL),

*Can some one please tell me how to set the width of this? Is that is necessary?


----------



## JimmySeal (Sep 25, 2007)

Did you have a look at this tutorial? It's the first match that comes up when searching for *JSeparator tutorial*, and seems to explain them pretty well.

http://download.oracle.com/javase/tutorial/uiswing/components/separator.html


----------



## sepala (May 20, 2010)

Yes, I had..But it is not giving the answer for my question...


----------



## sepala (May 20, 2010)

At least I want to know, whether I need to worry about its width..


----------



## JimmySeal (Sep 25, 2007)

This paragraph from the page I directed you to says what you need to know about the width and height:


> Separators have almost no API and are extremely easy to use as long as you keep one thing in mind: In most implementations, a vertical separator has a preferred height of 0, and a horizontal separator has a preferred width of 0. This means a separator is not visible unless you either set its preferred size or put it in under the control of a layout manager such as BorderLayout or BoxLayout that stretches it to fill its available display area.


Just like any *Component* object, you can set its width and height with the *setSize()* method.


----------



## sepala (May 20, 2010)

Thanks for the help JimmySeal. I really appreciate this. Thanks again.


----------

