/* * [Comment.java] * * Summary: Describes and comment, base class for specialised comments!. * * Copyright: (c) 2004-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 2.0 2009-04-19 tidy comments, more accurate colour names */ package com.mindprod.jtokens; import java.awt.Color; import java.awt.Font; import static com.mindprod.jtokens.TokenColourScheme.COMMON_FOREGROUND_FOR_COMMENT; import static com.mindprod.jtokens.TokenFonts.MONO_FONTS; import static com.mindprod.jtokens.TokenFonts.NORMAL_FONT_SIZE_IN_POINTS; /** * Describes and comment, base class for specialised comments!. * * @author Roedy Green, Canadian Mind Products * @version 2.0 2009-04-19 tidy comments, more accurate colour names * @since 2004-04-24 */ public abstract class Comment extends Noise { /** * version number for this class */ static final long serialVersionUID = 2L; /** * Font to render this token */ @SuppressWarnings( { "ConstantNamingConvention" } ) private static final Font commentFont = bestFont( MONO_FONTS, Font.ITALIC, NORMAL_FONT_SIZE_IN_POINTS ); /** * Constructor * * @param comment text including delimiters and but no embedded \n */ @SuppressWarnings( { "WeakerAccess" } ) public Comment( String comment ) { super( comment ); // has to come after call to super constructor } /** * font to render this token. * * @return Font, in the correct size. */ public Font getFont() { return commentFont; } /** * foreground colour to render this token. * * @return Color object. */ public Color getForeground() { return COMMON_FOREGROUND_FOR_COMMENT; } /** * get the text surrounded by CSS html * * @return decorated HTML in a " + getRawHTML() + ""; } }