File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes How to remove space around JSeparator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to remove space around JSeparator" Watch "How to remove space around JSeparator" New topic

How to remove space around JSeparator

Andrew Keidel

Joined: Dec 06, 2001
Posts: 27
I'm using JSeparators to draw lines between some panels in my GUI. I don't want to use borders because I only want lines between components, not completely around them (i.e., no lines around the outside edges of the GUI).
The problem I'm having is this:
With the preinstalled L&Fs (which I want to use), the horizontal JSeparator has empty space on either side of the line (not the case for the vertical JSeparator). I want to be able to draw a vertical line that goes right up to the horizontal line (touching it). However, a vertical JSeparator can't touch the horizontal JSeparator because of the hidden space surrounding the horizontal line.
A visual example:
I want to do this:
| (vertical line meets horizontal one)
But I can only do this:
I want the vertical JSeparator to come right up and meet the horizontal one! Ideas?
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Sounds like you should make some custom borders...

All you have to do is extend the interface javax.swing.border.Border and call setBorder( new MyCustomBorder() )...


Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: How to remove space around JSeparator
It's not a secret anymore!