Solved

Java applet and Clipboard

Posted on 1998-10-01
4
1,079 Views
Last Modified: 2008-02-01
Is there any way to use information kept in Clipboard in Java applet?
What I need is to use a screen-shot image inside Java applet for Whiteboard purposes.
0
Comment
Question by:visualc
  • 2
4 Comments
 
LVL 8

Expert Comment

by:diakov
ID: 1225248
Pure Java, don't thinks so. With MSIE and MSJ++ may be.
You can do it with native code, but implementing a shared .dll that does the grabbing from the clipboard. Anyway, you need to sign your applet in order to be able to download your dll and load it.
0
 

Accepted Solution

by:
pureDan earned 150 total points
ID: 1225249
Take a look here....




public void clpbrd()
    {
        System.out.println("Clipboard stuff");
        try
        {
//blah blah
            Clipboard clip = this.getToolkit().getSystemClipboard();
   
            if(clip == null) throw new IOException("No clipboard in scene");
     //blah blah
            Transferable trans = clip.getContents(this);
    //blah blah
            if( trans == null) throw new IOException("Clipboard Empty");
     //******************
            String s = (String) trans.getTransferData(DataFlavor.stringFlavor);
//***************
            _textArea.replaceRange(s, _textArea.getSelectionStart(),
                                          _textArea.getSelectionEnd());
        }
        catch(Exception e)
        {
//do smthng.  
        }
    }
0
 

Author Comment

by:visualc
ID: 1225250
And if the clippboard data is a bitmap?
0
 

Expert Comment

by:pureDan
ID: 1225251
visualc, maybe it works if the applet it's signed...U have to try it out - Ym not quite sure it will do its job well , but as a suggestion , it works under Win32 'n ' application.
So, try to use it...
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now