Solved

Java applet and Clipboard

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

726 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