The Artima Developer Community
Sponsored Link

Java Answers Forum
How can I get a Companent's content and show it in another new Companent?

1 reply on 1 page. Most recent reply: Jul 7, 2005 6:13 PM by Antonio

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
eddy

Posts: 1
Nickname: gtm
Registered: Oct, 2004

How can I get a Companent's content and show it in another new Companent? Posted: Oct 12, 2004 10:52 PM
Reply to this message Reply
Advertisement
Recently,I have benn working on UI.
And i use the MouseEvent.i want to Drag a Component and then will Drag a new Component has the same content.Just something like the workbench of JBuilder.The porbelm is i can't get the content of the Companent to be showed on new panel. I use the Method getGraphics() to get the being dragged Companent's Graphics Instance.And let the new Companent Paint this Instance,failed.
And then, I try to the Method Companent.CreateImage to get the Image Instance of the being Dragged Companent's content.And let the new Companent drawImage.but,failed again.but i use a existed Image instead,it works. Do the Companent's Image and Graphics can't not be paint or draw in two Companent?How can

i get the being Dragged content?


Antonio

Posts: 33
Nickname: arhak
Registered: Jul, 2005

Re: How can I get a Companent's content and show it in another new Companen Posted: Jul 7, 2005 6:13 PM
Reply to this message Reply
Why don't you read some documentation about Drag&Drop mechanisng instead of doing it manualy.
Start a travel around the Drag&Drop package at java.awt
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/dnd/package-frame.html
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/dnd/DragSource.html
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/dnd/DropTarget.html

Flat View: This topic has 1 reply on 1 page
Topic: translator in Java... Previous Topic   Next Topic Topic: How do I get a highlightPainter?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use