aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Urgent..Need some help... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Urgent..Need some help..." Watch "Urgent..Need some help..." New topic
Author

Urgent..Need some help...

Riddhi Joshi
Greenhorn

Joined: Dec 29, 2002
Posts: 21
Hi Everyone,
I have always been turned down at this site as I have never got my answeres here. I hope I could get it this time.
I have a small problem. If anyone could help me figure out how to "paste" text in other application using java. I know how to copy it on the system clipboard using Clipboard method. I also know how to paste in textarea or textfield or java enabled component. I dont know how to paste in other application like word or microsoft outlook using a jbutton or something like that.
I am really looking forward for an answer.
Thanks,
Riddhi.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451

I have always been turned down at this site as I have never got my answeres here. I hope I could get it this time.

I can't speak for everyone, but my experience has been the total opposite. Yes, there have been times that some of my posts went unanswered, but those have been few and far between. If all of your posts are like this one, then the problem lies with what you are wanting to do with Java rather than fellow Ranchers snubbing you. Java's strength is in the philosophy write once, run anywhere. What you are wanting to do here is inherently platform dependent. In a nutshell to accomplish your task you will have to interact with an ActiveX object. That's probably going to require some native code be written. You can get the System Clipboard with Toolkit.getDefaultToolkit().getSystemClipboard(). Once you setContents() on the Clipboard then those contents become available to any Clipboard aware program on the system. You can then select Paste manually in those programs. Now in the case of MS Word, it may be possible to write a VB macro to periodically scan for changes in the System Clipboard and react to it there. That would save you from writing any native code and using JNI. The JavaBeans Bridge for ActiveX may be of help to you also. You can find it here JavaBeans ActiveX Bridge.
I am sorry that your experience at JavaRanch hasn't been what you expected, but I assure you that most of here love nothing better than analyzing a sticky problem and seeing if we can beat the gurus to a correct solution. I personally hope that you don't give up on us, because as a community, I guarantee you we can help you become a better Java programmer.
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

I would also suggest that you will get more people reading and answering your posts by giving them more meaningful subjects than " Urgent..Need some help.".
Hope this helps!
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
I think you are more likely to get a response if you post this in the Swing forum.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
As Thomas suggests, moving this to the Swing forum.
Jessica Sant
Sheriff

Joined: Oct 17, 2001
Posts: 4313

Originally posted by Riddhi Joshi:
I have always been turned down at this site as I have never got my answeres here. I hope I could get it this time.

Actually -- I looked at your last five posts and all but one has several replies. One helpful thought would be to give your problems a more descriptive title. And I can almost guarantee you that the word "urgent" is not going to get your post answered anytime soon. Last thing -- try not to post the same question in multiple forums.
*sigh* -- so after all that -- hopefully you've gotten stuff off your chest, as I have off mine... I really hope you come back to the javaranch with more questions and *hopefully* (even better) you'll come back to return the favor and answer some OTHER people's questions. 'Cause that's what makes this place great.


- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
To be blunt, you won't get good responses until you try a different approach to asking questions.
For example, take a moment to read the titles of some of your previous posts. Mark Herschberg said recently:
My guess is marking something "urgent" probably increases the response time. I try not to respond at all to posts marked "urgent."
I also rarely respond to topics marked "urgent".
There's a well-known essay, How To Ask Questions The Smart Way. Here are a few sections relevant to you.
Write in clear, grammatical, correctly-spelled language. Avoid omitting apostrophes (use won't, not wont) or doubling question marks or failing to capitalize when necessary and such. It can be difficult if English isn't your first language.
It also helps to be direct. For example:

I wanted to know how can I print an image or a JDialog using java. I know the method
getPrintJob(). But it takes Frame as an argument. I want to print a JDialog.
I was wandering if anyone can help me out with this.
Thanks,
Regards,
Riddhi.

Might get better responses if it were stated like this:

How can I print an Image or a JDialog? I know the method
getPrintJob(), but it takes Frame as an argument. I want to print a JDialog.
Thanks,
Riddhi

And of course Use meaningful, specific subject headers and Don't flag your question as "Urgent", even if it is for you
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Sorry, but I cannot help you because I have only just started making my first button in Swing. I have bought some books on Swing and if, when reading them, I find something like your question I'll let you know. I normally work with Linux or Solaris, but it must be the same on MS with Word, Access and Exel, would it not?
BTW I have a very urgent question for you, is it possible to embed Visual Basic Script into Java with JNI? Thanks, I am anticipating your reply, I need it this afternoon...
-Barry


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
http://jawinproject.sourceforge.net/


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Jawin could probably be the answer to both Barry and Riddhi's questions...

For Riddhi's - copy the text from Java into the system clipboard, and then use JaWin to call a windows DLL that makes the app paste from the system clipboard.

And Barry ( if you are serious about your question... ) you can call the windows DLL's that manage VBScript through JaWin...


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Riddhi Joshi
Greenhorn

Joined: Dec 29, 2002
Posts: 21
Hello Everyone,
I apologize if I have hurt your feelings. I did not mean to do that. I was concerned as I had to get the answer as soon as possible. However, I do not agree with Mr. David who says that I do not use proper language to define my question as English is my second language. I think my questions are always clear. "dont" or "don't"-people get to know what I am talking about and moreover, its a Java Forum and not Grammer lessons forum.
I agree with Mr. Micheal that I have got the answers but it was just recently that I did not get any when I trusted javaranch the most and I was in need of that.
I am not here to argue with anyone. I just need some help and that is the reason I rely on you all.
To what Mr. Micheal suggested me, I am doing the same thing. I am using the
getSystemClipboard() and I use setContents() to copy the text/image to the system clipboard. I also did getContents() for pasting. However, it pastes if Java knows where to paste it. It means, if Java knows that it has to paste in some JTextArea etc., it pastes it right away. However, it does not paste if I give command to open MS Outlook using getRuntime.exec() and ask paste in there. I tried typecasting the object into image and then paste it. It pastes some object, but it does not paste the image. I don't have solution for this. Can you suggest me anything?
Thanks,
Riddhi.
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
However, I do not agree with Mr. David who says that I do not use proper language to define my question as English is my second language. I think my questions are always clear. "dont" or "don't"-people get to know what I am talking about and moreover, its a Java Forum and not Grammer lessons forum.
I didn't say that you weren't using proper language -- fine language in fact. The article I linked to explains what I mean better then I can. For example, the section "Prune pointless queries" says:

Resist the temptation to close your request for help with semantically-null questions like "Can anyone help me?" or "Is there an answer?" First: if you've written your problem description halfway competently, such tacked-on questions are at best superfluous. Second: because they are superfluous, hackers find them annoying � and are likely to return logically impeccable but dismissive answers like "Yes, you can be helped" and "No, there is no help for you."

Consider this very thread: "Hi Everyone", "I have a small problem", "I am really looking forward for an answer".
Anyway I'm not going to say anything else. Just read the article.
Riddhi Joshi
Greenhorn

Joined: Dec 29, 2002
Posts: 21
I agree that I was desperate to get an answer as I was in need of that as soon as possible.
But what Mr.David wrote:
"Write in clear, grammatical, correctly-spelled language. Avoid omitting apostrophes (use won't, not wont) or doubling question marks or failing to capitalize when necessary and such. It can be difficult if English isn't your first language."
I dont think English Grammer is such an important thing as far as posting questions is concerned. As long as a person makes his/her question clear, so that everyone could understand, its fine. I thought that I was making my questions clear.
Again, I am not here to argue or prove my point. As long as I get my answers, I am fine and satisfied.
Thanks,
Riddhi.
basha khan
Ranch Hand

Joined: Jan 18, 2002
Posts: 87
hi joshi,
I think joshi understood the problom.
here 's me
Allmost all of my Q's are answered. and the quality of answers??..simply elegent.

present the questien correctly and discuus to reveal the truth.
javaranch never dissappoint u.
basha
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
You have to put something in the clipboard in the exact format that the other application is expecting. Here's an example using JTable & Excel
When you say you were able to paste "some object" but not the image, it sounds like you're not providing what the target application expects. Maybe use a non-Java app to copy an image into the clipboard, then examine it byte by byte to figger out the format?
[ March 31, 2003: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Urgent..Need some help...