1 package fr.ove.openmath.jome.ctrlview.bidim;
2
3 import java.awt.*;
4 import fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl;
5 import fr.ove.openmath.jome.ctrlview.bidim.Line;
6
7
8 /***
9 * The "tick" of the square root
10 *
11 * @author © 1999 DIRAT Laurent
12 * @version 2.0 22/07/1999
13 */
14 public class SqrtTick extends DisplayableImpl {
15 /***
16 * The thickness of the tick
17 */
18 private int thickness;
19
20 /***
21 * The elements of the drawing of the tick
22 */
23 private Line line1;
24 private Line line2;
25
26 /***
27 * Sets the thickness of the drawing.
28 * @param thickness the thickness of the drawing.
29 */
30 public void setThickness(int thickness) {
31 this.thickness = thickness;
32 }
33
34 /***
35 * Returns the thickness of the drawing.
36 */
37 public int getThickness() {
38 return thickness;
39 }
40
41 /***
42 * The paint method of the object to display.
43 * @param g the drawing area of the symbol.
44 */
45 public void paint(Graphics g) {
46 int height = getHeight();
47 int width = getWidth();
48
49 g.fillRect(0, (int) Math.round(0.48f * (float) height), (int) Math.round(0.2f * (float) width), thickness);
50
51 line1 = new Line(new Point((int) Math.round(0.1f * (float) width), (int) Math.round(0.48f * (float) height)),
52 new Point((int) Math.round(0.4f * (float) width), height),
53 thickness, Line.RIGHT);
54 line1.draw(g);
55
56 line2 = new Line(new Point((int) Math.round(0.4f * (float) width), height),
57 new Point(width - (int) Math.round(0.2f * (float) width), 0),
58 thickness, Line.CENTER);
59 line2.draw(g);
60
61 g.drawLine((int) Math.round(0.4f * (float) width), height, width - (int) Math.round(0.2f * (float) width), 0);
62
63 g.fillRect(width - (int) Math.round(0.2f * (float) width), 0, (int) Math.round(0.2f * (float) width), thickness);
64 }
65 }
66