Saurin
unread,Jun 11, 2009, 1:01:23 PM6/11/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to guess-discuss
Hi there,
I am trying to make a TextField and try to enter a search term to find
nodes on the network, so, I am using Java Reg. exp. libs and it works
fine in Stand Alone "run script" time but when I make an applet it
does not work at all.
#=================== my code starts ==================
import java
import javax.swing
import com
from java import awt, applet
from java.util.regex import *
from java.lang import *
# search network
self.search_Net = awt.TextField("Enter Search Term", 20) #
java.awt.TextField (does not work either)
self.search_Net.actionPerformed = self.search_Net_Fun
self.add(self.search_Net)
def search_Net_Fun(self,event):
sTerm = self.search_Net.getText()
sTerm = sTerm.strip()
#zoom to the node AND its neighbors
_toCenter = []
for gS in g.nodes:
Lnode = gS.label
Lnode = Lnode.strip()
pR = Pattern.compile(String(sTerm), Pattern.CASE_INSENSITIVE |
Pattern.DOTALL)
mR = pR.matcher(String(Lnode))
if(mR.find()):
#self.label2.text = "Search Result: %s" % Lnode
_toCenter += [gS]
_toCenter += gS.getNeighbors()
center(_toCenter)
break
##=========================== my code ends
===========================
Also, when I put Mouse over on EDGE..it displays in Hover Node Name
rather than "Label Name"
So, in Python... .when I do..
#====
import re
#====
that does not work either...in applet...it says can not find "re"
Has anyone used Reg. Exp. in java with applet?
Thank you,
Saurin