Results 1 to 5 of 5
Thread: Rendering graphics on JPanel
- 10-05-2011, 04:10 AM #1
Member
- Join Date
- Jul 2011
- Posts
- 38
- Rep Power
- 0
Rendering graphics on JPanel
I have a JPanel that is half covered by a Jtextarea. In addition, i tried to display graphics on the panel as well. I assume that I cannot display graphics on top of the Jtextarea, or any other component for that matter, and instead I would need to use a JLayer and LayerUI. However, i tried to display my graphics below the jtextarea, where the panel was empty, and it wouldn't work. Does this mean that to display graphics on a panel that contains a component, a Jlayer must be used?
- 10-05-2011, 04:26 AM #2
Senior Member
- Join Date
- Jul 2011
- Location
- Melbourne, Victoria, Australia
- Posts
- 155
- Rep Power
- 2
Re: Rendering graphics on JPanel
Make two separate JPanels and place them in each half of your Frame. And use a paintComponent on the second JPanel.
- 10-06-2011, 02:56 AM #3
Member
- Join Date
- Jul 2011
- Posts
- 38
- Rep Power
- 0
Re: Rendering graphics on JPanel
I've done that... if i don't add the panel with the text box, my graphics are displayed, if i have both panels, then the graphics won't be displayed.
- 10-06-2011, 03:26 AM #4
Senior Member
- Join Date
- Apr 2010
- Location
- Philippines
- Posts
- 580
- Rep Power
- 4
Re: Rendering graphics on JPanel
It also depends on the type of Layout you are using. In this case, you can use GridLayout and set its column to 2.
See: Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)
- 10-06-2011, 06:08 AM #5
Senior Member
- Join Date
- Jul 2011
- Location
- Melbourne, Victoria, Australia
- Posts
- 155
- Rep Power
- 2
Similar Threads
-
can you print a JPanel without actually rendering it on screen first?
By AcousticBruce in forum New To JavaReplies: 11Last Post: 03-09-2011, 08:18 AM -
JPanel and graphics
By nevermiind in forum AWT / SwingReplies: 5Last Post: 03-04-2011, 01:21 PM -
Can't display my graphics in a JPanel
By handro1104 in forum AWT / SwingReplies: 2Last Post: 02-14-2011, 03:40 PM -
Jpanel and displaying graphics
By jdsflash in forum New To JavaReplies: 6Last Post: 11-21-2009, 01:14 AM -
Newbie need help on JPanel graphics
By junpogi in forum AWT / SwingReplies: 7Last Post: 10-21-2008, 07:44 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks