System Clipboard with KDE

Just wondering if anyone else has encountered this.
I have a bunch of users using an application mostly on either windows, Linux with Gnome and Linux with KDE. Sometimes, and only on KDE, pasting stuff from the System clipboard causes the application to totally freese up (no CPU time is used, but the application becomes totally unresponsive). I have asked the KDE users to switch over to Gnome, but would really like to know the underlying reason for the problem.

toxic, from what I understand from t-dawg's questions is that he wants to emulate what you can do in gvim, but with vim instead.
In gvim, I can click the mouse button; hold; drag downwards and then gvim will start scrolling downwards, whilst highlighting the passing lines. This is how you highlight large amounts of text (greater than what can fit in a single screen at a time) with a mouse.
However, terminals are slightly dumber. Whilst you can highlight areas of text, that's a console function and not something that vim itself is monitoring. Therefore, you can't achieve the same effect with the mouse in vim as you can in gvim.
Of course, vim is perfectly capable of selecting more text than can fit in a single screen. It has a visual mode. Press v and then move down with your cursor keys, et volia - highlighted text.
Now when it comes to shifting this to X11's clipboard, I've never tried (hence the link I gave for possible help). I'm sure it can be done.

Similar Messages

  • Massive copy to system clipboard with vim?

    Say I'm editing a program with vim through a terminal (say xterm). Does anyone know how to copy the contents, via left click highlighting, onto the system clipboard (x11) when the content that needs to be copied is physically off the screen? I've tried to arrow up while highlighting but it doesn't work.

    toxic, from what I understand from t-dawg's questions is that he wants to emulate what you can do in gvim, but with vim instead.
    In gvim, I can click the mouse button; hold; drag downwards and then gvim will start scrolling downwards, whilst highlighting the passing lines. This is how you highlight large amounts of text (greater than what can fit in a single screen at a time) with a mouse.
    However, terminals are slightly dumber. Whilst you can highlight areas of text, that's a console function and not something that vim itself is monitoring. Therefore, you can't achieve the same effect with the mouse in vim as you can in gvim.
    Of course, vim is perfectly capable of selecting more text than can fit in a single screen. It has a visual mode. Press v and then move down with your cursor keys, et volia - highlighted text.
    Now when it comes to shifting this to X11's clipboard, I've never tried (hence the link I gave for possible help). I'm sure it can be done.

  • WebView -  text copied with Crtl/C or Popup Menu not in system clipboard!

    Dear JavaFX users,
    We have embedded JavaFX WebView in a Swing panel. Everything works fine, but we have realized that text selected and copied with Crtl/C or Popup Menu is not in the system clipboard.
    This is quite annoying, and we woulld appreciate any advice or suggestion for solving this issue.
    Thanks in advance,
    Best,
    Jean-Claude Dauphin

    i don't have enough space on my remote server, there are 2 other sites on this server as well.
    What are you using, FREE web hosting?
    For approx $4.95/month you can get unlimited storage and bandwidth:
    http://www.lunarpages.com/hosting-solutions/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb

  • Problem with kde and sound

    Hi!
    I've a problem with KDE and sound.
    When KDE shows a alert the alert's sound sounds with delay. 3-5 seconds.
    Same happens with kde start.
    Can anybody help me?
    Thanks!

    Pilli wrote:
    Hi!
    I've a problem with KDE and sound.
    When KDE shows a alert the alert's sound sounds with delay. 3-5 seconds.
    Same happens with kde start.
    Can anybody help me?
    Thanks!
    Change the player to mplayer or something in the control panel (Sound and Multimedia - System notifications - Player Settings).

  • Problems copying from PJC to system clipboard

    I am working on a PJC to allow for editing of large text fields (> 64K). I have most of the functionality working fine. However, I am having a problem using cut, copy, and paste.
    Some details, the PJC extends VBean and includes as JTextArea. Our users want a right click menu to provide functionality for cutting, copying, pasting, and spell checking. I was able to get the spell check working using JSpell. I am not able to get the menu entries for cut, copy, and paste to work. I construct a JPopMenu with the appropriate items. When the menu is activated, if the user selects cut, the actionPerformed method executed the cut method of the JTextArea. This does cut the text from the item, however it is not added to the clipboard for use in other items, except those that have the same implementation class of the original item. If the user uses the keyboard (CTRL-X, CTRL-C, or CTRL-V) the selected data is copied to the system clipboard
    Here is the method I used to create the menu items:
      private JMenuItem makeMenuItem(String label, char acceleratorKey)
        JMenuItem item = new JMenuItem(label);
        item.addActionListener(this);
        item.setMnemonic(acceleratorKey);
        item.addKeyListener(this);
        printDebugMessage("Horizontal text alignment = " + item.getHorizontalAlignment());
        item.setHorizontalAlignment(SwingConstants.LEFT);
        printDebugMessage("Horizontal text alignment = " + item.getHorizontalAlignment());
        return item;
      }Here is the actionPerformed method:
      public void actionPerformed(ActionEvent ae)
        String selection = ae.getActionCommand();
        if (selection.equals("Cut"))
          printDebugMessage("Cut selected");
          text.cut();
        else if (selection.equals("Copy"))
          printDebugMessage("Copy selected");
          text.copy();
        else if (selection.equals("Paste"))
          printDebugMessage("Paste selected");
          text.paste();
        else if (selection.equals("Spell Check"))
          printDebugMessage("Spell Check selected");
          doSpellCheck();
      }I read that jar files needed to be signed to interact with the desktop, but when I signed the jar file the results were the same.
    Platform
    10g AS on Solaris 10.1.2.2
    Windows XP (SP2)
    IE7
    Sun plugin 1.5.0_11 (problem also occurs with 1.4.2_06)
    Any insights would be helpful.
    Thanks

    will that create a problem?Try it and see.

  • Writing on system clipboard from an applet.

    Is it possible?
    I have tried to write on it but an exception is occoured:
    java.security.AccessControlException: access denied (java.awt.AWTPermission accessClipboard)
    The code that I have used is:
    import java.security.*;
    import java.awt.*;
    import java.awt.datatransfer.*;
    import javax.swing.*;
    public class Blah extends JApplet {
    public void init() {
    String exampleStr = "Hi!";
    Clipboard clipboard;
    Transferable trans;
    StringSelection strSelect;
    try {
    SecurityManager security = System.getSecurityManager();
    if (security != null)
    security.checkSystemClipboardAccess();
    clipboard=Toolkit.getDefaultToolkit().getSystemClipboard();
    strSelect = new StringSelection(exampleStr);
    trans = (Transferable)strSelect;
    clipboard.setContents(trans, strSelect);
    System.out.println("Clipboard copy successful");
    catch (Exception e) {
    System.err.println("Clipboard copy failed");
    System.err.println(e);
    Thanks

    First, your applet must be signed to access the system clipboard. And on Netscape 4.7.x, you need to enable the privilege from within the same method where you get the system clipboard. On IE 5.5/6.0, signing the applet is all that is necessary.
    Here's what I do on Netscape:
    Make sure when you call "PrivilegeManager.enablePrivilege("UniversalSystemClipboardAccess");", that you get the system clipboard within the same method. Failure to do this will cause a ForbiddenTargetException.
    My code looks like:
    public java.awt.datatransfer.Clipboard getSystemClipboard()
    java.awt.datatransfer.Clipboard clipboard = null;
    try
    PrivilegeManager.enablePrivilege("UniversalSystemClipboardAccess");
    clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
    PrivilegeManager.revertPrivilege("UniversalSystemClipboardAccess");
    catch (netscape.security.ForbiddenTargetException se)
    se.printStackTrace();
    catch(Exception e)
    e.printStackTrace();
    return clipboard;
    This works successfully on Netscape 4.7.8. On IE 5.5/6.0, I didn't have to do anything other than having a signed applet to get the system clipboard. With the code above, I also am using a signed applet.
    Hope this helps anyone else trying to make this work.
    -Dave.

  • Paste Image to System Clipboard

    Hello all...I can't paste an Image to the system clipboard and was wondering if you could help me. Noticed there was some help on this topic with JDK 1.4.1, however I'm using JDK 1.3.1.
    I following code was copied from Sun at http://developer.java.sun.com/developer/Books/GJ21AWT/ch20.pdf
    but I cant get it to work.
    <code>
    //implement the class like this
    ImageSelection is = new ImageSelection(Constants.DRAWINGSLATE.currentImage.pBitmap[dList.ptr].getImage());
    toolkit.getSystemClipboard().setContents(is, null);
    class ImageSelection implements ClipboardOwner, Transferable
    public static DataFlavor ImageFlavor;
    public static DataFlavor ImageArrayFlavor;
    private DataFlavor[] flavors = {ImageFlavor, ImageArrayFlavor};
    private java.awt.Image image;
    private int width, height;
    static
    try
    ImageFlavor = new DataFlavor(Class.forName("java.awt.Image"),"AWT Image");
    ImageArrayFlavor = new DataFlavor("image/gif", "GIF Image");
    catch(Exception e)
    public ImageSelection(Image image)
    this.image = image;
    public ImageSelection(Image image, int width, int height)
    this.image = image;
    this.width = width;
    this.height = height;
    public synchronized DataFlavor[] getTransferDataFlavors()
    return flavors;
    public boolean isDataFlavorSupported(DataFlavor flavor)
    return flavor.equals(ImageFlavor) || flavor.equals(ImageArrayFlavor);
    public synchronized Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException
    if (flavor.equals(ImageFlavor))
    return image;
    if (flavor.equals(ImageArrayFlavor))
    return imageToArray();
    else
    throw new UnsupportedFlavorException(flavor);
    public void lostOwnership(Clipboard c, Transferable t)
    private int[] imageToArray()
    int[] pixels = new int[width*height];
    PixelGrabber pg = new PixelGrabber(image, 0, 0, width, height, pixels, 0 , width);
    try
    pg.grabPixels();
    catch(InterruptedException e)
    e.printStackTrace();
    return pixels;
    </code>
    I get this exception
    Couldn't write data flavor java.awt.datatransfer.DataFlavor[representationclass=java.awt.Image;mimetype=application/x-java-serialized-object] to clipboard:
    java.io.IOException: Transferable's flavor data is of unexpected class com.apple.mrj.internal.awt.graphics.VImage
    Thanks for any help.

    I was trying to use ur code with slight modification
    import java.awt.*;
    import java.awt.datatransfer.*;
    import java.io.*;
    import java.util.*;
    public class Test {
    public static void main (String[] parameters) {
              new Test ().test ();
    private void test () {
    Toolkit.getDefaultToolkit().getSystemClipboard ().setContents (          new mageTransferable ("test.jpg"),
         new ClipboardOwner () {
         public void lostOwnership (                                             Clipboard clipboard,
                             Transferable contents) {}
    private class ImageTransferable implements Transferable {
    private String fileName;
    public ImageTransferable (String fileName) {
    System.out.println(" Checking for the File now");
    if (! new File(fileName).exists ()) {
    throw new IllegalArgumentException ("Can't find image");
    System.out.println(" got the file");
    this.fileName = fileName;
    System.out.println(" returning from constructor");
    public Object getTransferData (DataFlavor flavor) throws UnsupportedFlavorException {
    System.out.println("trying to get the data to be transfered");
    if (! isDataFlavorSupported (flavor)) {
    throw new UnsupportedFlavorException (flavor);
    System.out.println("This is a supported flavor");
    return (Image)Toolkit.getDefaultToolkit().createImage (fileName);
    //               System.out.println(
    public boolean isDataFlavorSupported (DataFlavor flavor) {
    System.out.println("trying to check whether the flavour is supported one");
    DataFlavor[] df= this.getTransferDataFlavors();
    System.out.println(" data flavors " + df);
    boolean result = in(flavor, df);
    return result;
    public DataFlavor[] getTransferDataFlavors () {
    //     "image/x-java-image; class=java.awt.Image"
    DataFlavor df=null;
    System.out.println("trying to get the data flavours");
    df =new DataFlavor("application/x-java-serialized-object; class=java.awt.Image","Image");
    //new DataFlavor("image/x-java-image;class=java.awt.Image","Image");
    System.out.println(" Just going to return & DF found was"+ df);
    DataFlavor[] df2 = new DataFlavor[]{df,DataFlavor.plainTextFlavor,DataFlavor.stringFlavor,DataFlavor.javaFileListFlavor };
    System.out.println(df2.length);
    System.out.println(df2[0]);
    return df2;
    private boolean in (DataFlavor flavor, DataFlavor[] flavors) {
    System.out.println("Im in in");
    int f = 0;
    while ((f < flavors.length) && ! flavor.equals (flavors[f])) {
         f ++;
         System.out.println("Im in in's loop");
    return f < flavors.length;
    But this throws the following exception:
    Exception in thread "main" java.lang.ClassCastException: sun.awt.windows.WImage
    at sun.awt.windows.WDataTransferer.translateTransferable(WDataTransferer
    .java:346)
    at sun.awt.DataTransferer.translateTransferable(DataTransferer.java:245)
    at sun.awt.windows.WClipboard.setContents(WClipboard.java:69)
    at Test.test(Test.java:13)
    at Test.main(Test.java:8)
    Is the dataflavour purely dependent on OS. What can be done to overcome this problem

  • Applet access to system Clipboard

    Hi all:
    I am creating a customized version of the mud telnet application for a customer. They have requested cut/paste functionality and I have been able to provide this capability. The problem is the applet cannot get access to the system clipboard so all cut/paste functions can only occur within the applet. I am able to access the system clipboard by creating a java.policy file and setting a permission. The problem is that most of the workstations, and a good number that will be using home computers running Win 98. They don't want the users to have to download the new JRE from Sun (although I know this works). I am looking for a way to creat a JAR file using the old JDK 1.1 (or the current toolkit if it is possible) that will allow access from the Applet to the System Clipboard. I have search the web for an answer, with no success. Can anyone give me any suggestions?
    Anybody had to do the same thing before?
    Thanks.
    John Kreiner

    I know this is an old thread, but I thought I would answer it.
    To access the clipboard via an applet, you need to use JavaScript.
    The first thing to do is to create a class that uses reflection to use the JSObject. The reason why reflection is used is because it is a pain (ITA) to specify a compatible binary for eacy java version (e.g. java40.jar, plugin.jar, jaws.jar, etc). Here is the class:
    import java.lang.reflect.*;
    import java.applet.Applet;
    public class JavaScript {
         public static void call(Applet applet, String methodName, Object[] param) {
              try {
                   Class js = Class.forName("netscape.javascript.JSObject");
                   Method callMethod = js.getMethod("call", new Class[] { String.class, Object[].class });
                   callMethod.invoke(getWindow(applet), new Object[] { methodName, param});
              } catch (Throwable t) {}
         public static Object getWindow(Applet applet) {
              Object o = null;
              try {
                   Class js = Class.forName("netscape.javascript.JSObject");
                   Method getWindowMethod = js.getMethod("getWindow", new Class[] { Applet.class });
                   o = getWindowMethod.invoke(null, new Object[] { applet });
              } catch (Throwable t) {}
              return o;
    }Now, when you want to copy something to the clipboard, you will do:
    JavaScript.call(someApplet, "copyToClipboard", text);
    BUT the "copyToClipboard" function has not been defined yet. This will be a JavaScript function in the html:
    <script language="JavaScript1.1">
    function copyToClipboard(text) {
         document.myForm.myInput.value = text;
         var rng = document.myForm.myInput.createTextRange();
         rng.execCommand("RemoveFormat");
         rng.execCommand("Copy");
    </script>And one last thing is that a JavaScript text component is required in order to create the "rng" variable. To do this, use a hidden field in the html:
    <form name="myForm">
         <input name="myInput" type="hidden">
         </input>
    </form>

  • System clipboard, AWT TextAreas, and JTextAreas

    This code makes a JApplet with a Swing JTextArea and an AWT TextArea. The JTextArea won't accept pasted text that was copied from another application. The AWT TextArea will. Why is this, and how can I get a JTextArea to accept pasted input?
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.util.*;
    public class TextAreaTest extends JApplet {
         Container cp = getContentPane();
         JTextArea TextIn = new JTextArea("You can't paste from the system clipboard into this box.",4,44);
         JScrollPane aScrollPane = new JScrollPane(TextIn);
         TextArea awtTextIn = new TextArea("Pasting into this box does work!",4,44);
         public void init() {
              cp.setLayout(new FlowLayout());
              cp.add(new Label("Copy some text from another program."));
              cp.add(new Label("Click in the upper box and press Shift+Insert."));
              cp.add(new Label("Why is nothing pasted?"));
              cp.add(aScrollPane);
              cp.add(awtTextIn);
    //<applet width="500" height="240" code="TextAreaTest.class"></applet>

    Thanks for checking this and replying. Pasting into the JTextArea from outside doesn't work for me, even when I'm running the applet locally. Even when I run the applet with appletviewer from the command prompt, I still can't paste from the outside into the JTextArea. If I cut from the TextArea or from an outside application and try to paste into the JTextArea, nothing happens. I can't go the other way either: If I cut from the JTextArea and try to paste into the TextArea, nothing happens. The only cutting and pasting that works with the JTextArea is that if I cut from within the JTextArea, I can paste back into the JTextArea.
    I wonder why pasting works for you and not for me. I'm using the latest JDK (1.4.2_03) and JRE on Windows XP. I have the same behavior on a Windows 2000 machine with the 1.4.1 JRE.

  • System Clipboard - I want to check system clipboard

    Hi
    I Want to check system clipboard on regular interval , my forms interact with
    another application in VB , That application send some value to system clipboard
    i want to check if values being send in system clipboard or not , if it has being
    send then my form perform some task.
    I know copy_region and paste_region command but that does not solve the problem.
    i Need to check weither the values has come to system clipboard .
    If u have solution please help .

    Also, if they have your CC info in their iTunes, I suggest giving them an -> iTunes allowance or -> iTunes Gift card instead of the CC info.
    Then you do not have to worry about how much they are spending.

  • FRM-92220: access to system clipboard is denied

    Hi,
    Within a customer's application Error FRM-92220 "access to system clipboard is denied" is returned when the customer switches between screens within the application.
    I have not been able to find a reference for this error nor am I experienced with Forms.
    Can anyone help and give a solution or point into the right direction to help the customer with this error?
    Thanks in advance.
    Peter

    As found in the Internal Support Portal:
    Ideally, the error FRM-92220 will be thrown due to the the reason that there is a security check introduced by the JRE in one of their updates/upgrades sometime around JRE 1.5 was released. If the System clipboard is accessed by another OS application, then JRE cannot access the clipboard hence resulting in the error. If no OS application (like word or anyother tool ) then you wont have this error. Avoiding this error is not in the hands of Forms, its a question of whether JRE can access the clipboard at that particular moment
    In earlier versions like 9.0.4 and 10.1.2, this new security measure by Sun JRE has resulted in Java exceptions and abrupt termination of the JVM in the client machines resulting in Forms disconnection. Hence Forms development introduced the new applet parameter to capture and re-route the messages to the java console
    allowAlertClipboard=true
    Setting it to false, will not show these errors and will sent to jre console.
    There is very little you can with respect to Forms coding. I would recommend you to set the following
    allowAlertClipboard=false
    at the moment when the error comes, the forms process will capture and send it to console. Later, if the System clipboard is released by other processed which were holding it, then the clipboard can be accessed again, there is nothing that you need to do specifically.

  • Java System Clipboard error implementing inhereted lostOwnership procedure

    I am trying to get a string from the system clipboard manipulate it then put the manipulated string back on the system clipboard. I'm fairly certain i have the accessing the clipboard correct, but i can't figure out an error i'm getting with part of it.
    Error Message:
    Syntax error on token "}", delete this token
    It refers to the "}" that closes the scope of the lostOwnership procedure, which has to be implemented by the class because it is inherited from the "implements ClipboardOwner", but is not implemented by it.
    Code:
    public class Programming12 implements ClipboardOwner{
         private static JFrame frame  = new JFrame("HTS Programming 12");
         private static JTextArea ta;
         private static JButton start = new JButton("START");
         private ClipboardOwner co = this;//must do this because need to use "this" as the ClipboardOwner inside a static
                                                            //function
         public void lostOwnership(Clipboard clipboard, Transferable contents){}/*procedure*/Any help would be appreciated, even if you can possibly point me in the right direction.
    Edited by: Bherms on Dec 13, 2009 10:41 PM

    It works just fine for me (no syntax errors):
    import java.awt.*;
    import java.awt.datatransfer.*;
    import java.awt.dnd.*;
    import javax.swing.*;
    public class ClipBoardTest implements ClipboardOwner
         private static JFrame frame  = new JFrame("HTS Programming 12");
         private static JTextArea ta;
         private static JButton start = new JButton("START");
         private ClipboardOwner co = this;//must do this because need to use "this" as the ClipboardOwner inside a static
                                                            //function
         public void lostOwnership(Clipboard clipboard, Transferable contents){}/*procedure*/
    }

  • Writing to the System clipboard

    This company uses LabVIEW 2012 and LabWindows 2010 in an Aerospace environment. The use of older versions is done to have commonality with their facilities across the globe. Thus, I cannot get them to upgrade.
    On their new test station, they have 14 serial ports to communicate with the unit under test. I have developed a LabVIEW serial port interface program that will allow them to communicate with those serial ports. I have the ini file configured to allow the user to run multiple instances of the executable, for as many ports as they desire, during their testing. One option that they requested is the ability to right click the mouse, have a menu display to select copy or copy all of the data to the clipboard so that they can paste the received data into a test report. I used the LabVIEW App Invoke Node function Write to Clipboard and Read From Clipboard to perform the task. However, I have the issue that this works on some instances and does not work on other instances of the executables. Since the code is the same, the user enters which port to connect to, I do not understand why I have this issue. It works fine on my PC which only has a single COM port.
    I decided to write two LabWindows functions to read and write to the clipboard using ClipboardGetText and ClipboardPutText. I call those dll functions from LabVIEW. The first call to the function ClipboardPutText works in the sense that the data is placed into the clipboard. However, I immediately get a fatal error and the process stops. (I did not save a screen image and the test stations are in use at this time). After that, none of the other instances will copy the data and they all result in a fatal error and stop. This is repeatable as I restarted the software numerous times as I tried to determine the cause.
    Since I do not have access to the code for the clipboard functions, I cannot determine if I need to configure something else related to the clipboard or the process attempting to read/write from/to the clipboard. I will continue to search but wanted to ask the experts in control of the clipboard software to determine if they have any recommendations on what may need to be added.
    For LabWindows, the only other call that I performed was a free command after I executed the ClipboardGetText, if the pointer to the text was not NULL.
    I will post this in both the LabVIEW and LabWindows discussion boards in case one or the other has a solution.
    Thank you for your help.
    I can provide a zip file, containing the source code, to NI personnel if you provide an email address. Since I am a contractor, I am not sure if the company’s policy allows global posting of their code, although I may be able to reduce the code to a minimum example, if necessary.

    I have done more testing in an attempt to clarify the error condition. I upgraded to LabVIEW 2014 on a Windows 7 SP1 system. I have enclosed some screen shots to show what I am doing.
    My software allows multiple copies, 14 in this case, versions of the executable to run at one time. The software controls serial ports. The enclosed image of the front panel, LabVIEW window.png, indicates the COM port, baud rate, and version at the top of the window. This first small control allows the user to enter a command to send to the port. The large bottom indicator displays the data received on the port. I have menu items, pressing the right mouse button, that allows the user to clear all of the data, copy selected data, or copy all data. I have enclosed images of the copy, copy all, write to clipboard, and read serial port parts of the code. I was only copying small amounts of data, perhaps less than 256 bytes.
    Here’s what I have noticed:
    If I execute the code on my desktop computer, only 1 COM port, everything works fine. The copy and copy all will place the data into the system clipboard which allows the pasting of the data into Notepad.
    If I execute the code on the test station, opening all 14 ports, we are using the NI serial card for all of the additional ports, the code works fine, as in item 1, for a couple of the executables but not the rest.
    If I select a subset of the data being displayed, highlighted in blue by LabVIEW, then right click the mouse selecting the copy, the blue highlighting goes away but the data is copied to the clipboard allowing me to paste into Notepad.
    If I right click the mouse selecting copy all, the data is NOT copied to the system clipboard so that I cannot paste it into Notepad.
    In the Write to Clipboard function, I write to the clipboard and then read the clipboard. I added code to display, in a popup window, what was written to the clipboard and what was read from the clipboard. The data was the same although the data was not on the system clipboard so that I could paste it into Notepad.
    I tried to select a subset of the data being displayed and then right clicking the mouse to do a copy all to see if that made a difference. It did not.
    I tried to make the Write to Clipboard function re-entrant to test that theory. Not change in the behavior.
    At one point, I tried to use LabWindows. I used the LabWindows clipboard calls and then tried calling the Microsoft clipboard functions directly. While those functions worked in LabWindows without a problem, I would get executable crashes when I tried to call my LabWindows functions from LabVIEW. If I commented out the actually code part, the call to the functions would return without crashing the executable. The issue was not in how the LabWindows functions were being called but something in the clipboard calls themselves. So, I decided that making a call using LabWindows offered nothing that I could use. I returned to using only LabVIEW and updated to 2014 to determine if that might solve the issue. No luck so far.I do not understand why, when I call the LabVIEW function to write to the clipboard, that it does not work for every executable of the multiple instances. Is there some other function that needs to be called prior to writing to the clipboard due to having multiple instances? Why does selecting a subset work when I do the copy but not when I copy all. If I am passing the data to write to the clipboard, why does selecting a subset and the copying only that subset work but the copy all does not? I do not understand how LabVIEW handles multiple instances and is they are truly considered separate processes.
    I seldom use these forums as I can get most of the code that I write to work as expected. Thank you for all of your help and suggestions.
    Attachments:
    LabVIEW window.png ‏25 KB
    Copy Menu Item.png ‏39 KB
    Copy ALL Menu Item.png ‏33 KB

  • Copy an image into system clipboard takes too much memory

    Our Swing application copies a java.awt.BufferedImage into the system clipboard. Our image has a size of 1024x768 pixels and a depth of 24 bits per pixel.
    The copy from the image to the system clipboard works, but is very slow and takes too much memory. Before the copy, java.exe uses about 30 MB. After the copy, it uses about 90 MB! However, a 1024x768x3 image should consume only 2,4 MB.
    We did some debugging and it seems the AWT library does several copies of our original image in order to copy it in the system clipboard. I guess that each of these copies takes a lot of memory (probably because of a different format from the original image) and is not immediately garbage collected.
    This is a big issue for our application because the JVM throws an OutOfMemoryError when we try to copy a new image to the system clipboard.
    Here is our code. Do you have any idea? Thanks a lot for your help.
    // Create the image
    BufferedImage image = new BufferedImage(1024, 768, BufferedImage.TYPE_3BYTE_BGR);
    Graphics2D g2 = image.createGraphics();
    drawSomething(g2);
    g2.dispose();
    // Put the image into the system clipboard
    ImageSelection handler = new ImageSelection(image);
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    clipboard.setContents(handler, handler);
    * An implementation of Transferable and ClipboardOwner to be used with
    * images.
    public class ImageSelection implements Transferable, ClipboardOwner {
        private static final DataFlavor flavors[] = {DataFlavor.imageFlavor};
        private Image image;
        public ImageSelection(Image imageToCopy) {
            this.image = imageToCopy;
        // Interface ClipboardOwner
        public void lostOwnership(Clipboard clipboard, Transferable transferable) {
            image = null;
        // Interface Transferable
        public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException,
                                                                IOException {
            if (isDataFlavorSupported(flavor)) {
                return image;
            else {
                throw new UnsupportedFlavorException(flavor);
        public DataFlavor[] getTransferDataFlavors() {
            return flavors;
        public boolean isDataFlavorSupported(DataFlavor flavor) {
            return flavor.equals(flavors[0]);
    }

    why dont u use other data structure to store the image , which will take less memory.

  • Sending an image to the system clipboard

    I've been trying to figure out how I can send an image to the system clipboard. At this state I'm beginning to think it's just not possible. This is the case:
    I've got an applet running in a browser which creates a new window. I now want to copy the contents of this window to the system clipboard. So far I can only transfer text to the clipboard, but what I need is to copy a screenshot of the new window to the system clipboard.
    Does anybody know how this can be done with Java or any kind of scripting language?

    Since I already found the answer I rewarded 2 people for there help. This is the answer I found. Some code was found on the JDC Forum, but I can't remember who posted it or where I found it. So sorry that I can't give him credit...
    Using JDK 1.4 the code could look like this:
    -> This is how the policy file should look like:
    grant
    { permission java.awt.AWTPermission "accessClipboard";
    permission java.awt.AWTPermission "createRobot";
    permission java.awt.AWTPermission "readDisplayPixels";
    -> This is the code for the applet:
    import java.awt.*;
    public class ClipboardTest extends java.applet.Applet {
    public void init() {
    initComponents();
    initialiseer();
    private void initComponents() {
    setLayout(new java.awt.BorderLayout());
    public void initialiseer() {
         // Here I create the actual frame that I can send to the clipboard
    MySystemClipboard cb = new MySystemClipboard();
    cb.setBounds(200,200,200,200);
    cb.setVisible(true);
    -> And here is the code for MySystemClipboard:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.datatransfer.*;
    public class MySystemClipboard extends Frame implements ActionListener,
    ClipboardOwner
    private Button myButton;
    private Clipboard myClipboard;
    private PrettyPicture myPicture;
    public MySystemClipboard()
    add(myButton = new Button("Clip"), BorderLayout.SOUTH);
    add(myPicture = new PrettyPicture(), BorderLayout.CENTER);
    myButton.addActionListener(this);
    myClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    public void actionPerformed(ActionEvent anEvent)
    try
    ClipImage ci = new ClipImage(new Robot().createScreenCapture(getBounds()));
    myClipboard.setContents(ci, this);
    catch (AWTException ae){}
    public void lostOwnership(Clipboard clipboard, Transferable contents)
    private class ClipImage implements Transferable
    private DataFlavor[] myFlavors;
    private BufferedImage myImage;
    public ClipImage(BufferedImage theImage)
    myFlavors = new DataFlavor[]{DataFlavor.imageFlavor};
    myImage = theImage;
    public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException
    if (flavor != DataFlavor.imageFlavor)
    throw new UnsupportedFlavorException(flavor);
    return myImage;
    public DataFlavor[] getTransferDataFlavors()
    return myFlavors;
    public boolean isDataFlavorSupported(DataFlavor flavor)
    return (flavor == DataFlavor.imageFlavor);
    private class PrettyPicture extends Panel
    public PrettyPicture()
    setBackground(Color.gray);
    add(new Button("Button1"), BorderLayout.NORTH);
    add(new Button("Button2"), BorderLayout.CENTER);
    add(new Button("Button3"), BorderLayout.SOUTH);
    Hope this can help some other people

Maybe you are looking for