Solved

Capturing JPanel with data as an image

Posted on 2002-06-12
2
263 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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 …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

728 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