MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / addLabel

Method addLabel

ij/src/main/java/ij/gui/Plot.java:1025–1038  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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(). */

Callers 4

plotMethod · 0.95
getPlotMethod · 0.95
runMethod · 0.95
updatePlotMethod · 0.95

Calls 4

addMethod · 0.65
sizeMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected