Two Laptop Bag*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Vertical JSeparator" Watch "Vertical JSeparator" New topic
Author

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?

Thanks
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:

js.setOrientation(SwingConstants.VERTICAL);

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Vertical JSeparator
 
Similar Threads
Separator in JToolBar
Need to insert a vertical line in Swing - Very Urgent and important
I'm stuck with calculator GUI
Gap between JSeparators
How to remove space around JSeparator