• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can this be done (lines with panels)

 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9312
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Joe...I'll give it a try.

I was thinking it was going to end up being (:eek a 2D solution.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could just use a JSeparator;

 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic