Solved

Capturing JPanel with data as an image

Posted on 2002-06-12
2
256 Views
Last Modified: 2006-11-17
Hello,

We have some content on a JPanel
As part of our project requirements we have to :
1. Capture this JPanel as an image. How do we do this ?

2. The JPanel has a scroll bar. Is there any way we can capture the entire content (even that beyond the scrollbar) as an image ?
This has to be implemented in Java. If anyone has worked on this could you please provide a solution for achieving the same.

Thanks in advance,
0
Comment
Question by:hariharann
  • 2
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 100 total points
ID: 7074909
Create an image the same size as your panel, then simply pass the Graphic context associated with the image to the panels paint method:

panel.paint(image.getGraphics());

The image will then contain the contents of the entire panel.
0
 
LVL 92

Expert Comment

by:objects
ID: 7077297
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now