Clipboard problems

Im working on a simple encryption applet, but I have trouble with copying and pasting text from other applications into my applet.
Within my applet, i can use Ctrl + C or Ctrl + V to copy and paste text but the applet does not seem to respond to text i copied from somewhere else, and I cannot paste text from my applet to any other application either.
So, I tried looking in the Java documentation, and I came across the awt toolkit where i can access the system clipboard. I used their example on how to use it, but even with that, i have no luck. when I try to cut / paste nothing happens at all.
this is a code snippet for the copy and paste segment.
public void actionPerformed(ActionEvent e) {
         //Paste text
         if (e.getActionCommand().equals(PASTE)){
               Transferable t =
                       Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
               try {
                    if (t != null && t.isDataFlavorSupported(
                         DataFlavor.stringFlavor)) {
                    String s = (String)t.getTransferData(
                        DataFlavor.stringFlavor);
                      input.setText(s); //input is a JTextArea
               catch (UnsupportedFlavorException e2) {
               catch (IOException e2) {
         //Copy text
         if (e.getActionCommand().equals(COPY)){
              StringSelection out = new StringSelection(output.getText()); //output is a JTextArea
              Toolkit.getDefaultToolkit().getSystemClipboard().setContents(out, null);
}I'd appreciate any help. I'm stumped.
Thanks,
Alvin

try this:
for Placing Text on the System Clipboard
StringSelection ss =
   new StringSelection("aString");
// The following 2 lines of code must be
// on the same line
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);for Retrieving Text from the System Clipboard
// The following 3 lines of code must be
// on the same line
Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
try {
   if (t != null && t.isDataFlavorSupported(
     DataFlavor.stringFlavor)) {
       String s = (String)t.getTransferData(
         DataFlavor.stringFlavor);
       process(s);
} catch (UnsupportedFlavorException e) {
} catch (IOException e) {
}

Similar Messages

  • Acrobat Reader 9.5.0 has Clipboard problems

    Repro:
    Launch Microsoft Word 2010.
    Launch Adobe Reader one any Web document.
    Switch to Microsoft Word and Copy some text onto the clipboard.
    And quickly switch back to Adobe Reader and copy some text from there.
        "There was an error while copying to the Clipboard.  An internal error occurred."
    > KernelBase.dll!_RaiseException@16()  + 0x58 bytes
      msvcr80.dll!72ae8e89() 
      [Frames below may be incorrect and/or missing, no symbols loaded for msvcr80.dll]
      AcroRd32.dll!024c3371() 
      AcroRd32.dll!024c38e4() 
      AcroRd32.dll!01fac1e2() 
      AcroRd32.dll!01facaa2() 
      AcroRd32.dll!02093802() 
      AcroRd32.dll!020938d9() 
      AcroRd32.dll!01fac265() 
      AcroRd32.dll!02066b37() 
      AcroRd32.dll!0216cfc6() 
      AcroRd32.dll!020910fd() 
      AcroRd32.dll!02092f1d() 
      AcroRd32.dll!01e1d007() 
      AcroRd32.dll!02042d80() 
      AcroRd32.dll!0204367b() 
      AcroRd32.dll!01fa806e() 
      AcroRd32.dll!0216f585() 
      AcroRd32.dll!0206cd78() 
      AcroRd32.dll!01f99a4e() 
      AcroRd32.dll!01f99b47() 
      AcroRd32.dll!01f05ba6() 
      AcroRd32.dll!01f05930() 
      AcroRd32.dll!01f058a7() 
      AcroRd32.dll!01f05396() 
      AcroRd32.dll!01f052ab() 
      AcroRd32.dll!01e13976() 
      kernel32.dll!74f1140f() 
      0051fe58()
      00000003()
    Clearly Acrobat Reader has a problem.  If you point me at the symbols for AcroRd32 I'll help debug it for you since I can repro it easily.

    Here are few solutions:
    1. You can configure firefox to open pdf in external application like acroread. This way plugin problem is bypassed. - I use it this way. It looks to be faster this way.
    2. "C:\nppdf32Log\debuglog.txt" is created every time in directory from where you executed firefox/opera/other browser and opened any pdf file in browser. So this is not only home directory. You can fix this problem by yourself by hex editing nppdf.so file and replacing C:\nppdf32Log\debuglog.txt path in this file with /dev/null path. See my post here for detailed instructions: http://forums.adobe.com/thread/1253800

  • Native -- DataFlavor clipboard problem

    I'm trying to access vim specific clipboard data (to get visual block info). This is on windows XP (unix is next) I've registered the formats with addFlavorForUnencodedNative, see java code below. But when I look at all the clipboard flavors, when clipboard contains vim stuff, no vim flavors show up, see output.
    Any ideas of what/where the problem might be?
    Thanks,
    -ernie
    In vim, from its os_win32.c, there is
        clip_star.format = RegisterClipboardFormat("VimClipboard2");
        clip_star.format_raw = RegisterClipboardFormat("VimRawBytes");and when a vim copy to clipboard command is issued, in vim's os_mswin.c. Note that cbd->format is clip_start.format, returned from RegisterClipboardFormat above.
    SetClipboardData(cbd->format, hMemVim);
    SetClipboardData(CF_UNICODETEXT, hMemW) != NULL)
    SetClipboardData(CF_TEXT, hMem);When I run the java program I get the following output. First are the mimetype of the 3 native flavors I added; in cb.getAvailableDataFlavors() none of them appear in the 27 flavors available.
    VimClipboard application/vimclipboard; class=java.nio.ByteBuffer
    VimClipboard2 application/vimclipboard2; class=java.nio.ByteBuffer
    VimRawBytes application/vimrawbytes; class=java.nio.ByteBuffer
    27 flavors
    application/x-java-text-encoding; class="[B"
    application/x-java-serialized-object; class=java.lang.String
    ...Here's the java code that is not finding the vim clipboard native data
    /* Main.java; access vim's clipboard */
    package vimclipapp;
    import java.awt.Toolkit;
    import java.awt.datatransfer.Clipboard;
    import java.awt.datatransfer.DataFlavor;
    import java.awt.datatransfer.FlavorMap;
    import java.awt.datatransfer.SystemFlavorMap;
    public class Main {
        static DataFlavor VimClipboard = addFlavor("VimClipboard");
        static DataFlavor VimClipboard2 = addFlavor("VimClipboard2");
        static DataFlavor VimRawBytes = addFlavor("VimRawBytes");
        static DataFlavor addFlavor(String cbName) {
            DataFlavor df = null;
            FlavorMap fm = SystemFlavorMap.getDefaultFlavorMap();
            SystemFlavorMap sfm = (SystemFlavorMap) fm;
            try {
                df = new DataFlavor(  "application/"
                                    + cbName
                                    + "; class=java.nio.ByteBuffer");
            } catch (ClassNotFoundException ex) { ex.printStackTrace(); }
            System.err.println(cbName + " " + df.getMimeType());
            sfm.addFlavorForUnencodedNative(cbName, df);
            sfm.addUnencodedNativeForFlavor(df, cbName);
            return df;
        public static void main(String[] args) {
            Clipboard cb = Toolkit.getDefaultToolkit().getSystemClipboard();
            if(cb.isDataFlavorAvailable(VimClipboard2))
                System.err.println("VimClipboard available");
            DataFlavor dfa[] = cb.getAvailableDataFlavors();
            System.err.println("\n" + dfa.length + " flavors\n");
            for (DataFlavor df : dfa) {
                System.err.println(df.getMimeType());
    }

    Are you using Gmail?
    Try deleting the email profile, tap battery, tap restart, go into email and reinstall the profile.

  • Clipboard problem in CS5

    We often have to copy images in Word documents and paste them into a new file in Photoshop.
    Hitting New... in CS4 Photoshop opens a blank file of the correct size and resolution to paste in the clipboard file.
    CS5 cuts the file down to a tiny size and resolution.
    eg a 26MB file on tghe clipboard ends up as a 350k file when pasted.
    Any idea whats going on and how to fix it?

    When copied, 'Show Clipboard' does not show a pic....says it is RTF.
    Pastes perfectly into Text Edit and into Photoshop (CS4)
    Just CS5 PS seems to have a problem with it.
    We dont use Word except to extract stuff from files people send us and our copy of Word X is rather old.
    Maybe therein lies the problem.
    I will try with a newer version of Word.
    Incidentally, experimenting...printing a pdf from the Word file and then copying and pasting from the PDF works fine... copy from a pdf puts a tiff on the clipboard.
    But that is a pain so for the time being we will carry on using PS CS4 for this until a better solution comes up.

  • Clipboard problem

    All, I haven't been able to find such a topic so I assume I am the first one to ask, sorry if not...
    My problem is that the clipboard doesn't work between several applications :
    Camino -> mail
    Word -> mail
    Camino -> Text
    Smultron -> mail
    The clipboard keeps the previous text copied for Text or mail and doesn't paste the text that I have just copied but pastes it correctly in word, smultron or other applications...
    How is it possible with the best OS in the world that I can not copy paste from my browser to a simple mail ?? Do you have a solution to solve this issue or am I the first one experiencing bugs with the clipboard ?
    Thank you in advance for your help.

    HI and Welcome to Apple Discussions...
    *"How is it possible with the best OS in the world that I can not copy paste from my browser to a simple mail ??"*
    It's your 3rd party software, not the Mac OS X.
    Read "a brody's post here regarding 10.6 and 10.6.1
    http://discussions.apple.com/thread.jspa?messageID=10180165#10180165
    Carolyn

  • What's this??  (clipboard problems)

    Getting "OpenClipboard Failed" error in dreamweaver.
    Clipboard works
    in every other application. Never had a problem before. A
    bug?

    Are you running Norton Security? Looks like a notification that it detected and blocked a portscan from the outside world. You probably could have clicked on "Learn more about this attack" to ... learn more.
    A portscan is a detection method to see what network vulnerabilities you have. Think of it like a burglar trying the doors and windows. Generally this only tends to be a problem if you have a computer hooked directly into the internet and don't have a firewall or other protection. Adding a wired or wireless router between your computer and your modem can help protect against incursions.
    If you're not running Norton, and it just appeared while you were browsing, it's a spam popup designed to scare Windows users into downloading malware, and you can just close the window and ignore it.
    Matt

  • ClipBoard problems with Views

    Hi
    I once tried using views in ClipBoard
    It worked
    However now Views don't seem to be working at ll
    In the sense , it permits to insert a row but not the BLOB or image data into the table thru the view
    Well, the details are as follows
    Table CONTENT
    id number(10) PK
    content OrdSys.OrdImage
    View CONTENTVIEW
    select * from CONTENT;
    Now I use this view for uploading the documents thru Clipboard
    It permits to insert a row but not upload the document itself
    The error is
    "table not found"
    I tried having the table as well as the view in the same schema, it still does not work
    Any solutions please
    nandeep

    Well, Mizuno
    Thank you once again.
    i recollect that you had warned me .
    I have a problem here.
    We have around 10 content managers
    And each need to have his own login name and password.
    Haveing seperate schemas does not seem to work out.
    Any solutions
    Also security is a problem
    One more thing is that we wanted to have a history table which will store even the versions of the content.
    Do database triggers work with OrdImage type or the BLOB datatypes?
    Or will they give some problems?
    Or is there a better approach for this problem
    Even synonyms do not work in ClipBoard by the way.
    It is only the table and nothing but the table
    Thank you
    nandeep

  • Clipboard problems in conjunction with Word 2004 and Acrobat 7

    Does anyone else out there have problems with Word and Acrobat crashing when you are doing a cut and paste? I sometimes get problems with cutting and pasting in word, and sometimes I get it trying to paste text from acrobat to word. Could be word related, but it feels more like the clipboard is getting too full, and dragging the clipped application down with it. There are no warnings. Any ideas?
    iBook G4   Mac OS X (10.3.9)  

    Hello TL49,
    Welcome to the HP Forums.
    I understand that you're having an issue printing envelopes in Word 2011 on your Mac 10.9 with the Officejet 100 mobile. I will do my best to assist you with this.
    Please make sure you have downloaded the full feature software for your printer from hp.com.
    Remove and re-add your printer.
    Choose Apple menu > System Preferences Then choose View > Print & Scan
    Highlight the printer and click the (-) to delete it.
    Click the (+) to setup printer. Choose add other printer/scanner.
    Make sure the "Use" is set to the HP mobile 100 and not Airprint.
    Close out of Word and restart the Mac after adding in your printer.
    Try printing envelopes in Word 2011 to test.
    Please let me know how you make out, and thank you for posting on the HP Forums.
    I worked on behalf of HP.

  • Clipboard problems etc

    Hi, can anyone help please, I'm having a really weird problem, my iTunes just keeps on loading up! I quit it and within a minute or so it loads again by itself, it's driving me mad!!
    Also I am having problems copying artwork from Illustrator into Photoshop. I keep getting the message: Could not complete the paste command because of an error getting data from the clipboard or another application. These two problems seem to have come around at about the same time, least I think. Could they be related?
    I have tried changing the enable version cue on and off in Illustrator prefs but this doesn't help.
    I've also tried restoring the permissions but still no change. I've never had this problem before until now.
    Anyone got any ideas?.....PLEASE!!!
    Thanks.

    Thing is, I hadn't had iTunes running when it started happening and I also have an iTunes widget which I've had for ages but it's only recently that this has started happening.
    Thanks for the reply though.

  • More clipboard problems

    I use a multi clipboard called Spartan. With Click to call installed, i cannot paste into my browser.

    I'm having similar problems. Just got the iPod Touch 4th Gen a week ago and now it crashes multiple times throughout the day. I turn off the Wi-Fi or set it to Airplane mode, when I go to bed at night, and when I wake the battery is drained, not completely but what is causing this if the unit is off.
    Today it has crashed 5 times in 1 hour. Will calling support later today, but at this point I'm ready to send it back and request a refund or exchange. You would think that after spending ~400 dollars that there wouldn't be issues like this. It's partly my own fault for not looking through all the problems that have been plageing these products for some time now.

  • Clipboard Problem in JTextArea

    I am writing a text editor in swing and when i used the system clipboard for my JTextArea, the pop-up menu of cut,copy,paste delete and select all that normally appears in TextArea didn't appear. What could be the possible solution? Please note that when i use TextArea instead of JTextArea, my menubar goes behind the text area, and thus creates problem.
    Could anyone give me a hand please? I would request you to be elaborative and give me some lines of codes if you can find the solution.
    Thanks

    JTextArea by default does not show the drop down menu. You have to trap the right click on the JTextArea and show the JPopupMenu. Also, to enable cut, copy, paste etc.. you have to call the JTextArea.cut(),copy(),paste() and the selectAll() methods on the action event occuring during the menu item selection of your popup menu.
    Cheers

  • Clipboard problem Xfce 4.8

    Hi,
        I am getting inconsistent behavior with clipboard from any applications since the upgrade to Xfce 4.8, in QT applications i get this error after close the app "QClipboard: Unable to receive an event from the clipboard manager in a reasonable time", I have upgraded at the same time the kernel to use kernel26-bfs, do anyone can reproduce this problem with xfce 4.8, kernel26-bfs or both?

    seems to be a mainstream bug http://bugzilla.xfce.org/show_bug.cgi?id=6521

  • Copy/Paste/Clipboard Problem; Pastes only as SVG Code

    I have Illustrator CC installed, as well as Illustrator CS6, running Windows 7 x64, latest patchlevel. When I try to copy and paste objects in Illustrator CC, I always get a SVG code. I draw a simple rectangular, copy it, paste it, it's not pasted as a rectangular, it's pasted as SVG code. Same with an embedded JPEG. Copy it. paste it. et voila, SVG code...
    In Illustrator CS6 everything works as i would expect it. Highlight object, cmd+c, cmd+v, ok.
    In CC, highlight object, cmd+c, cmd+v => svg code [<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In  --> etc. pp.] This always happens, no matter where (copy in illustrator cc, paste in the same illustrator document, word, photoshop, etc) or what (drawn object, jpeg, embedded, linked, gif).. I've tried different clipboard settings in Illustrator CC, it makes no difference.
    HELP!

    Of cause it is, but still I think it's a bug.
    I don't think it should work this way. First, Include SVG Code to me is not equal to Replace copied objects by SVG Code. When I copy an object from an Illustrator file and then try to paste it back into an Illustrator file, why should I get code instead? Second, that code was not pasted every time. Just about every second or third time. Sometimes it worked with a single object, sometimes to get that SVG code I had to copy/paste multiple objects, while pasting single objects worked as expected. So, to me it looks like a bug.
    And anyway, even if this function is supposed to replace objects with code, it should not be ON by default, not all of Illustrator users are developers. My estimate, most of us are not, actually.

  • Java - system clipboard problem

    I'm trying to put text from a java program to the system clipboard (OS) and I can't make it work.
    I've included a small code example in this post.
    import java.awt.datatransfer.*;
    import java.awt.*;
    import java.awt.Toolkit.*;
    class ClipTest{
    public static void main(String[] args){
    new ClipTest();
    public ClipTest(){
    StringSelection clip = new StringSelection("hello");
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    clipboard.setContents(clip,clip);
    System.exit(0);
    After running the program I would expect to have "hello" on my System clipboard. But I don't. Nothing has been transfered to the clipboard.
    I'm running java1.3.1 on IRIX and I have tryed Linux as well.
    Am I doing something wrong here? Please enlighten me.

    That's a thought. but take this code example though:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class MyTextArea extends JTextArea implements ActionListener{
    JTextArea m_txt;
    JPopupMenu m_menu;
    public MyTextArea(){
    super();
    m_txt=this;
    addMouseListener(new RightMouseListener());
    m_menu = new JPopupMenu("Menu");
    JMenu item = new JMenu("Edit");
    m_menu.add(item);
    JMenuItem item1 = new JMenuItem("Copy");
    item1.addActionListener(this);
    item1.setActionCommand("copy");
    item.add(item1);
    class RightMouseListener extends MouseAdapter{
    public void mouseClicked(MouseEvent e){
    if(e.getModifiers()==InputEvent.BUTTON3_MASK){
    m_menu.show(m_txt, e.getX(),e.getY() );
    public void actionPerformed(ActionEvent e){
    if (e.getActionCommand().equals("copy")) {
    copy();
    If you use this component in a dialog or something, type some text in it, make a selection, righclick and choose copy from the edit menu, I get the same result, and I guess it will work at your Windows platform?

  • Clipboard problems (PNG files)... HELP!

    Ok... This is a big one for me, just bought a new laptop with 10.6 on it, and yes Freehand is running great... EXCEPT, I can no longer paste art from Illustrator into Freehand, everything that I try to cut and paste is now a PNG file... before it was perfect... yipes!
    This is a big deal for me because I need to rework bad art in Illustrator and I do it in Freehand... can anyone help...
    ...Judy???

    > Edit > Paste Special... lets you choose the format of the clipboard that will be pasted. I defined a shortcut to save time.

Maybe you are looking for

  • How to increase font size of pdf attachment?

    hi Experts,                   i am facing a problem to increase the size of pdf attachment which is generated through spool no. The spool is generated with line size 120. if i increase the line size  then still no impact on size in the downloaded pdf

  • Deleting movie clips in the "my video" section.

    How do I delete the videos in the videos section of Itunes. I have tried left click and right click but none of them have the normal delete section so I can permanently remove the picture and the video. If anyone can help with this i would appreciate

  • Programming a Chess-game - Design Tips

    Hello, I'm definatly not new to programming, but I'm a beginner at Java. Now I'm trying to program a little chess-game, which should teach me some OOP-techniques and to get some experience with Java. Well, I have some ideas for the game in mind and a

  • House bank and multiple co. code

    hi gurus,              if we have bank accounts of multiple co code in a single branch eg co code 1000            co code 2000 branch dehli bazar     branch dehli bazar ac#12000003             ac#13000004 branch is same for both co codes . do we need

  • Error trap with Start-Process

    I am trying to use Start-Process to drive Regedit merging a REG file with this code. Start-Process regedit -Argumentlist:"/S $TempReg" -Wait -ErrorAction:Stop When the REG file is properly formatted this works a treat, but I can't seem to address the