?
Solved

Java applet and Clipboard

Posted on 1998-10-01
4
Medium Priority
?
1,091 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 300 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month12 days, 9 hours left to enroll

777 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