@Override public void subPaint(Graphics2D graphics, Dimension dimensions) { mediumStroke = new BasicStroke( ((float) dimensions.width / TARGET_WINDOW_SIZE * 2.0F), BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); majorStroke = new BasicStroke( ((float) dimensions.width / TARGET_WINDOW_SIZE * 4.0F), BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); final float radius = (float) (dimensions.getWidth() * 0.485f); final float tickRadius = (float) (dimensions.getWidth() * 0.485f * this.ticksPositionScale.getValue()); graphics.setFont( getFont().deriveFont((float) (this.getTextSizeScale().getValue() * dimensions.getWidth()))); graphics.setColor(textColor); graphics.setStroke(mediumStroke); textPainter.paint( graphics, centerPoint, radius * textPositionScale.getValue(), 0.0, 30, arrayOfText); graphics.setColor(minorColor); graphics.setStroke(mediumStroke); ShapeUtils.drawRadialLines( graphics, centerPoint, tickRadius * 0.915, tickRadius * 0.95, 0.0, 6.0, 60); ShapeUtils.drawCircle(graphics, centerPoint.getX(), centerPoint.getY(), tickRadius * 0.915); ShapeUtils.drawCircle(graphics, centerPoint.getX(), centerPoint.getY(), tickRadius * 0.95); graphics.setColor(majorColor); graphics.setStroke(majorStroke); ShapeUtils.drawRadialLines( graphics, centerPoint, tickRadius * 0.915, tickRadius * 0.95, 0.0, 30.0, 12); graphics.dispose(); }
@Override public void subPaint(Graphics2D graphics, Dimension dimensions) { int imageWidth = (int) dimensions.getWidth(); // int imageHeight = (int) dimensions.getHeight(); minorStroke = new BasicStroke( ((float) dimensions.width / 500.0f * 1.0F), BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); mediumStroke = new BasicStroke( ((float) dimensions.width / 500.0f * 2.0F), BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); majorStroke = new BasicStroke( ((float) dimensions.width / 500.0f * 3.0F), BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); final Point2D centerPoint = new Point2D.Double(imageWidth / 2.0f, imageWidth / 2.0f); graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); graphics.setRenderingHint( RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); graphics.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); graphics.setRenderingHint( RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY); graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); graphics.setRenderingHint( RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); graphics.setRenderingHint( RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); final float radius = (float) (dimensions.getWidth() * 0.485f); graphics.setColor(minorColor); graphics.setStroke(minorStroke); ShapeUtils.drawRadialLines(graphics, centerPoint, radius * 0.8, radius * 0.85, 0.0, 5.0, 72); ShapeUtils.placeTriangleOnRadius( graphics, centerPoint, radius * 0.075, radius * 0.2, radius * 0.2, 45.0, 90.0, false, 4); ShapeUtils.placeHalfFillTriangleOnRadius( graphics, centerPoint, radius * 0.15, radius * 0.5, radius * 0.312, 0.0, 90.0, 4); graphics.setColor(textColor); graphics.setFont(font.deriveFont((float) (textScale * dimensions.getWidth()))); ShapeUtils.placeTextOnRadiusRotateIn( graphics, centerPoint, radius * 0.95, 0.0, 20, arrayOfDegrees); ShapeUtils.placeTextOnRadiusRotateIn( graphics, centerPoint, radius * 0.6, 45.0, 90, arrayOfTextB); graphics.setFont(font.deriveFont((float) (textScale * 1.3 * dimensions.getWidth()))); ShapeUtils.placeTextOnRadiusRotateIn( graphics, centerPoint, radius * 0.65, 0.0, 90, arrayOfTextA); graphics.setStroke(mediumStroke); ShapeUtils.drawRadialLines(graphics, centerPoint, radius * 0.8, radius * 0.875, 0.0, 20.0, 18); graphics.setStroke(majorStroke); ShapeUtils.drawRadialLines(graphics, centerPoint, radius * 0.8, radius * 0.995, 10.0, 20.0, 18); }