Solved

How to draw lines in GUI, somethign like border line

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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…

685 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