@Override
    protected void paintComponent(Graphics g) {
        if (!isInitialized()) {
            return;
        }

        final Graphics2D G2 = (Graphics2D) g.create();

        G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        //G2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
        //G2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
        //G2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
        G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
        //G2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
        G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

        G2.translate(getInnerBounds().x, getInnerBounds().y);

        // Draw the frame
        if (isFrameVisible()) {
            G2.drawImage(frameImage, 0, 0, null);
        }

        // Draw the background
        if (isBackgroundVisible()) {
            G2.drawImage(backgroundImage, 0, 0, null);
        }

        // Draw LCD display
        if (isLcdVisible()) {
            int offset = 0;
            if (isFrameVisible()) {
                offset = 18;
            }

            G2.drawImage(lcdImage, offset, offset, null);

            if (getLcdColor() == LcdColor.CUSTOM) {
                G2.setColor(getCustomLcdForeground());
            } else {
                G2.setColor(getLcdColor().TEXT_COLOR);
            }
            G2.setFont(getLcdUnitFont());
            final double UNIT_STRING_WIDTH;
            if (isLcdUnitStringVisible()) {
                unitLayout = new TextLayout(getLcdUnitString(), G2.getFont(), RENDER_CONTEXT);
                UNIT_BOUNDARY.setFrame(unitLayout.getBounds());
                G2.drawString(getLcdUnitString(), (int) ((lcdImage.getWidth() - UNIT_BOUNDARY.getWidth()) - lcdImage.getWidth() * 0.03f) + offset, (int) (lcdImage.getHeight() * 0.76f) + offset);
                UNIT_STRING_WIDTH = UNIT_BOUNDARY.getWidth();
            } else {
                UNIT_STRING_WIDTH = 0;
            }
            G2.setFont(getLcdValueFont());
            valueLayout = new TextLayout(formatLcdValue(getLcdValue()), G2.getFont(), RENDER_CONTEXT);
            VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
            G2.drawString(formatLcdValue(getLcdValue()), (int) ((lcdImage.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - lcdImage.getWidth() * 0.09) + offset, (int) (lcdImage.getHeight() * 0.76f) + offset);
        }

        // Draw the foreground
        if (isForegroundVisible()) {
            G2.drawImage(foregroundImage, 0, 0, null);
        }

        if (!isEnabled()) {
            G2.drawImage(disabledImage, 0, 0, null);
        }

        G2.translate(-getInnerBounds().x, -getInnerBounds().y);

        G2.dispose();
    }
@ Override protected void paintComponent ( Graphics g ) { if ( ! isInitialized ( ) ) { return ; } final Graphics2D G2 = ( Graphics2D ) g . create ( ) ; G2 . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; G2 . setRenderingHint ( RenderingHints . KEY_RENDERING , RenderingHints . VALUE_RENDER_QUALITY ) ; G2 . setRenderingHint ( RenderingHints . KEY_STROKE_CONTROL , RenderingHints . VALUE_STROKE_NORMALIZE ) ; G2 . setRenderingHint ( RenderingHints . KEY_TEXT_ANTIALIASING , RenderingHints . VALUE_TEXT_ANTIALIAS_ON ) ; G2 . translate ( getInnerBounds ( ) . x , getInnerBounds ( ) . y ) ; if ( isFrameVisible ( ) ) { G2 . drawImage ( frameImage , 0 , 0 , null ) ; } if ( isBackgroundVisible ( ) ) { G2 . drawImage ( backgroundImage , 0 , 0 , null ) ; } if ( isLcdVisible ( ) ) { int offset = 0 ; if ( isFrameVisible ( ) ) { offset = 18 ; } G2 . drawImage ( lcdImage , offset , offset , null ) ; if ( getLcdColor ( ) == LcdColor . CUSTOM ) { G2 . setColor ( getCustomLcdForeground ( ) ) ; } else { G2 . setColor ( getLcdColor ( ) . TEXT_COLOR ) ; } G2 . setFont ( getLcdUnitFont ( ) ) ; final double UNIT_STRING_WIDTH ; if ( isLcdUnitStringVisible ( ) ) { unitLayout = new TextLayout ( getLcdUnitString ( ) , G2 . getFont ( ) , RENDER_CONTEXT ) ; UNIT_BOUNDARY . setFrame ( unitLayout . getBounds ( ) ) ; G2 . drawString ( getLcdUnitString ( ) , ( int ) ( ( lcdImage . getWidth ( ) - UNIT_BOUNDARY . getWidth ( ) ) - lcdImage . getWidth ( ) * 0.03f ) + offset , ( int ) ( lcdImage . getHeight ( ) * 0.76f ) + offset ) ; UNIT_STRING_WIDTH = UNIT_BOUNDARY . getWidth ( ) ; } else { UNIT_STRING_WIDTH = 0 ; } G2 . setFont ( getLcdValueFont ( ) ) ; valueLayout = new TextLayout ( formatLcdValue ( getLcdValue ( ) ) , G2 . getFont ( ) , RENDER_CONTEXT ) ; VALUE_BOUNDARY . setFrame ( valueLayout . getBounds ( ) ) ; G2 . drawString ( formatLcdValue ( getLcdValue ( ) ) , ( int ) ( ( lcdImage . getWidth ( ) - UNIT_STRING_WIDTH - VALUE_BOUNDARY . getWidth ( ) ) - lcdImage . getWidth ( ) * 0.09 ) + offset , ( int ) ( lcdImage . getHeight ( ) * 0.76f ) + offset ) ; } if ( isForegroundVisible ( ) ) { G2 . drawImage ( foregroundImage , 0 , 0 , null ) ; } if ( ! isEnabled ( ) ) { G2 . drawImage ( disabledImage , 0 , 0 , null ) ; } G2 . translate ( - getInnerBounds ( ) . x , - getInnerBounds ( ) . y ) ; G2 . dispose ( ) ; }
<editor-fold defaultstate="collapsed" desc="Visualization">