Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 28th, 2007, 05:07 AM
Authorized User
Join Date: Nov 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to paste a bitmap into a JPanel?

I want to design a class that extends the JPanel class so that I can copy a bitmap image and then right-click on the JPanel and select paste to make the bitmap image appear inside the JPanel.
I have no idea of how to do this in java.
Can anyone give me a simple example of a java program that does this?
Are there any classes in the standard java class library that correspond to bitmaps?

Any pointers will be greatly appreciated.


Old May 1st, 2007, 12:19 AM
Friend of Wrox
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post

As per i know what you should do is when the user clicks on paste you need to read the data in the clipboard and create an image [ImageIcon class,you can use the constructor which takes byte data as parameter] and use the graphichs object [JPanel.getGraphichs()], call the drawImage() method.

you get information about reading from a clip board at the following URL

Hope it gives some start.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bitmap Transparency tahcue C++ Programming 0 December 19th, 2007 07:45 PM
Using bitmap in C# ? nobitavn94 C# 2005 0 January 8th, 2007 06:12 AM
JPanel components on same line biffta Java GUI 2 September 1st, 2005 06:18 PM
Can I add a JComboBox twice to the same jpanel david.byrne Java GUI 4 May 14th, 2005 11:42 AM
Bitmap ls233 Visual C++ 0 November 17th, 2003 06:07 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.