Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 28th, 2007, 05:07 AM
Authorized User
 
Join Date: Nov 2005
Location: , , United Kingdom.
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.

        AndrewH:)

Reply With Quote
  #2 (permalink)  
Old May 1st, 2007, 12:19 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,
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
http://java.sun.com/j2se/1.3/docs/gu...atransfer.html

Hope it gives some start.

Regards,
Rakesh
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bitmap Transparency tahcue C++ Programming 0 December 19th, 2007 06:45 PM
Using bitmap in C# ? nobitavn94 C# 2005 0 January 8th, 2007 05: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 05:07 PM



All times are GMT -4. The time now is 05:08 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.