View Javadoc

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      // La barre de fraction correspond en fait ? la taille de DisplayableImpl.
14      // La longueur correpond ? la largeur.
15      // L'Èpaisseur correspond ? la hauteur
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          // Mais l?, en plus, on calcule l'ascent et le descent
24          // car en fait, c'est la hauteur (l'Èpaisseur) de la barre de fraction
25          // Qui dÈtermine leur valeur
26          //setAscent(height / 2);
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  }