@bergus
2015-12-02T16:28:33.000000Z
字数 375
阅读 1415
groovy
import groovy.swing.*
import javax.swing.*
import java.awt.*
def swing = new SwingBuilder()
swing.frame(title:"hello",show:true){
panel(){
def mm=swing.textField(text:"bcxhdbhd")
mm.mousePressed={e->
def popupMenu=swing.popupMenu(){
menuItem(text:"bhdfyhefyh")
}
popupMenu.show(e.getComponent(),e.getX(),e.getY())
//这里的e.getComponent()换成mm也一样
println("jjjj")
mm.setText("kkkkkk")
}
}
}