9 |
9 |
import javax.swing.JRadioButton
|
10 |
10 |
import javax.swing.JSpinner
|
11 |
11 |
import java.awt.event.ActionListener
|
|
12 |
import java.awt.event.MouseListener
|
12 |
13 |
import javax.swing.event.ChangeListener
|
13 |
14 |
import javax.swing.event.DocumentListener
|
14 |
15 |
import java.awt.event.ItemListener
|
... | ... | |
83 |
84 |
def __init__(self,function, componentName=None):
|
84 |
85 |
ListenerAdapter.__init__(self,function,componentName)
|
85 |
86 |
def focusGained(self,*args):
|
86 |
|
#print "focusGained %s %s" % (self.componentName, args[0])
|
87 |
87 |
pass
|
88 |
88 |
def focusLost(self,*args):
|
89 |
|
#print "focusLost %s %s" % (self.componentName, args[0])
|
90 |
89 |
self.function(*args)
|
91 |
90 |
|
|
91 |
class MouseListenerAdapter(ListenerAdapter, java.awt.event.MouseListener):
|
|
92 |
def __init__(self,function, componentName=None):
|
|
93 |
ListenerAdapter.__init__(self,function,componentName)
|
|
94 |
def mouseClicked(self,*args):
|
|
95 |
self.function(*args)
|
|
96 |
def mouseEntered(self,*args):
|
|
97 |
self.function(*args)
|
|
98 |
def mouseExited(self,*args):
|
|
99 |
self.function(*args)
|
|
100 |
def mousePressed(self,*args):
|
|
101 |
self.function(*args)
|
|
102 |
def mouseReleased(self,*args):
|
|
103 |
self.function(*args)
|
92 |
104 |
|
93 |
105 |
|
94 |
106 |
class FunctionRunnable(java.lang.Runnable):
|
... | ... | |
210 |
222 |
if addFocusListener !=None:
|
211 |
223 |
addFocusListener(FocusLostListenerAdapter(method,methodName))
|
212 |
224 |
|
|
225 |
elif methodName.endswith("_mouseClick"):
|
|
226 |
name = methodName[0:-len("_mouseClick")]
|
|
227 |
component = getattr(self,name, None)
|
|
228 |
if component!=None:
|
|
229 |
addMouseListener = getattr(component,"addMouseListener",None)
|
|
230 |
if addMouseListener !=None:
|
|
231 |
addMouseListener(MouseListenerAdapter(method,methodName))
|
213 |
232 |
|
214 |
233 |
class FormPanel(FormComponent):
|
215 |
234 |
|