Bugs item #927394, was opened at 2004-04-01 05:18 Message generated for change (Comment added) made by migueljmol You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=379133&aid=927394&group_id=23629
Category: Applet Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Nathana�l Mazuir (mlemaudit) Assigned to: Miguel (migueljmol) Summary: package confusion ? Initial Comment: It seems that there is a little problem with some Jmol classes (CVS HEAD) : 1- In the package "org.openscience.jmol.applet" : - The package declaration line is missing in the Jvm12.java file. 2- In the default package (i.e. in the src folder) : - The Jvm12 Constructor is not visible from the default package. Proposal to fix the problem : 1- Move these files to the "org.openscience.jmol.applet" package : - JmolApplet.java - JmolAppletControl.java - JmolAppletRegistry.java 2- Add the missing package declaration line to all the files within the "org.openscience.jmol.applet" package. Yours. M. ---------------------------------------------------------------------- >Comment By: Miguel (migueljmol) Date: 2004-12-13 14:31 Message: Logged In: YES user_id=1050060 Per Nico's suggestion, I moved the primary applet to org.jmol.applet.JmolApplet JmolApplet extends that class. However, I think that i will make more changes to the way that this works. ---------------------------------------------------------------------- Comment By: Nicolas (nicove) Date: 2004-11-21 11:55 Message: Logged In: YES user_id=1096197 It's not possible to import a class from the default package since JDK 1.4: see http://bugs.sun.com/bugdatabase/view_bug.do? bug_id=4361575 The only solution I see is to move all the files from the default package to "org.openscience.jmol.applet" package and create a simple class JmolApplet in the default package that extends org.openscience.jmol.applet, so just the following lines : pubic class JmolApplet extends org.openscience.jmol.Applet { } I this solution is not ok, maybe we should close this bug report ? ---------------------------------------------------------------------- Comment By: Nathana�l Mazuir (mlemaudit) Date: 2004-04-01 08:06 Message: Logged In: YES user_id=935018 Hello Miguel. > JmolApplet and JmolAppletControl are in the root for a good > reason. When a person wants to create an instance of the > applet they need to put the classname in their HTML file. By > putting these in the root someone can say > <applet code="JmolApplet" ... > > > instead of > <applet code="org.openscience.jmol.applet.JmolApplet" ...> I see. > I think there is significant benefit in simplifying the code > for the applet users. > > Does that make sense? Yes, it does. > I would like to move the JmolAppletRegistry into the > jmol.applet package, but I do not know how to import a > class > that does not exist in a package. > > Any suggestions? Well as I'm still a beginner in Java development, I do not think that I am fully qualified to give you advices about Java programming. ;-) That fact is that it would be "cleaner" if all the applet relative code were stored in the applet package. Concerning the way to "import a class that does not exist in a package"... well, I have to confess that I do not clearly understand your question. If you are talking about the fact that Jvm12 is not visible from the default package, I think that a simple way to make it visible is to change the Jvm12 constructor's access modifier from nothing (default option) to public. Is it a good solution? I'm not sure. This point should probably discuss with Egon or Christoph, because there is a probably good reason why this constructor is package visible only. ... Maybe it's a stupid idea, but why don't you use some kind of "launcher"? Let me explain this idea: Let's imagine that the classes JmolApplet, JmolAppletControl, and JmolAppletRegistry are in the org.openscience.jmol.applet package. The Jvm12 constructor's visibility is solved without modifying the access modifier (leaving the default package visibility). The only problem is that the applet user will have to write: <applet code="org.openscience.jmol.applet.JmolApplet" ...> Which is not as easy as: <applet code="JmolApplet" ... > Isn't it possible to solve this difficulty, by creating a new class in the default package? This class' job would be to "launch" the real applet class (i.e. the org.openscience.jmol.applet.JmolApplet) with the appropriate parameters. As long as package names prevents from class names collision, you could name this "launch" class "JmolApplet" to keep compatibility with old html pages and to prevent from users complaints. ;-) Actually this class would be an interface between the real JmolApplet class and the html pages. Finally, you would have: In the "default" package: - JmolApplet.java (the launcher) In the "org.openscience.jmol.applet" package: - JmolApplet.java (the original one) - JmolAppletControl.java - JmolAppletRegistry.java - Jvm12.java I don't know if this makes more sense than the actual solution. I don't know if it is a good or a bad idea. And... don't ask me how should be written this launcher, I have absolutely no idea. ;-) Yours. M. ---------------------------------------------------------------------- Comment By: Miguel (michaelthoward) Date: 2004-04-01 06:02 Message: Logged In: YES user_id=608250 Very good points. And thank you for filing this. I have fixed and checked in the changes to Jvm12 JmolApplet and JmolAppletControl are in the root for a good reason. When a person wants to create an instance of the applet they need to put the classname in their HTML file. By putting these in the root someone can say <applet code="JmolApplet" ... > instead of <applet code="org.openscience.jmol.applet.JmolApplet" ...> I think there is significant benefit in simplifying the code for the applet users. Does that make sense? I would like to move the JmolAppletRegistry into the jmol.applet package, but I do not know how to import a class that does not exist in a package. Any suggestions? Thanks again for taking the time to file this. Miguel ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=379133&aid=927394&group_id=23629 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ Jmol-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jmol-developers
