aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How can this be done (lines with panels) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How can this be done (lines with panels)" Watch "How can this be done (lines with panels)" New topic
Author

How can this be done (lines with panels)

Darrin Smith
Ranch Hand

Joined: Aug 04, 2003
Posts: 276
I need to create a panel that looks something like this:

[] [] [] [] [] | [] [] [] []
------------------------------
[] [] [] [] [] | [] [] [] []

Where the [] will really be boxes and the | and -- marks will be solid lines.

So, I have 4 quadrants with boxes in each seperated by lines. I planned to make each quadrant its own JPanel holding JTextFields (the boxes need to accept text input), but the dividing lines part concerns me.

I know that I can use 2D to draw the lines by overriding paintComponent(), but how can I then position the panels to on top of the drawing?

Is this even possible to do?

Some guidance would be greatly appreciated!

Thanks!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8996
    
    9

Put each quadrant into a JPanel and set each JPanel's border to javax.swing.border.LineBorder. If the lines are two thick, try only setting two quadrants' borders (upper right, lower left). Warning: I am not a graphic designer!


[How To Ask Questions On JavaRanch]
Darrin Smith
Ranch Hand

Joined: Aug 04, 2003
Posts: 276
Thanks Joe...I'll give it a try.

I was thinking it was going to end up being (:eek a 2D solution.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

You could just use a JSeparator;



GenRocket - Experts at Building Test Data
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can this be done (lines with panels)