From: R. V. <rvi...@ea...> - 2004-08-18 13:44:49
|
Anyone able to execute py files on Netbeans (3.6) ? No matter what I do = from the scripting console, I keep getting: Traceback (innermost last): (no code object) at line 0 File "<string>", line 1 Trying to discern what's happening, regardless of what file I try to = execute. For example, the above output error occurs if I use the = following filr (or any file for that matter, copied into the scripting = console): import javax.swing as swing import java ACTIVATED =3D swing.event.HyperlinkEvent.EventType.ACTIVATED ENTERED =3D swing.event.HyperlinkEvent.EventType.ENTERED EXITED =3D swing.event.HyperlinkEvent.EventType.EXITED class HtmlBrowserWindow(swing.JFrame): =20 def __init__(self, urlString=3D"http://www.jython.org"): swing.JFrame.__init__(self, title=3D"HTML Browser", size=3D(800, = 600)) self.contentPane.layout =3D java.awt.BorderLayout() self.contentPane.add(self.buildTopPane(urlString), java.awt.BorderLayout.NORTH) self.htmlPane =3D swing.JEditorPane(urlString, editable=3D0, hyperlinkUpdate=3Dself.followHyperlink, = size=3D(400,400)) self.contentPane.add(swing.JScrollPane(self.htmlPane), java.awt.BorderLayout.CENTER) self.status =3D swing.JLabel(" ", preferredSize=3D(500,20)) self.contentPane.add(self.status, java.awt.BorderLayout.SOUTH) def buildTopPane(self, startUrl): label =3D swing.JLabel("Go To:") self.field =3D swing.JTextField(preferredSize=3D(500,20), text=3DstartUrl, actionPerformed=3Dself.goToUrl) button =3D swing.JButton("Go", size=3D(100,100),=20 actionPerformed=3Dself.goToUrl) topPane =3D swing.JPanel() topPane.add(label) topPane.add(self.field) topPane.add(button) return topPane =20 def goToUrl(self, event): self.htmlPane.setPage(self.field.text) =20 def followHyperlink(self, hlEvent): if hlEvent.eventType =3D=3D ACTIVATED: self.htmlPane.setPage(hlEvent.URL) self.field.text =3D hlEvent.URL.toString() elif hlEvent.eventType =3D=3D ENTERED: self.status.text =3D hlEvent.URL.toString() elif hlEvent.eventType =3D=3D EXITED: self.status.text =3D " " =20 if __name__ =3D=3D "__main__": HtmlBrowserWindow().show() //Ralph |