Kotlin Annotation IntDef

Strange thing, but this question comes in search before the same with right answer Copying it here: import android.support.annotation.IntDef public class Test { companion object { @IntDef(SLOW, NORMAL, FAST) @Retention(AnnotationRetention.SOURCE) annotation class Speed const val SLOW = 0 const val NORMAL = 1 const val FAST = 2 } @Speed private var speed: Int=SLOW public … Read more

JFreechart draw arc on chart

The critical thing about Arc2D is the bounding rectangle. To make the half-arc H units high, the bounds must be 2 * H units high. AFAIK, PolarPlot does not support annotations. import java.awt.BasicStroke; import java.awt.Color; import java.awt.geom.Arc2D; import java.util.Random; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartFrame; import org.jfree.chart.JFreeChart; import org.jfree.chart.annotations.XYLineAnnotation; import org.jfree.chart.annotations.XYShapeAnnotation; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYDataset; … Read more