Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / May 2005

Tip: Looking for answers? Try searching our database.

Drawing a screenshot of a component

Thread view: 
- - 30 May 2005 07:09 GMT
For a drag and drop operation, on mousePressed on a JButton, I want to
draw a "screenshot" of the JButton.

Anybody knows how?
Andrew Thompson - 30 May 2005 10:27 GMT
> ..I want to draw a "screenshot" of the JButton.

<http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Robot.html#createScreenCapture(
java.awt.Rectangle
)>

HTH

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

Andrey Kuznetsov - 30 May 2005 19:27 GMT
> For a drag and drop operation, on mousePressed on a JButton, I want to
> draw a "screenshot" of the JButton.
>
> Anybody knows how?

As Andrew mentioned, you can use Robot.

Another way is to create BufferedImage or (better) VolatileImage
and paint component into image's Graphics.
I used this technic to paint dock preview.
See docking demo at http://jgui.imagero.com/classes/gtest.jnlp

Signature

Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.