File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Vertical JSeparator

 
Barry Brashear
Ranch Hand
Posts: 303
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic