You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
(8) |
Dec
(51) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(105) |
Feb
(93) |
Mar
(194) |
Apr
(145) |
May
(100) |
Jun
(111) |
Jul
(117) |
Aug
(126) |
Sep
(233) |
Oct
(138) |
Nov
(164) |
Dec
(109) |
2002 |
Jan
(216) |
Feb
(175) |
Mar
(216) |
Apr
(194) |
May
(157) |
Jun
(140) |
Jul
(158) |
Aug
(73) |
Sep
(105) |
Oct
(164) |
Nov
(104) |
Dec
(95) |
2003 |
Jan
(72) |
Feb
(69) |
Mar
(81) |
Apr
(151) |
May
(101) |
Jun
(139) |
Jul
(99) |
Aug
(118) |
Sep
(115) |
Oct
(151) |
Nov
(161) |
Dec
(102) |
2004 |
Jan
(120) |
Feb
(175) |
Mar
(106) |
Apr
(111) |
May
(54) |
Jun
(78) |
Jul
(76) |
Aug
(105) |
Sep
(94) |
Oct
(143) |
Nov
(75) |
Dec
(85) |
2005 |
Jan
(99) |
Feb
(77) |
Mar
(164) |
Apr
(97) |
May
(79) |
Jun
(57) |
Jul
(65) |
Aug
(102) |
Sep
(95) |
Oct
(129) |
Nov
(123) |
Dec
(52) |
2006 |
Jan
(48) |
Feb
(99) |
Mar
(90) |
Apr
(51) |
May
(81) |
Jun
(136) |
Jul
(56) |
Aug
(109) |
Sep
(50) |
Oct
(44) |
Nov
(74) |
Dec
(75) |
2007 |
Jan
(92) |
Feb
(137) |
Mar
(93) |
Apr
(79) |
May
(52) |
Jun
(74) |
Jul
(143) |
Aug
(175) |
Sep
(154) |
Oct
(137) |
Nov
(88) |
Dec
(90) |
2008 |
Jan
(58) |
Feb
(113) |
Mar
(167) |
Apr
(88) |
May
(105) |
Jun
(37) |
Jul
(87) |
Aug
(72) |
Sep
(56) |
Oct
(41) |
Nov
(102) |
Dec
(70) |
2009 |
Jan
(115) |
Feb
(113) |
Mar
(126) |
Apr
(58) |
May
(125) |
Jun
(45) |
Jul
(90) |
Aug
(125) |
Sep
(84) |
Oct
(61) |
Nov
(111) |
Dec
(61) |
2010 |
Jan
(85) |
Feb
(86) |
Mar
(130) |
Apr
(58) |
May
(57) |
Jun
(32) |
Jul
(25) |
Aug
(50) |
Sep
(41) |
Oct
(65) |
Nov
(63) |
Dec
(24) |
2011 |
Jan
(43) |
Feb
(31) |
Mar
(28) |
Apr
(68) |
May
(53) |
Jun
(42) |
Jul
(58) |
Aug
(26) |
Sep
(51) |
Oct
(76) |
Nov
(60) |
Dec
(9) |
2012 |
Jan
(16) |
Feb
(32) |
Mar
(32) |
Apr
(39) |
May
(16) |
Jun
(19) |
Jul
(3) |
Aug
(11) |
Sep
(35) |
Oct
(47) |
Nov
(28) |
Dec
(18) |
2013 |
Jan
(18) |
Feb
(36) |
Mar
(10) |
Apr
(7) |
May
(7) |
Jun
(27) |
Jul
(17) |
Aug
(35) |
Sep
(19) |
Oct
(31) |
Nov
(8) |
Dec
(22) |
2014 |
Jan
(5) |
Feb
(11) |
Mar
(18) |
Apr
(23) |
May
(26) |
Jun
(14) |
Jul
(18) |
Aug
(26) |
Sep
(20) |
Oct
(48) |
Nov
(13) |
Dec
(9) |
2015 |
Jan
(9) |
Feb
(15) |
Mar
(25) |
Apr
(10) |
May
(26) |
Jun
(6) |
Jul
(13) |
Aug
(5) |
Sep
(14) |
Oct
(36) |
Nov
(24) |
Dec
(18) |
2016 |
Jan
(24) |
Feb
(11) |
Mar
(1) |
Apr
(6) |
May
(7) |
Jun
(3) |
Jul
(9) |
Aug
(15) |
Sep
(22) |
Oct
(5) |
Nov
(5) |
Dec
(2) |
2017 |
Jan
(20) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(5) |
Jun
(7) |
Jul
(14) |
Aug
(9) |
Sep
(18) |
Oct
(2) |
Nov
(3) |
Dec
(3) |
2018 |
Jan
(7) |
Feb
(6) |
Mar
(1) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
(18) |
Sep
(8) |
Oct
(9) |
Nov
(4) |
Dec
(6) |
2019 |
Jan
(5) |
Feb
|
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(8) |
Jul
(11) |
Aug
(10) |
Sep
(6) |
Oct
|
Nov
(1) |
Dec
|
2020 |
Jan
(8) |
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
(5) |
Nov
(2) |
Dec
(1) |
2021 |
Jan
|
Feb
|
Mar
(5) |
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
(5) |
Jul
(15) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
(1) |
Mar
|
Apr
(2) |
May
|
Jun
(5) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: John M. <joh...@ya...> - 2001-04-05 18:41:55
|
The following is from the NEWS file distributed with jython-2.1a1. I was just wondering what this means. By any chance does this mean that the tracebacks from compiled jython code will now list valid line numbers instead of zeros? ------- Jython NEWS 14-mar-2001 Jython 2.1 alpha 1 Bug fixes. - Include a LineNumberTable in the compiled class files. __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: Samuele P. <pe...@in...> - 2001-04-05 18:05:39
|
Hi. [Marc Koch] > Please help, ... what am I missing?!? something unrelated to serial port usage in java I think > class MySerialPortEventListener (comm.SerialPortEventListener): > def serialEvent (self, Event): > print Event > try: > IBuf = '--------' This assign a python string to IBuf (note: python string are immutable they cannot be used as buffers <wink>) ... > ILen = IStream.available() > while ILen > 0: > INum = IStream.read(IBuf) read take a byte[], now python strings are actually automatically converted to byte[] if they are passed to a method that takes such an argument but this conversion is done but making a copy of the string (to respect immutability), java has no const or in or out modifiers for arguments so jython in any case here could not detect that something wrong is possibly going on, he just tries to make its best creating a byte[] array containing just a copy of the string > print 'Read: OK', ILen, INum, IBuf the copied byte[] is probably modified in the right way, but IBuf is still a reference to the old string so ... > ILen = IStream.available() > except: > raise Solution: the jython idiom for allocating a mutable array that can be passed to java methods wanting a writeable buffer is: import jarray buf = jarray.zeros(<length>,'b') # 'b' stands for bytes # <length> is an expr ... For further details see the doc: http://www.jython.org/docs/jarray.html online or the same in your jython installation tree. regards. |
From: D-Man <ds...@ri...> - 2001-04-05 17:42:41
|
On Thu, Apr 05, 2001 at 09:17:35AM -0700, John Mudd wrote: | Reading the doc helps... | | The following is from http://www.jython.org/docs/registry.html#finding | | All I had to do was add jython.jar to the CLASSPATH even though | jython.jar is not there. It tricks jython into going to the same | directory to read the registry file. It works. Another alternative is to put -Dpython.security.respectJavaAccessibility=false on the java commandline used to run your app. This is actually how I've been using jython -- some custom shell scripts to give it the right arguments. I actually tweaked it so I could use --classpath "other stuff here" to _append to_ (not replace) the classpath. Very handy when you want to add some jar or directory to the classpath but want to keep classes.zip and/or jython.jar in the classpath. -D |
From: Marc K. <MK...@wa...> - 2001-04-05 17:40:15
|
Hi, I'm quite new to Jython and Java (a few days). Here is a piece of code I wrote to sub-class the SerialPortEventListener of the javax.comm package: class MySerialPortEventListener (comm.SerialPortEventListener): def serialEvent (self, Event): print Event try: IBuf = '--------' ILen = IStream.available() while ILen > 0: INum = IStream.read(IBuf) print 'Read: OK', ILen, INum, IBuf ILen = IStream.available() except: raise I get the following result for each character sent to the serial port (with help of a connected PSION) javax.comm.SerialPortEvent[source=COM2] Read: OK 1 1 -------- What goes right: - The EventListener works and is fired correctly - The InputStream reports that data is available (1 byte) - The InputStream.read method call reports that it has read data What goes wrong: - The buffer doesn't contain any data except the 8 '-'s that I have put in it for initialising Please help, ... what am I missing?!? (The other way around works. I managed to send data) Thanks for any help and, once again, 'Jython is great' Marc |
From: John M. <joh...@ya...> - 2001-04-05 16:17:37
|
Reading the doc helps... The following is from http://www.jython.org/docs/registry.html#finding All I had to do was add jython.jar to the CLASSPATH even though jython.jar is not there. It tricks jython into going to the same directory to read the registry file. It works. ------ Finding the Registry File The following steps are used to find the Jython registry file, and also to set the Python values for sys.prefix. First a root directory is calculated: If there is a property called python.home, this is used as the root directory. Otherwise, the property install.root is used if it exists. If neither of those properties exist, then Jython searches for the file "jython.jar" on the Java classpath, as defined in the system property java.class.path. The actual file system isn't searched, only the paths defined on the classpath (one of them must literally include "jython.jar"). Once the root directory is found, sys.prefix and sys.exec_prefix are set to this, and sys.path has rootdir/Lib appended to it. The registry file used is then rootdir/registry. --- John Mudd <joh...@ya...> wrote: > I have a clue!! > > The error below is apparently because the member that I'm trying to > inherit is protected. My script version works because I have set > "python.security.respectJavaAccessibility = false" in my registry > file. > But my jar version fails even when I copy the registry file to the > same directory as the jar file. Any suggestions? > > > --- John Mudd <joh...@ya...> wrote: > > My previous message said that my jar worked w/o jython.jar. That > was > > my mistake. I didn't test it far enough. I still need jython.jar > > to > > avoid the following error at run time. > > > > > > --- John Mudd <joh...@ya...> wrote: > > > I switched to the latest jython but I still get an error when > > trying > > > to > > > run a jythonc generated jar file unless I put the jython.jar in > the > > > CLASSPATH. I used the "--all" option when running jythonc. Any > > > suggestions. > > > > > > In this case yyy is a valid attribute for a super class that was > > > inherited by xxx. This works when run as a jython script. It > only > > > works as a jythonc jar file if I put jython.jar in the CLASSPATH. > > > > > > AttributeError: instance of 'xxx' has no attribute 'yyy' > > > > > > > > > > > > > > > $ jython > > > Jython 2.1a1 on javaVM-1.3.0.01 (JIT: null) > > > Type "copyright", "credits" or "license" for more information. > > > >>> > > > > > > > > > __________________________________________________ > > > Do You Yahoo!? > > > Get email at your own domain with Yahoo! Mail. > > > http://personal.mail.yahoo.com/ > > > > > > _______________________________________________ > > > Jython-users mailing list > > > Jyt...@li... > > > http://lists.sourceforge.net/lists/listinfo/jython-users > > > > > > __________________________________________________ > > Do You Yahoo!? > > Get email at your own domain with Yahoo! Mail. > > http://personal.mail.yahoo.com/ > > > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > http://lists.sourceforge.net/lists/listinfo/jython-users > > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: John M. <joh...@ya...> - 2001-04-05 15:52:30
|
I have a clue!! The error below is apparently because the member that I'm trying to inherit is protected. My script version works because I have set "python.security.respectJavaAccessibility = false" in my registry file. But my jar version fails even when I copy the registry file to the same directory as the jar file. Any suggestions? --- John Mudd <joh...@ya...> wrote: > My previous message said that my jar worked w/o jython.jar. That was > my mistake. I didn't test it far enough. I still need jython.jar > to > avoid the following error at run time. > > > --- John Mudd <joh...@ya...> wrote: > > I switched to the latest jython but I still get an error when > trying > > to > > run a jythonc generated jar file unless I put the jython.jar in the > > CLASSPATH. I used the "--all" option when running jythonc. Any > > suggestions. > > > > In this case yyy is a valid attribute for a super class that was > > inherited by xxx. This works when run as a jython script. It only > > works as a jythonc jar file if I put jython.jar in the CLASSPATH. > > > > AttributeError: instance of 'xxx' has no attribute 'yyy' > > > > > > > > > > $ jython > > Jython 2.1a1 on javaVM-1.3.0.01 (JIT: null) > > Type "copyright", "credits" or "license" for more information. > > >>> > > > > > > __________________________________________________ > > Do You Yahoo!? > > Get email at your own domain with Yahoo! Mail. > > http://personal.mail.yahoo.com/ > > > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > http://lists.sourceforge.net/lists/listinfo/jython-users > > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: Samuele P. <pe...@in...> - 2001-04-05 15:48:50
|
Hi. > 0. There is some tool already done to do this job? Have you tried the python 'profile' module, it comes with jython 2.0 es with jython 2.0 and AFAIK is supported and working but maybe it does not meet your needs ? regards. |
From: John M. <joh...@ya...> - 2001-04-05 15:33:30
|
My previous message said that my jar worked w/o jython.jar. That was my mistake. I didn't test it far enough. I still need jython.jar to avoid the following error at run time. --- John Mudd <joh...@ya...> wrote: > I switched to the latest jython but I still get an error when trying > to > run a jythonc generated jar file unless I put the jython.jar in the > CLASSPATH. I used the "--all" option when running jythonc. Any > suggestions. > > In this case yyy is a valid attribute for a super class that was > inherited by xxx. This works when run as a jython script. It only > works as a jythonc jar file if I put jython.jar in the CLASSPATH. > > AttributeError: instance of 'xxx' has no attribute 'yyy' > > > > > $ jython > Jython 2.1a1 on javaVM-1.3.0.01 (JIT: null) > Type "copyright", "credits" or "license" for more information. > >>> > > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: D-Man <ds...@ri...> - 2001-04-05 15:30:36
|
On Thu, Apr 05, 2001 at 10:57:40AM -0300, German Morales wrote: | Hi everybody, ... | I'm looking for a tool that show me the time elapsed in | each Jython function or method. | | Having found nothing in a quick search on Google and with | the same result in this lists, I've made some changes to | PyTableCode.java, so when I execute 'jython Test.py', | where Test.py is: ... | | I get this result: | | ## ---------------------------------------- | begin - time:986420318682 - code:? | begin - time:986420318685 - code:TestClass | end - time:986420318686 | begin - time:986420318686 - code:createFunction | begin - time:986420318687 - code:__main__.TestClass.__init__ | end - time:986420318687 | end - time:986420318687 | begin - time:986420318688 - code:__main__.TestClass.printFunction | begin - time:986420318691 - code:__main__.TestClass.__str__ | end - time:986420318697 | end - time:986420318701 | end - time:986420318701 | ## ---------------------------------------- | | The numbers are java.lang.System.currentTimeMillis() calls. | | The next step is to write a program to analize this output. | | But, before going on with my efforts, I wish to ask you some | questions. | | | 0. There is some tool already done to do this job? I don't know of any. | 1. If not... What do you think of my aproach? It is good, but perhaps you could make it easier on yourself. If it isn't too difficult with your framework, I would recommend trying something like the following : begin = java.lang.System.currentTimeMillis() some_func_that_may_take_some_time() end = java.lang.System.currentTimeMillis() print "some_func took %d ms" % ( end - begin ) Seeing the difference in time is more interesting (useful) than the actual start/end times. I expect you were planning on writing a tool to parse your existing output and do the subtraction there. It may be easier to do that right in the test framework. | 2. Is someone else interested in profiling jython code? Sure. It would be nice to see just how slow (or fast ;-)) it really is. It is also very useful when needing to present data to superiors. A little while back I used Jython to run some performance tests on a method in our Java runtime that was known to be slow. I made some modifications and ran the profiling again. It was a custom profiling very similar to the above snippet. While the numbers weren't exact (they never are anyways) it gave a good approximation. Jython also made checking the accuracy of the modifications easier. For my final report I used the same (custom) benchmark application written in Java that was used for the initial report. -D |
From: cindy <inf...@pi...> - 2001-04-05 15:03:43
|
Thanks, Thanks, and Thanks. I notice in the example below that your inheritance was different than mine. I did "from java.awt import swing" I changed it to "import javax" and modified my class statement to look like D- Man's example. Bingo, it works. Wayne D-Man wrote: > On Thu, Apr 05, 2001 at 08:10:50AM -0400, cindy wrote: > | I thought I couldn't access the method enableEvents() by inheriting JFrame. > | The reason being is that this method is protected. I concluded that I have to > | inherit Component to get access to this mrthod. Therefore, the tree structure > | below and inheritance from JFrame wouldn't work for the method enableEvents(). > | > | Is this correct? > > Mostly. 'protected' (in Java, it is slightly different in C++) means > that only subclasses and classes in the same package can access it. > JFrame is a subclass of Component, and your class is a subclass of > JFrame, therefore your class is a subclass of Component. You are > correct up to the point where you say "inheritance from JFrame > wouldn't work". > > If you've done some work in discrete math or logic this is basically > the following axiom : > > if A -> B and B -> C then A -> C > > Here is an example : > > >>> import javax > >>> import java > >>> class MyFrame( javax.swing.JFrame ) : > ... def __init__( self ) : > ... self.super__enableEvents( java.awt.AWTEvent.WINDOW_EVENT_MASK ) > ... def processEvent( self , event ) : > ... print "got an event" > ... > >>> aframe = MyFrame() > >>> aframe.getContentPane().add( javax.swing.JLabel( "Jython is cool" ) ) > javax.swing.JLabel[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=null,border=,flags > =0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,horizonta > lAlignment=,horizontalTextPosition=,iconTextGap=4,labelFor=,text=Jython is cool, > verticalAlignment=CENTER,verticalTextPosition=CENTER] > >>> aframe.show() > got an event > >>> got an event > got an event > > This was an interactive interpreter session of mine. As you can see > here, I didn't define getContentPane or setVisible, but they worked. > This is because MyFrame is-a JFrame (is-a JComponent ... is-a > Component ...). Through inheritance, instances of MyFrame ('aframe') > have all of those public and protected members (functions and data). > Also, at the end there you can see that processEvent was called when > the frame was shown, when I gave it the focus (with the mouse) and > when I removed the focus (I clicked in the terminal window to copy the > text from). > > Perhaps the following tutorial sections may help you? > > http://python.org/doc/current/tut/node11.html > > http://www.crosswinds.net/~agauld/tutclass.htm > > HTH, > -D > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users |
From: D-Man <ds...@ri...> - 2001-04-05 14:48:01
|
On Thu, Apr 05, 2001 at 05:41:05PM -0400, cindy wrote: | In the jython doc , under Calling Methods in your Superclass", I quote | "In Python, if I want to call the foo method in my superclass, I use the | following | | SuperClass.foo(self) | | This works with the majority of methods, but protected methods can not | be called from subclasses in this way. Instead you have to use the | "self.super_foo()" call style." I beleave the latter syntax is telling me | I have to use inheritance. Am I wrong? Both syntaxes use inheritance. | Wayne | | P.S. I have several books in which I'm using to learn java. What I thought | I do to learn jython was rewite all the examples in the book in jython. This | is how my problen came about. My the way the book is, "Beiginning Java" | by Ivor Horton The problem you are seeing here comes from mixing Python and Java semantics and syntax together without first understanding either of them. In Python, all functions are "public", and to call an overridden method in a superclass you use the SuperClass.function( self ) syntax ('SuperClass' isn't a keyword). In Java it is simply super.function() ('super' is a keyword). Also, java has "public" "protected" and "private" attributes which complicates the Python<->Java bridging. I would highly recommend that you learn one language first, then the other language, then put them together. The combined semantics make much more sense when you understand each language's semantics. IMO Python is much simpler and easier to learn (while being more powerful at a high level) than Java, so I would recommend learning python first. The tutor list is great at helping new people learn the basics of programming in a python environment (tu...@py...). Once you know python or java fairly well the hoops jython jumps through to provide as simple and clean as possible bridge between the two makes much more sense and is easier to grasp. -D |
From: D-Man <ds...@ri...> - 2001-04-05 14:41:27
|
On Thu, Apr 05, 2001 at 10:26:14PM -0400, cindy wrote: | I guess I'm not making myself clear. I just want to find away | of not having to inherit Component to use enableEvents() method. You can't. That is what 'protected' means. (actually ... jython has the option to ignore java accessability modifiers, but that's different issue altogether and there is no need to make things extra complicated now). Umm, also, java allows other classes in the package to access it but that is a bad part of java's design. Don't go there. (for really cool access modifier semantics, check out Eiffel, but don't overload yourself with too many languages at once) | Its obvious that I'm making some people upset. So I'll it let go. | Thanks all for being patient. No problem. If you want to learn more python, try the tutor list (tu...@py...). -D |
From: D-Man <ds...@ri...> - 2001-04-05 14:36:00
|
On Thu, Apr 05, 2001 at 08:10:50AM -0400, cindy wrote: | I thought I couldn't access the method enableEvents() by inheriting JFrame. | The reason being is that this method is protected. I concluded that I have to | inherit Component to get access to this mrthod. Therefore, the tree structure | below and inheritance from JFrame wouldn't work for the method enableEvents(). | | Is this correct? Mostly. 'protected' (in Java, it is slightly different in C++) means that only subclasses and classes in the same package can access it. JFrame is a subclass of Component, and your class is a subclass of JFrame, therefore your class is a subclass of Component. You are correct up to the point where you say "inheritance from JFrame wouldn't work". If you've done some work in discrete math or logic this is basically the following axiom : if A -> B and B -> C then A -> C Here is an example : >>> import javax >>> import java >>> class MyFrame( javax.swing.JFrame ) : ... def __init__( self ) : ... self.super__enableEvents( java.awt.AWTEvent.WINDOW_EVENT_MASK ) ... def processEvent( self , event ) : ... print "got an event" ... >>> aframe = MyFrame() >>> aframe.getContentPane().add( javax.swing.JLabel( "Jython is cool" ) ) javax.swing.JLabel[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=null,border=,flags =0,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,horizonta lAlignment=,horizontalTextPosition=,iconTextGap=4,labelFor=,text=Jython is cool, verticalAlignment=CENTER,verticalTextPosition=CENTER] >>> aframe.show() got an event >>> got an event got an event This was an interactive interpreter session of mine. As you can see here, I didn't define getContentPane or setVisible, but they worked. This is because MyFrame is-a JFrame (is-a JComponent ... is-a Component ...). Through inheritance, instances of MyFrame ('aframe') have all of those public and protected members (functions and data). Also, at the end there you can see that processEvent was called when the frame was shown, when I gave it the focus (with the mouse) and when I removed the focus (I clicked in the terminal window to copy the text from). Perhaps the following tutorial sections may help you? http://python.org/doc/current/tut/node11.html http://www.crosswinds.net/~agauld/tutclass.htm HTH, -D |
From: Robert K. <rob...@ya...> - 2001-04-05 14:27:46
|
hi, i am just now moving from jpython to jython and i am experiencing some errors by doing that. maybe somebody can help. here the context: i am writing some modules, that help to generate java-code from a togetherj-modell. so what i am doing in effect is calling a java-module from together which again calls thru the PythonInterpreter my python-modules. on switching to jython20 i have renamed my old jpython installation directory to jpython.old and installed jython. i renamed my new jython install-directory to jpython and renamed the jython.jar to jpython.jar. this was all done so that there be no need to change all the property-files for running my generator scripts. after switching to jython the os module can not be called anymore. i simply can not understand why this happens. if i run jython from the dos-prompt and import the os module it works as expected. here the first few lines of my main.py (the module excuting the java-source-code-generator) >>> import types import copy import string import traceback from feidlc2.builder.data import data_generator from feidlc2.builder.facade.roi import facade_generator ... >>> and here the traceback >>> Traceback (innermost last): File "<stdin>", line 4, in ? File "E:\tools\jpython\Lib\traceback.py", line 3, in ? File "E:\tools\jpython\Lib\linecache.py", line 9, in ? java.lang.ExceptionInInitializerError: java.lang.NullPointerException at org.python.modules.os.<clinit>(os.java:11) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:120) at org.python.core.SyspathJavaLoader.loadClass(SyspathJavaLoader.java:57) at java.lang.ClassLoader.loadClass(ClassLoader.java:253) at org.python.core.Py.findClassEx(Py.java:607) at org.python.core.imp.loadBuiltin(imp.java:198) at org.python.core.imp.load(imp.java:354) at org.python.core.imp.load(imp.java:376) at org.python.core.imp.importName(imp.java:447) at org.python.core.imp.importName(imp.java:509) at org.python.core.ImportFunction.load(__builtin__.java:967) at org.python.core.ImportFunction.__call__(__builtin__.java:961) at org.python.core.PyObject.__call__(PyObject.java:250) at org.python.core.__builtin__.__import__(__builtin__.java:921) at org.python.core.imp.importOne(imp.java:518) at linecache$py.f$0(E:\tools\jpython\Lib\linecache.py) at linecache$py.call_function(E:\tools\jpython\Lib\linecache.py) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.imp.createFromCode(imp.java:157) at org.python.core.imp.createFromPyClass(imp.java:74) at org.python.core.imp.loadFromPath(imp.java:310) at org.python.core.imp.loadFromPath(imp.java:252) at org.python.core.imp.load(imp.java:357) at org.python.core.imp.load(imp.java:376) at org.python.core.imp.importName(imp.java:447) at org.python.core.imp.importName(imp.java:509) at org.python.core.ImportFunction.load(__builtin__.java:967) at org.python.core.ImportFunction.__call__(__builtin__.java:961) at org.python.core.PyObject.__call__(PyObject.java:250) at org.python.core.__builtin__.__import__(__builtin__.java:921) at org.python.core.imp.importOne(imp.java:518) at traceback$py.f$0(E:\tools\jpython\Lib\traceback.py) at traceback$py.call_function(E:\tools\jpython\Lib\traceback.py) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.imp.createFromCode(imp.java:157) at org.python.core.imp.createFromPyClass(imp.java:74) at org.python.core.imp.loadFromPath(imp.java:310) at org.python.core.imp.loadFromPath(imp.java:252) at org.python.core.imp.load(imp.java:357) at org.python.core.imp.load(imp.java:376) at org.python.core.imp.importName(imp.java:447) at org.python.core.imp.importName(imp.java:509) at org.python.core.ImportFunction.load(__builtin__.java:967) at org.python.core.ImportFunction.__call__(__builtin__.java:961) at org.python.core.PyObject.__call__(PyObject.java:250) at org.python.core.__builtin__.__import__(__builtin__.java:921) at org.python.core.imp.importOne(imp.java:518) at org.python.pycode._pyx0.f$0(<stdin>) at org.python.pycode._pyx0.call_function(<stdin>) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.Py.runCode(Py.java:1055) at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:164) at com.togethersoft.modules.fe.GeneratorStart.run(GeneratorStart.java:29) at zaqb.invokeScript([DashoPro-V1.2-120198]) at zbn0.b([DashoPro-V1.2-120198]) at zaqh.execute([DashoPro-V1.2-120198]) at com.togethersoft.component.query.DefaultContext.execute(DefaultContext.java:26) at zb48.actionPerformed([DashoPro-V1.2-120198]) at zclp.execute([DashoPro-V1.2-120198]) at zagw.run([DashoPro-V1.2-120198]) java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError >>> ===== itemj http://www.itemj.com Robert Kuzelj mobil 0177 5302230 Ramonvillestr.6 tel 06039 930223 61184 Karben fax 06039 2224 __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: cindy <inf...@pi...> - 2001-04-05 14:22:38
|
Thanks Samuele, I tried your example and study it and it works and I beleave I understand what it does. I guess I'm not making myself clear. I just want to find away of not having to inherit Component to use enableEvents() method. Its obvious that I'm making some people upset. So I'll it let go. Thanks all for being patient. Wayne Samuele Pedroni wrote: > Here's a clarifying example (I hope): > > <A.java> > public class A { > > protected void prot1() { > System.out.println("java prot1"); > > } > > protected void prot2() { > System.out.println("java prot2"); > } > > public static void invoke_prot2(A a) { > a.prot2(); > } > > } > </A.java> > > <ex.py> > > import A > > class Apy(A): > def invoke_prot1(self): > self.prot1() > # note: self.super__prot1() won't work because prot1 is not overriden > > def invoke_super_prot2(self): > self.super__prot2() > > def prot2(self): > print "Apy prot2" > > print "-- Apy --" > print dir(Apy) # notice that there's no super__prot1 > > a=Apy() > a.invoke_prot1() > a.invoke_super_prot2() > a.prot2() > A.invoke_prot2(a) > > </ex.py> > > You can just try it. > > regards. > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users |
From: Robert K. <rob...@ya...> - 2001-04-05 14:09:35
|
hi brian, thanks. shortly after sending my message i examined the regex once again and noticed that it seems to reduntant. so << \s* >> would have doen it too. the problem was, that it worked under by installation (jpython 1.1+7) and as i tried to install it under jython 2.0 it didnt work anymore. ciao robertj --- brian zimmer <bz...@zi...> wrote: > At 06:26 AM 4/5/2001 -0700, you wrote: > >hi, > > > >i am trying to compile a regex and > >on trying so i recive the following > >error: > >>>> > >File "E:\tools\jython\Lib\sre.py", line 63, in > compile > >File "E:\tools\jython\Lib\sre.py", line 104, in > >_compile > >error: nothing to repeat > >>>> > > > >does anybody has any idea what i am doing wrong > > > >here te script that creates the error > >>>> > >import re > >PYCMD = "^(\s*)?<%.*%>(\s*)?$" > >PYCMD_COMPILER = re.compile(PYCMD) > >>>> > > Here's my setup: > > Jython 2.1a1 on java1.3.0 (JIT: null) > Type "copyright", "credits" or "license" for more > information. > > I think the problem is the '?' in the expression. > It's job is 'either repeat 0 or 1' of the preceeding > RE or make the preceeding RE non-greedy. You have > it after the closing ')' which is not really a RE, > it's just a grouping clause. Try this: > > >>> import re > >>> re.compile(r"^(\s*?)<%.*%>(\s*?)$") > org.python.modules.sre.PatternObject@a0d51 > > CPython is the same: > > ActivePython 2.0, build 202 (ActiveState Tool Corp.) > based on Python 2.0 (#8, Oct 19 2000, 11:30:05) [MSC > 32 bit (Intel)] on win32 > Type "copyright", "credits" or "license" for more > information. > >>> import re > >>> re.compile(r"^(\s*?)<%.*%>(\s*?)$") > <SRE_Pattern object at 0082E9F0> > >>> re.compile(r"^(\s*)?<%.*%>(\s*)?$") > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "d:\python\cpython\2.0\lib\sre.py", line 62, > in compile > return _compile(pattern, flags) > File "d:\python\cpython\2.0\lib\sre.py", line 102, > in _compile > raise error, v # invalid expression > sre_constants.error: nothing to repeat > > I used > http://python.org/doc/current/lib/re-syntax.html as > reference. > > brian > ===== itemj http://www.itemj.com Robert Kuzelj mobil 0177 5302230 Ramonvillestr.6 tel 06039 930223 61184 Karben fax 06039 2224 __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: Robert K. <rob...@ya...> - 2001-04-05 14:08:58
|
hi brian, thanks. shortly after sending my message i examined the regex once again and noticed that it seems to reduntant. so << \s* >> would have doen it too. the problem was, that it worked under by installation (jpython 1.1+7) and as i tried to install it under jython 2.0 it didnt work anymore. ciao robertj --- brian zimmer <bz...@zi...> wrote: > At 06:26 AM 4/5/2001 -0700, you wrote: > >hi, > > > >i am trying to compile a regex and > >on trying so i recive the following > >error: > >>>> > >File "E:\tools\jython\Lib\sre.py", line 63, in > compile > >File "E:\tools\jython\Lib\sre.py", line 104, in > >_compile > >error: nothing to repeat > >>>> > > > >does anybody has any idea what i am doing wrong > > > >here te script that creates the error > >>>> > >import re > >PYCMD = "^(\s*)?<%.*%>(\s*)?$" > >PYCMD_COMPILER = re.compile(PYCMD) > >>>> > > Here's my setup: > > Jython 2.1a1 on java1.3.0 (JIT: null) > Type "copyright", "credits" or "license" for more > information. > > I think the problem is the '?' in the expression. > It's job is 'either repeat 0 or 1' of the preceeding > RE or make the preceeding RE non-greedy. You have > it after the closing ')' which is not really a RE, > it's just a grouping clause. Try this: > > >>> import re > >>> re.compile(r"^(\s*?)<%.*%>(\s*?)$") > org.python.modules.sre.PatternObject@a0d51 > > CPython is the same: > > ActivePython 2.0, build 202 (ActiveState Tool Corp.) > based on Python 2.0 (#8, Oct 19 2000, 11:30:05) [MSC > 32 bit (Intel)] on win32 > Type "copyright", "credits" or "license" for more > information. > >>> import re > >>> re.compile(r"^(\s*?)<%.*%>(\s*?)$") > <SRE_Pattern object at 0082E9F0> > >>> re.compile(r"^(\s*)?<%.*%>(\s*)?$") > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "d:\python\cpython\2.0\lib\sre.py", line 62, > in compile > return _compile(pattern, flags) > File "d:\python\cpython\2.0\lib\sre.py", line 102, > in _compile > raise error, v # invalid expression > sre_constants.error: nothing to repeat > > I used > http://python.org/doc/current/lib/re-syntax.html as > reference. > > brian > ===== itemj http://www.itemj.com Robert Kuzelj mobil 0177 5302230 Ramonvillestr.6 tel 06039 930223 61184 Karben fax 06039 2224 __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: German M. <ger...@de...> - 2001-04-05 14:00:24
|
Hi everybody, Before anything else, sorry for my English. I don't know if this is message should go in jython-users list or in the jython-dev list, so I apologize in advance if it is in the wrong place. I'm new in the list, but I used JPython (now Jython) on and off for about 2 years. I have an application written in Java that uses Jython for the annoying business details, as a way for my customers to customize the application for their needs. Anything goes OK, but I'm concerned about the performance. In a standard Java application, you can use a Java Profiler (there are a lot) to see where the performance bottleneck is. In the case of a Jython code, those profilers come up with a useless conclusion: the time is consumed in PythonInterpreter.exec(PyCode compiledPyCode). I'm looking for a tool that show me the time elapsed in each Jython function or method. Having found nothing in a quick search on Google and with the same result in this lists, I've made some changes to PyTableCode.java, so when I execute 'jython Test.py', where Test.py is: ## ---------------------------------------- class TestClass: def __init__(self): self.a = 1 def __str__(self): return str(self.a) def printFunction(_testClass): print str(_testClass) def createFunction(): return TestClass() _testClass = createFunction() printFunction(_testClass) ## ---------------------------------------- I get this result: ## ---------------------------------------- begin - time:986420318682 - code:? begin - time:986420318685 - code:TestClass end - time:986420318686 begin - time:986420318686 - code:createFunction begin - time:986420318687 - code:__main__.TestClass.__init__ end - time:986420318687 end - time:986420318687 begin - time:986420318688 - code:__main__.TestClass.printFunction begin - time:986420318691 - code:__main__.TestClass.__str__ end - time:986420318697 end - time:986420318701 end - time:986420318701 ## ---------------------------------------- The numbers are java.lang.System.currentTimeMillis() calls. The next step is to write a program to analize this output. But, before going on with my efforts, I wish to ask you some questions. 0. There is some tool already done to do this job? 1. If not... What do you think of my aproach? 2. Is someone else interested in profiling jython code? Thanks in advance for your time. German Morales |
From: Robert K. <rob...@ya...> - 2001-04-05 13:30:27
|
hi, i am trying to compile a regex and on trying so i recive the following error: >>> File "E:\tools\jython\Lib\sre.py", line 63, in compile File "E:\tools\jython\Lib\sre.py", line 104, in _compile error: nothing to repeat >>> does anybody has any idea what i am doing wrong here te script that creates the error >>> import re PYCMD = "^(\s*)?<%.*%>(\s*)?$" PYCMD_COMPILER = re.compile(PYCMD) >>> i did try it under different versions of JPython and Jython (1.1 with erratas / 2.0) and with different versions of the jdk (1.2.2, 1.3.0, 1.2.0, 1.3.01) the mystery is that it works on some of those and it doesnt work on other ones - which combination works and which doesnt is completely undeterminable for me. tia ciao robertj ===== itemj http://www.itemj.com Robert Kuzelj mobil 0177 5302230 Ramonvillestr.6 tel 06039 930223 61184 Karben fax 06039 2224 __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: Samuele P. <pe...@in...> - 2001-04-05 12:07:12
|
Here's a clarifying example (I hope): <A.java> public class A { protected void prot1() { System.out.println("java prot1"); } protected void prot2() { System.out.println("java prot2"); } public static void invoke_prot2(A a) { a.prot2(); } } </A.java> <ex.py> import A class Apy(A): def invoke_prot1(self): self.prot1() # note: self.super__prot1() won't work because prot1 is not overriden def invoke_super_prot2(self): self.super__prot2() def prot2(self): print "Apy prot2" print "-- Apy --" print dir(Apy) # notice that there's no super__prot1 a=Apy() a.invoke_prot1() a.invoke_super_prot2() a.prot2() A.invoke_prot2(a) </ex.py> You can just try it. regards. |
From: cindy <inf...@pi...> - 2001-04-05 09:37:33
|
In the jython doc , under Calling Methods in your Superclass", I quote "In Pyhton, if I want to call the foo method in my superclass, I use the following SuperClass.foo(self) This works with the majority of methods, but protected methods can not be called from subclasses in this way. Instead you have to use the "self.super_foo()" call style." I beleave the latter syntax is telling me I have to use inheritance. Am I wrong? Wayne P.S. I have several books in which I'm using to learn java. What I thought I do to learn jython was rewite all the examples in the book in jython. This is how my problen came about. My the way the book is, "Beiginning Java" by Ivor Horton Adam Burke wrote: > Er, no. > > In Java, protected methods are available to subclasses*. Private and > "package" (unprefixed methods, eg void myMethod()) level methods and > attributes are not. > > I'd read the Java Tutorial available on the Java website if you don't want > to buy a book. If you do want to buy a book I'd recommend Java In A > Nutshell. > > * They are also available within a package, but this is dodgy, I'd stay away > from it. > > Adam Burke > > > -----Original Message----- > > From: cindy [SMTP:inf...@pi...] > > Sent: Thursday, April 05, 2001 10:11 PM > > To: D-Man > > Cc: Jyt...@li... > > Subject: Re: [Jython-users] A big problem for me! > > > > I thought I couldn't access the method enableEvents() by inheriting > > JFrame. > > The reason being is that this method is protected. I concluded that I have > > to > > inherit Component to get access to this mrthod. Therefore, the tree > > structure > > below and inheritance from JFrame wouldn't work for the method > > enableEvents(). > > Is this correct? > > Wayne > > > > > > D-Man wrote: > > > > > On Wed, Apr 04, 2001 at 11:01:51PM -0400, cindy wrote: > > > | > The following code worked for me : > > > | > > > > | > from java.awt import Component , AWTEvent > > > | > > > > | > class C( Component ) : > > > | > def __init__( self ) : > > > | > self.super__enableEvents( AWTEvent.WINDOW_EVENT_MASK ) > > > | > > > | Ok. So this means that ever time I wanted to use this method, > > "enableEvents()" I > > > | have to > > > | inherit Component. But lets say that I would like to extend some other > > > | component, like > > > | JFrame. Then if I want to use enableEvents() in the same class that I > > want to > > > | extend > > > | JFrame, I would have to inherit Componet and do a composit on JFrame. > > Is this > > > | correct? > > > > > > Not quite. If you look at the top of the documenation for JFrame you > > > will see > > > > > > Class JFrame > > > > > > java.lang.Object > > > | > > > +--java.awt.Component > > > | > > > +--java.awt.Container > > > | > > > +--java.awt.Window > > > | > > > +--java.awt.Frame > > > | > > > +--javax.swing.JFrame > > > > > > JFrame already inherits from java.awt.Component. The term "is-a" is > > > often used with inheritance. A JFrame object is-a Component object. > > > If you inherit from JFrame, you are indirectly inheriting from > > > Component. > > > > > > If you look farther down on the documentation page you will see a list > > > of "Methods inherited from Frame" and "Methods inherited from Window" > > > and ... and "Methods inherited from Component". Since the methods are > > > listed there, they exist in objects of the type "JFrame". > > > > > > FYI, the documentation (for JDK1.2.2) is at > > > > > > http://java.sun.com/products/jdk/1.2/docs/api/index.html > > > > > > while the JFrame page is > > > > > > http://java.sun.com/products/jdk/1.2/docs/api/javax/swing/JFrame.html > > > > > > -D > > > > > > _______________________________________________ > > > Jython-users mailing list > > > Jyt...@li... > > > http://lists.sourceforge.net/lists/listinfo/jython-users > > > > > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > http://lists.sourceforge.net/lists/listinfo/jython-users > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users |
From: Samuele P. <pe...@in...> - 2001-04-05 08:59:24
|
Hi. cindy wrote: > > I thought I couldn't access the method enableEvents() by inheriting JFrame. > The reason being is that this method is protected. I concluded that I have to > inherit Component to get access to this mrthod. Therefore, the tree structure > below and inheritance from JFrame wouldn't work for the method enableEvents(). > Is this correct? > Wayne > > D-Man wrote: You seem quite confused. You really need to go through some reference material about java, asking about every bit of java/jython semantic here is painful and not really efficient for you... regards. |
From: Jack A. <jac...@lo...> - 2001-04-05 02:01:00
|
hi, thanks for your interest and contribution. I've added your tgz and mail here: http://web.one.net.au/~effbiae/cyphon.html#zooko have you also seen JPE? http://www.arakne.com/jpe.htm i haven't looked at it in any detail, but it may be more complete than cyphon. In cyphon, for example, it's not currently possible to inherit from CPython classes or pass jython callbacks to CPython functions. I think JPE may do one or both of these. rgs, jack. zo...@zo... wrote: > > Hello: thanks for cyphon! Hopefully it will enable me to run Mojo Nation[1] on > a JVM, using all of the same low-level native libraries. > > I've made a Makefile which works on my setup: debian-testing, linux 2.2.18, > python 1.5.2, blackdown j2sdk 1.3.0, GNU make 3.79.1. It, along with the > cyphon files (which I had to change a bit -- filename capitalization issues and > removed CyTuple.java), are downloadable from `http://zooko.com/cyphon.tgz'. > > When I run it, I get as far as the appended transcript indicates, which > I suspect means that don't have my CPython libraries in the LD_LIBRARY_PATH or > the python library path or something. I'll pick up from here tomorrow, but > I thought I would send you thanks and Makefile before bed now. > > Regards, > > Zooko > > [1] http://mojonation.net/ > |
From: Adam B. <ada...@gb...> - 2001-04-05 00:47:47
|
Er, no. In Java, protected methods are available to subclasses*. Private and "package" (unprefixed methods, eg void myMethod()) level methods and attributes are not. I'd read the Java Tutorial available on the Java website if you don't want to buy a book. If you do want to buy a book I'd recommend Java In A Nutshell. * They are also available within a package, but this is dodgy, I'd stay away from it. Adam Burke > -----Original Message----- > From: cindy [SMTP:inf...@pi...] > Sent: Thursday, April 05, 2001 10:11 PM > To: D-Man > Cc: Jyt...@li... > Subject: Re: [Jython-users] A big problem for me! > > I thought I couldn't access the method enableEvents() by inheriting > JFrame. > The reason being is that this method is protected. I concluded that I have > to > inherit Component to get access to this mrthod. Therefore, the tree > structure > below and inheritance from JFrame wouldn't work for the method > enableEvents(). > Is this correct? > Wayne > > > D-Man wrote: > > > On Wed, Apr 04, 2001 at 11:01:51PM -0400, cindy wrote: > > | > The following code worked for me : > > | > > > | > from java.awt import Component , AWTEvent > > | > > > | > class C( Component ) : > > | > def __init__( self ) : > > | > self.super__enableEvents( AWTEvent.WINDOW_EVENT_MASK ) > > | > > | Ok. So this means that ever time I wanted to use this method, > "enableEvents()" I > > | have to > > | inherit Component. But lets say that I would like to extend some other > > | component, like > > | JFrame. Then if I want to use enableEvents() in the same class that I > want to > > | extend > > | JFrame, I would have to inherit Componet and do a composit on JFrame. > Is this > > | correct? > > > > Not quite. If you look at the top of the documenation for JFrame you > > will see > > > > Class JFrame > > > > java.lang.Object > > | > > +--java.awt.Component > > | > > +--java.awt.Container > > | > > +--java.awt.Window > > | > > +--java.awt.Frame > > | > > +--javax.swing.JFrame > > > > JFrame already inherits from java.awt.Component. The term "is-a" is > > often used with inheritance. A JFrame object is-a Component object. > > If you inherit from JFrame, you are indirectly inheriting from > > Component. > > > > If you look farther down on the documentation page you will see a list > > of "Methods inherited from Frame" and "Methods inherited from Window" > > and ... and "Methods inherited from Component". Since the methods are > > listed there, they exist in objects of the type "JFrame". > > > > FYI, the documentation (for JDK1.2.2) is at > > > > http://java.sun.com/products/jdk/1.2/docs/api/index.html > > > > while the JFrame page is > > > > http://java.sun.com/products/jdk/1.2/docs/api/javax/swing/JFrame.html > > > > -D > > > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > http://lists.sourceforge.net/lists/listinfo/jython-users > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users |
From: cindy <inf...@pi...> - 2001-04-05 00:07:18
|
I thought I couldn't access the method enableEvents() by inheriting JFrame. The reason being is that this method is protected. I concluded that I have to inherit Component to get access to this mrthod. Therefore, the tree structure below and inheritance from JFrame wouldn't work for the method enableEvents(). Is this correct? Wayne D-Man wrote: > On Wed, Apr 04, 2001 at 11:01:51PM -0400, cindy wrote: > | > The following code worked for me : > | > > | > from java.awt import Component , AWTEvent > | > > | > class C( Component ) : > | > def __init__( self ) : > | > self.super__enableEvents( AWTEvent.WINDOW_EVENT_MASK ) > | > | Ok. So this means that ever time I wanted to use this method, "enableEvents()" I > | have to > | inherit Component. But lets say that I would like to extend some other > | component, like > | JFrame. Then if I want to use enableEvents() in the same class that I want to > | extend > | JFrame, I would have to inherit Componet and do a composit on JFrame. Is this > | correct? > > Not quite. If you look at the top of the documenation for JFrame you > will see > > Class JFrame > > java.lang.Object > | > +--java.awt.Component > | > +--java.awt.Container > | > +--java.awt.Window > | > +--java.awt.Frame > | > +--javax.swing.JFrame > > JFrame already inherits from java.awt.Component. The term "is-a" is > often used with inheritance. A JFrame object is-a Component object. > If you inherit from JFrame, you are indirectly inheriting from > Component. > > If you look farther down on the documentation page you will see a list > of "Methods inherited from Frame" and "Methods inherited from Window" > and ... and "Methods inherited from Component". Since the methods are > listed there, they exist in objects of the type "JFrame". > > FYI, the documentation (for JDK1.2.2) is at > > http://java.sun.com/products/jdk/1.2/docs/api/index.html > > while the JFrame page is > > http://java.sun.com/products/jdk/1.2/docs/api/javax/swing/JFrame.html > > -D > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users |