home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / sun / awt / windows / WClipboard.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  1.3 KB  |  50 lines

  1. package sun.awt.windows;
  2.  
  3. import java.awt.datatransfer.Clipboard;
  4. import java.awt.datatransfer.ClipboardOwner;
  5. import java.awt.datatransfer.StringSelection;
  6. import java.awt.datatransfer.Transferable;
  7.  
  8. public class WClipboard extends Clipboard {
  9.    public WClipboard() {
  10.       super("System");
  11.    }
  12.  
  13.    public synchronized void setContents(Transferable var1, ClipboardOwner var2) {
  14.       if (super.owner != null && super.owner != var2) {
  15.          super.owner.lostOwnership(this, super.contents);
  16.       }
  17.  
  18.       super.owner = var2;
  19.       super.contents = var1;
  20.       if (var1 instanceof StringSelection) {
  21.          this.setClipboardText((StringSelection)var1);
  22.       }
  23.  
  24.    }
  25.  
  26.    public synchronized Transferable getContents(Object var1) {
  27.       String var2 = this.getClipboardText();
  28.       return var2 == null ? null : new StringSelection(var2);
  29.    }
  30.  
  31.    public synchronized void lostSelectionOwnership() {
  32.       if (super.owner != null) {
  33.          super.owner.lostOwnership(this, super.contents);
  34.          super.owner = null;
  35.          super.contents = null;
  36.       }
  37.  
  38.    }
  39.  
  40.    private static native void init();
  41.  
  42.    private native void setClipboardText(StringSelection var1);
  43.  
  44.    private native String getClipboardText();
  45.  
  46.    static {
  47.       init();
  48.    }
  49. }
  50.