01: /*
02: * Author: Chris Seguin
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package org.acm.seguin.print.text;
10:
11: import java.awt.Graphics;
12: import org.acm.seguin.util.TextFormatter;
13:
14: /**
15: * Prints a single line
16: *
17: *@author Chris Seguin
18: */
19: public class NumberedLinePrinter extends LinePrinter {
20: /**
21: * Prints the line
22: *
23: *@param g The graphics device
24: *@param line The string to print
25: *@param x The x location on the graphics device
26: *@param y The y location on the graphics device
27: *@param set The set of lines
28: *@param index The line we are printing
29: */
30: public void print(Graphics g, String line, int x, int y,
31: LineSet set, int index) {
32: String output = TextFormatter.rightJustifyNumber(index + 1, 5)
33: + ": " + line;
34: g.drawString(output, x, y);
35: }
36: }
|