-
Notifications
You must be signed in to change notification settings - Fork 0
/
miniSiniflar1.pde
83 lines (63 loc) · 1.99 KB
/
miniSiniflar1.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// burda bazı argümanlar için lazım olacak çağrıları yapıyoruz
//kopyala yapıştır sistemi için lazım olan ekipmanlar.
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
import javax.swing.*;
import java.io.*;
class dikdortgen{
float x,y;
float w,h;
dikdortgen(float x, float y, float w, float h){
this.x=x; this.y=y; this.w=w; this.h=h;
}// constructor sonu
}// sınıf sonu
class kopyalaYapistir{
kopyalaYapistir(){
}
String yapistir () {
String text = (String) GetFromClipboard(DataFlavor.stringFlavor);
if (text==null)
return "";
return text;
}
void kopyala(String text){
StringSelection data = new StringSelection(text);
Clipboard clipboard =
Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(data, data);
}
Object GetFromClipboard (DataFlavor flavor) {
Clipboard clipboard = getJFrame(getSurface()).getToolkit().getSystemClipboard();
Transferable contents = clipboard.getContents(null);
Object object = null; // the potential result
if (contents != null && contents.isDataFlavorSupported(flavor)) {
try
{
object = contents.getTransferData(flavor);
println ("Clipboard.GetFromClipboard() >> Object transferred from clipboard.");
}
catch (UnsupportedFlavorException e1) // Unlikely but we must catch it
{
println("Clipboard.GetFromClipboard() >> Unsupported flavor: " + e1);
e1.printStackTrace();
}
catch (java.io.IOException e2)
{
println("Clipboard.GetFromClipboard() >> Unavailable data: " + e2);
e2.printStackTrace() ;
}
}
return object;
}
}
static final javax.swing.JFrame getJFrame(final PSurface surf) {
return
(javax.swing.JFrame)
((processing.awt.PSurfaceAWT.SmoothCanvas)
surf.getNative()).getFrame();
}