Changeset 7055
- Timestamp:
- 02/23/08 04:31:31 (5 years ago)
- Location:
- lang/scala/sandbox
- Files:
-
- 4 modified
-
build.xml (modified) (1 diff)
-
lib/scala-sandbox.jar (modified) (previous)
-
src/jp/ne/cappuccino/keisuken/scl/awt/ClipBoard.scala (modified) (2 diffs)
-
webpages/lib/scala-sandbox.jar (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
-
lang/scala/sandbox/build.xml
r7035 r7055 116 116 fork="true" 117 117 classname="jp.ne.cappuccino.keisuken.scl.awt.ClipBoard" 118 classpath="${classpath}" /> 119 </target> 120 121 <target name="test-keisuken-dnd" depends="compile"> 122 <java 123 fork="true" 124 classname="jp.ne.cappuccino.keisuken.scl.awt.DnD" 118 125 classpath="${classpath}" /> 119 126 </target> -
lang/scala/sandbox/src/jp/ne/cappuccino/keisuken/scl/awt/ClipBoard.scala
r7048 r7055 15 15 def lostOwnership(clipboard: Clipboard, contents: Transferable) = 16 16 proc(clipboard, contents) 17 } 18 19 class Transfer( 20 flavors: Array[DataFlavor], 21 getTransferData: DataFlavor => java.lang.Object, 22 data: java.lang.Object) 23 extends Transferable with ClipboardOwner 24 { 25 26 def getTransferDataFlavors(): Array[DataFlavor] = 27 flavors.toArray 28 29 def isDataFlavorSupported(flavor: DataFlavor): Boolean = { 30 for(dataFlavor <- flavors) 31 if(flavor == dataFlavor) return true 32 return false 33 } 34 35 @throws(classOf[UnsupportedFlavorException]) 36 @throws(classOf[IOException]) 37 def getTransferData(flavor: DataFlavor): Object = getTransferData(flavor) 38 39 def lostOwnership(clipboard: Clipboard, contents: Transferable): Unit = 40 println( 41 "Transfer.lostOwnership: clipboard=" + 42 clipboard + ",contents=" + contents 43 ) 17 44 } 18 45 … … 70 97 */ 71 98 def main(args: Array[String]) { 72 val listener = add(e => println("flavors changed: " + e))73 99 val lock = "abc" 100 val listener = add({e => 101 println("flavors changed: " + e) 102 lock.synchronized {lock.notify} 103 }) 74 104 copy( 75 105 new StringSelection("Hello, world!"), 76 clipboardOwner({(clipboard, contents) => 77 println("clipboard=" + clipboard + ",contents=" + contents) 78 remove(listener) 79 lock.notify 80 }) 106 clipboardOwner((clipboard, contents) => 107 println("lost owner: clipboard=" + clipboard + ",contents=" + contents) 108 ) 81 109 ) 82 try { 83 lock.wait 84 } catch { 85 case e: Exception => {} 110 lock.synchronized { 111 lock.wait(1000) 86 112 } 87 113 try {
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)