Results 1 to 3 of 3
- 03-11-2009, 02:39 AM #1
Senior Member
- Join Date
- Mar 2009
- Posts
- 552
- Rep Power
- 13
How do you draw a grid in a JFrame
Is it possible to draw a grid within a JFrame? If so, how?
I am trying to create a grid to divide my JFrame into sections, but I cannot figure out how to draw a grid.
Can anyone explain to me how you draw a grid in a JFrame?If the above doesn't make sense to you, ignore it, but remember it - might be useful!
And if you just randomly taught yourself to program, well... you're just like me!
-
There can be several ways to do this, from using several JComponents in a grid and giving them line borders, to using a BufferedImage, getting its Graphics object and drawing lines within to drawing a grid within a JPanel's paintComponent method using the Graphics object passed as a parameter and calling Graphics#drawLine(...) on this Graphics object,...
More importantly: how much do you know about Swing graphics? Have you gone through the Sun Graphics tutorial? If not, I strongly urge you to do so before embarking on this as it will give you the underpinnings you'll need to understand what you are doing. You understand of course that you'll almost never want to draw directly on the JFrame, right?
Best of luck!
- 03-11-2009, 03:31 AM #3
Senior Member
- Join Date
- Mar 2009
- Posts
- 552
- Rep Power
- 13
Similar Threads
-
Database Grid
By leoleo4614 in forum AWT / SwingReplies: 1Last Post: 12-13-2008, 08:02 AM -
[SOLVED] How to create a Grid?
By Nakira in forum New To JavaReplies: 11Last Post: 11-12-2008, 11:45 AM -
how to get the grid values
By jazz2k8 in forum Advanced JavaReplies: 2Last Post: 11-06-2008, 03:11 PM -
Help creating a changing grid
By adlb1300 in forum New To JavaReplies: 11Last Post: 10-24-2007, 02:41 PM -
Help with Grid Layout
By coco in forum AWT / SwingReplies: 1Last Post: 08-06-2007, 09:03 PM
Bookmarks