Adding images into source code

后端 未结 4 486
孤街浪徒
孤街浪徒 2020-12-19 02:08

Is there a way (or an editor) that allows me to link an image/files/http links from within a source file (*.java for instance), sort of like a rich text document?

Th

相关标签:
4条回答
  • 2020-12-19 02:15

    By industry standard, source code is almost always text-only (be it encoded in ASCII or unicode). You can always draw an ASCII art. ;-)

    0 讨论(0)
  • 2020-12-19 02:17

    You can add <img src=""> and <a href=""> in the javadoc of your classes.

    You probably have tools and plug-ins that allow easily to see the Javadoc of your file.

    One good example of mixing images and links in Javadoc is JRootPane

    0 讨论(0)
  • 2020-12-19 02:20

    As many says you can use but for example in Eclipse you encouter error if you don't declare "alt" and if you use "selfclosing" tag like

    <img alt="image desc" src="path/img.jpg">
    

    seems not givin error =)

    0 讨论(0)
  • 2020-12-19 02:26

    Javadocs are HTML, so you can just embed images there:

    /**
     * This class does some funky stuff (see diagram).
     * <img src="relative/path/to/your/image.png" />
     * 
     */
     public class FunkyClass{
     }
    

    Eclipse will happily show you the images in the javadoc view or on hovering over the comment. Other IDEs might or might not do the same.

    Obviously you have to make sure somehow that the images are deployed with the javadocs...

    0 讨论(0)
提交回复
热议问题