/* * [Label.java] * * Summary: Describes one : label for bat, but in theory could be used in Java labels too. But that is not implemented. * * 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.BAT_FOREGROUND_FOR_LABEL; import static com.mindprod.jtokens.TokenFonts.EMPHASIS_FONT_SIZE_IN_POINTS; import static com.mindprod.jtokens.TokenFonts.MONO_FONTS; /** * Describes one : label for bat, but in theory could be used in Java labels too. But that is not implemented. * * @author Roedy Green, Canadian Mind Products * @version 2.0 2009-04-19 tidy comments, more accurate colour names * @since 2004-04-24 */ public final class Label extends Token { /** * version number for the class */ static final long serialVersionUID = 1L; /** * Font to render this token */ @SuppressWarnings( { "ConstantNamingConvention" } ) private static final Font labelFont = bestFont( MONO_FONTS, Font.BOLD, EMPHASIS_FONT_SIZE_IN_POINTS ); /** * Constructor * * @param label text */ public Label( String label ) { super( label ); } /** * font to render this token. * * @return Font, in the correct size. */ public Font getFont() { return labelFont; } /** * foreground colour to render this token. * * @return Color object. */ public Color getForeground() { return BAT_FOREGROUND_FOR_LABEL; } /** * get the text surrounded by CSS html * * @return text with an HTML sandwich to render it in a specific colour and font. */ public String getHTML() { return "" + getRawHTML() + ""; } }