This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Vertical JSeparator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Vertical JSeparator" Watch "Vertical JSeparator" New topic

Vertical JSeparator

Barry Brashear
Ranch Hand

Joined: Jun 05, 2001
Posts: 303
How can you make a JSeparator vertical instead of horizontal? I want to use
one to separate areas on a JPanel. Is there a better way to do this?

Joe Vahabzadeh
Ranch Hand

Joined: Jan 05, 2005
Posts: 140
you can either use:

JSeparator js = new JSeparator(SwingConstants.VERTICAL);

Or, say you've already created a JSeparator called js without specifying it in the constructor, you can use:


The opposite value, is, as you might guess, SwingConstants.HORIZONTAL

I haven't used this myself, just seen it in the docs.

Hope this helps!
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> Is there a better way to do this?

depending entirely on what you're trying to do,
perhaps giving the panels a border might be an alternative
todd runstein
Ranch Hand

Joined: Feb 15, 2005
Posts: 64
As others have said, without knowing what you're trying to do, this may not be appropriate, but sounds to me like you want a split pane. Take a look at what JSplitPane does - it may be just what you're looking for - or not
jQuery in Action, 3rd edition
subject: Vertical JSeparator
It's not a secret anymore!