?
Solved

How to draw lines in GUI, somethign like border line

Posted on 2007-11-27
5
Medium Priority
?
1,453 Views
Last Modified: 2012-05-05
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
Comment
Question by:eternity5219
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 26

Expert Comment

by:ksivananth
ID: 20357156
I would suggest to go with JSplitPane or JSeparator than drawing lines...
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 20357174
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
 
LVL 13

Accepted Solution

by:
Bart Cremers earned 2000 total points
ID: 20357182
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
 
LVL 92

Expert Comment

by:objects
ID: 20357187
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 20357191
>>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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question