Draws text at the specified location, where (0,0) is the upper left corner of the the plot frame and (1,1) is the lower right corner. Uses the justification specified by setJustification(). When called with the same position as the previous addLabel call, the text of that previous call is replace
(double x, double y, String label)
| 1023 | * the lower right corner. Uses the justification specified by setJustification(). |
| 1024 | * When called with the same position as the previous addLabel call, the text of that previous call is replaced */ |
| 1025 | public void addLabel(double x, double y, String label) { |
| 1026 | for (int i=allPlotObjects.size()-1; i>=0; i--) { |
| 1027 | PlotObject plotObject = allPlotObjects.get(i); |
| 1028 | if (plotObject.type == PlotObject.NORMALIZED_LABEL) { //result of previous addLabel |
| 1029 | if (plotObject.x == x && plotObject.y == y) { |
| 1030 | allPlotObjects.set(i, new PlotObject(label, x, y, currentJustification, |
| 1031 | currentFont, currentColor, PlotObject.NORMALIZED_LABEL)); |
| 1032 | return; |
| 1033 | } |
| 1034 | break; |
| 1035 | } |
| 1036 | } |
| 1037 | allPlotObjects.add(new PlotObject(label, x, y, currentJustification, currentFont, currentColor, PlotObject.NORMALIZED_LABEL)); |
| 1038 | } |
| 1039 | |
| 1040 | /* Draws text at the specified location, using the coordinate system defined |
| 1041 | * by setLimits() and the justification specified by setJustification(). */ |