1 package fr.ove.openmath.jome.ctrlview.bidim;
2
3 import java.awt.*;
4 import fr.ove.openmath.jome.ctrlview.bidim.DisplayableImpl;
5
6 /***
7 * The fraction bar to display with a fraction.
8 *
9 * @author © 1999 DIRAT Laurent
10 * @version 2.0 08/07/1999
11 */
12 public class Bar extends DisplayableImpl {
13
14
15
16
17 /***
18 * Sets the height of the instance.
19 * @param height the height of the instance
20 */
21 public void setHeight(int height) {
22 super.setHeight(height);
23
24
25
26
27 setAscent(((height % 2) == 0) ? (height / 2) - 1 : height / 2);
28 setDescent(height - getAscent());
29 }
30
31 /***
32 * The paint method of the object to display.
33 * @param g the drawing area of the symbol.
34 */
35 public void paint(Graphics g) {
36 Dimension size = getSize();
37 g.fillRect(0, 0, size.width, size.height);
38 }
39 }