This site requires JavaScript, please enable it in your browser!
Greenfoot back
wueschn
wueschn wrote ...

2017/11/5

Own class in the helper class folder

wueschn wueschn

2017/11/5

#
The helper classes are in this folder of mine (to be ready to be imported): C:\Program Files (x86)\Greenfoot\lib\greenfoot\common When I put in the same folder an own class everything works with import. But when put in this folder the suiting class-doc.html file, it`s not shown in the preview? Have anyone of you an idea how get this work? Thanks a lot! Mario
danpost danpost

2017/11/5

#
You need to copy the HTML file into that folder also. You can find in the 'docs' folder of your project.
wueschn wueschn

2017/11/6

#
@danpost Thanks for your help. I did this, but when you click "edit-import class" the own imported class is shown, but not the html-File. So it is not possible to read the documentation before you import this class.
nccb nccb

2017/11/8

#
The code for the import looks in that directory for class files, say Foo.class If it finds such a file, it also looks for Foo.java in the same directory. It expects this to be a Javadoc HTML file (not custom one) but if it finds the HTML file, it should get displayed in the dialog.
danpost danpost

2017/11/8

#
nccb wrote...
The code for the import looks in that directory for class files, say Foo.class
I am confused. There does not seem to be any CLASS files in the 'common' directory. It contains (basically) JAVA and HTML files. However, if I include a pair of these files for an additional class, greenfoot beeps at me and displays an empty preview when I click on it for selection to import.
nccb nccb

2017/11/9

#
Whoops, I wrote the extensions wrong in that post. It should say it looks for Java files, say Foo.java . If it finds one, it looks for Foo.html in the same directory. If adding new ones doesn't work, it may be worth checking the debug log for clues. I admit it's probably not a situation that has been tested out greatly, but the intention is that it should work for you to add your own .java and .html to that directory.
danpost danpost

2017/11/9

#
Debug log contains no clues. Preview works for original JAVA and HTML files; added one come up as selections, but the computer beeps when selecting one and preview turns blank.
nccb nccb

2017/11/9

#
It looks like the problem is that the more recent versions of the Javadoc tool in the JDK generate a line in the HTML which Swing's old and creaking HTML view does not like. Try deleting this line from about line 6 in your HTML file that won't display:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
I believe that will allow it to display in the existing Greenfoot. This problem should be fixed in the next major Greenfoot release, when we will switch to using JavaFX's WebView, which is much more modern.
danpost danpost

2017/11/9

#
nccb wrote...
Try deleting this line from about line 6 in your HTML file that won't display:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
That does the trick. Thanks.
You need to login to post a reply.