Solved

Java applet and Clipboard

Posted on 1998-10-01
4
1,085 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
[X]
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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate jars 4 58
How do I remove an object from a 3 53
Java syntax, or is it Selenium 6 38
IBM TS2900 (3572) Tape Autoloader Java? 12 59
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 This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

756 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