Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1467
  • Last Modified:

How to draw lines in GUI, somethign like border line

Hi Experts,

I am trying to divide my GUI  window into 3 categories, I was thinking of separating each part by some line.
do you have any suggestion about how to draw a line in GUI?

Thank You
0
eternity5219
Asked:
eternity5219
  • 3
1 Solution
 
ksivananthCommented:
I would suggest to go with JSplitPane or JSeparator than drawing lines...
0
 
ksivananthCommented:
see the example below using JSeparator,

http://www.onjava.com/pub/a/onjava/excerpt/swing_14/index6.html?page=2 - look for section "Using a Separator Outside of a Menu"
0
 
Bart CremersJava ArchitectCommented:
If you want to divide a GUI you should compose you GUI using three separate JPanels. You then can simply set a Border on the different Panels

JPanel panelOne = new JPanel();
panel.setBorder(BorderFactory.createTitledBorder("Panel One"));
// ... add components to panelOne

// ... panel two, three, ...

There are several types of borders present.

Note that using borders is only viable if you don't need to "slide" parts of the gui out of the way. You should use a splitpane for that.

 
0
 
objectsCommented:
0
 
ksivananthCommented:
>>Note that using borders is only viable if you don't need to "slide" parts of the gui out of the way
>>

JSeparator is there!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now