Solved

How to draw lines in GUI, somethign like border line

Posted on 2007-11-27
5
1,420 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
  • 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 500 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

813 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now