Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Java applet and Clipboard

Posted on 1998-10-01
4
1,084 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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 learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

840 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