How to paste to a JTextField

Hello,
I have my copy and paste buttons working for a text area. But im trying to get my program to work that I open a browser from the main applet menu and i want to be able to copy from my text area and paste it into my URL text field in my my browser.
Is this possible what im trying to do and how do i do it???
if(source == edit_paste)
//gets the position of the text insertion caret for inputArea
getcaretposition = textArea.getCaretPosition();
textArea.insert(copy_text , getcaretposition);
if(getcaretposition == 0)
JOptionPane.showMessageDialog(null , "There is no text to be pasted");
Rgds,
Tony

Hi,
You can create a JTextField and override the copy() and paste() functions found in the JTextComponent.
JTextField jTextField = new JTextField()
public void cut() {}
public void copy() {}
public void paste() {}
this also disables cut().
The text is still selectable, but cut/copy/paste does nothing.

Similar Messages

  • How to paste attributes from one photo to a selection of photos?

    When I try to copy attributes (i.e: white balance, etc) from one photo and paste to a group of other photos, the attributes are only pasted to the most selected (first) photo of the group. The result is the same whether I use the menu or keyboard shortcuts for the copy and paste. Does anyone know how to paste the attributes to the entire group in one fell swoop?

    Are you selecting the group of images from the grid view or from the filmstrip at the bottom of the library module?  I have found that many operations are only applied to the first image in a selection if the selection was made from the filmstrip at the bottom of the library module.  If the group of images is selected from the grid view, then the operation applies to all the images selected.
    I hope that helps.
    Walt
    B & B Photography

  • How to paste a text in a selected textframe

    Hi, for a new script I would like to paste some text in a textFrame.
    I would like to select my text, copy it and run my script.
    My script locate a textframe, select it.
    I don't know how to paste in the content of the selected textframe.
    app.paste();
    Paste is OK, but it create a new textframe while the block is well selected.
    Can you help me?
    thx!

    So it works the same as it does in the interface itself. Try it: copy text, select (but do not enter) a text frame, hit Paste. A new text frame appears.
    To get what you want, you need to put the text cursor inside your selected frame. That's not a function but fortunately this weird-looking command works:
    app.selection[0].insertionPoints[-1].select();
    app.paste();

  • How to paste text in Adobe Muse with same color where i copied this text?

    How to paste text in Adobe Muse with same color where i copied this text?

    Copy&paste is a function of your browser, not the forum software. Ctrl+V will work just fine.
    Mylenium

  • How to paste arabic and russian text in indesign and have the fonts recognized?

    How to paste arabic and russian text in indesign and have the fonts recognized?

    There is a preference item for clipbaord handling that toggles text ony or formatted text when pating from external applications. You may be pasting unformatted text.
    And of course the fonts must be installed...

  • How to paste screen shot in the forum editor

    please help
    how to paste screen shot in the forum editor

    Do you see the "Attach Files" button in between the "Preview" and "Post Message" buttons when posting a question or reply? 
    This is how you would attach an image, you can't embed it into the text here.  Also,  I thought that the "Attach Files" functionality had been removed for performance reasons, but you can try it if you see the button.
    Regards,
    Rich Heilman

  • How to paste pictures into email account signature

    How to paste pictures into email account signature. I cannot get the pic to be visible. I have an iPhone 6 Plus

    I think I got it to working, IMbatman13folllowing the directions from that thread.
    I created a signature on my laptop.  Included a png in it. 
    Sent an email with that signature to myself on my iPhone. I did not put a message in the body.
    Opened it up on iPhone. Selected entire 'body'.  Copied all.
    Went into Settings, Signatures, Selected a different email account, pasted in what I had copied.
    And it worked.

  • How can i make a JTextField not scroll

    i have a JTextField which can show 10 columns, while i setText 20 cols, but i do not want the TextField scroll to show it all, any idea? thx

    Setting the columns on a JTextField is only used so Swing knows how big to paint the JTextField. It you want to limit the number of characters that can be contained in the JTextField, then you should use a Custom Document. The Swing tutorial on "Using Text Components" will explain more about Custom Document and give you and example document that limits entry to 300 characters:
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html

  • Working with Chinese characters: How to paste and modify them as sentences; not as individual images?

    Working with Chinese characters: How to paste and modify them as sentences; not as individual images?
    From 2004, this is so far the most detailed answer I could find: http://en.allexperts.com/q/Adobe-Illustrator-1027/FONTS-display-problem-Adobe.htm, but is this really still the most up-to date solution?
    Is it possible at all to work with Chinese characters, if I don't have the Chinese version of Illustrator? (http://www.proz.com/forum/dtp_desktop_publishing/221125-chinese_in_indesign.html)

    Thanks for your reply.
    I'm using Version 17.1.0 (64-bit) - basically CS6.
    Operating system is Windows 8.1. Installed is the simplied Chinese language package.
    I have received the text in a Word document. It contains mixed characters, something like this:
    教授资料
    学术背景:
      博士;曾于波恩大学(Rheinische Friedrich-Wilhelms-Universität Bonn)、台湾师范大学、
    I have tried to paste it in the two following ways:
    1) to create a text box and paste the text. The result is that some of the characters are not showed correctly.
    2) Paste it directly without any preparation. This result into a single "image" or group of images. I can cancel modify each character one at a time, or I can dissolve the group, but the result is the same.

  • How to paste excel chart into word

    how to paste excel chart into word?

    Assuming you are using Office for Mac, you might want to ask your question in the Office for Mac forums where the Office for Mac gurus hang out. http://answers.microsoft.com/en-us/mac?auth=1

  • How to paste proc of 1200 lines

    Hi,
    I have to tune a procedure of around 1200 lines. It consists of many selects. How to paste the query and explain plan for that proc.
    Thanks,

    979892 wrote:
    I need help on that procedure. So, can I paste such a long procedure or have any alternate solutions? Please help meAs APC says, it's going to be too long.
    Have a look at you explain plan. Can you see a part of the query that is taking the most time?
    Can you extract out and run just that bit and get the explain plan for that?

  • How to paste image to jpg?

    Hey.
    I recive an email included an embeded picture. I use gmail app and i can copy picture to clipboard, but i dont know how to paste the picture to new file and save as jpg. I can paste to new mail im gmail app or origin Apple mail app. I cant paste to pages document. Do You know some app wicth i can use to mąkę new jpg file?

    The App already includes the feature. But the image has to be sent as an attachment rather than embedded in the email.
    As per Gmail's own help document:
    Google wrote:
    Note: Photos that are embedded within the message can’t be saved to your Photo Gallery. The photo must be added as an attachment.
    Download photo attachments to Photo Gallery
    https://support.google.com/mail/answer/2926444?hl=en&ref_topic=1706314
    You could always try to open the email through the default mail app. Embedded Pictures in emails can be saved just fine from there.

  • Does anyone know how to paste a screen shot?

    Does anyone know how to paste a screen shot (command, shift,3) into a microsoft word for mac document? Every time I try to "paste" all I get is the previous item I cut or copied and not the screen shot...

    Post on the MS Mac forums, as it's their software you're having issues with:  http://answers.microsoft.com/en-us/mac

  • How to paste a hyperlink

    I am still a newbie to my Mac and I can not seem to figure out how to paste a hyperlink where someone else can just click on the link I send them and not have to cut and paste the link.
    Thanks

    Hi Ali B,
    Thanks for your reply, I did mean the link (URL) in Discussions and a Link within a Thread - Which is why I was confused. I also do not read code. I'm not so sure that Herknav meant this - I think he was asking about for mail and etc.
    Hi Herknav, If you were asking for your mail or ichat then - Highlight the http:// address on your top tool bar - then choose Edit > Copy - then go to whatever you're typing to and click the cursor (flashing vertical line) to the spot you want the link to appear - then at your top tool bar again choose Edit > Paste and your link should paste to the location you had put your flashing cursor....It will not look like it's active - however once you send it you can check in your send folder and see it's highlighted as a link that can be clicked.
    Hi Brian Eater,
    I already use the copy-paste for mail and ichat - I was trying to understand George Orville's informed help - and assumed it was for threads and discussions. Thanks for your reply.

  • How to reach that a jtextfield only accept characters?...

    I tried it...doing:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=394377&tstart=0&trange=15
    But.....i realized that is necesary to introduce the exact number of characters so the characters don't be removed.....somebody has other idea or suggestion about how is the best way to reach it?....
    Thnaks in advance..
    Mary....

    You just need to create a class that extends PlainDocument, and override the method insertString, try using the codes, I haven't tested the code but it should work:
    public class CharacterField extends JTextField {
    public CharacterField(int cols) {
    super(cols);
    protected Document createDefaultModel() {
         return new CharacterDocument();
    class CharacterDocument extends PlainDocument {
    public void insertString(int offs, String str, AttributeSet a)
         throws BadLocationException {
    /*Here str is the string typed or pasted by the user
         if (/*Condition or match for being characters*/) {
         super.insertString(offs, str, a);
    Create an object of the CharacterField class and it will accept only the string which matches your condition.

Maybe you are looking for