modele
Class AfficherTexteLong

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by modele.AfficherTexteLong

public class AfficherTexteLong
extends javax.microedition.lcdui.Canvas

Permet d'afficher un texte long en fonction de la taille de l'écran


Field Summary
private  int compteurLignes
           
private  int largeurAffichageTexte
           
private  int longeurTexte
           
private  javax.microedition.lcdui.Font policeTexte
           
private  int positionCurseur
           
private  int positionDepartTexte
           
private  java.lang.String texte
           
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP
 
Constructor Summary
AfficherTexteLong()
          Constructeur sans paramètre
 
Method Summary
 void afficher(Stratego stratego, javax.microedition.lcdui.Graphics g, java.lang.String txt, int x, int y, int width, javax.microedition.lcdui.Font font, int couleur, int alignment, int depart)
          Affiche le texte en fonction de la taille de l'écran
private  boolean aPlusDeLignes()
          Vérifie s'il y a encore des lignes à afficher
private  int caractereSuivant()
          Retourne la position du curseur du caractere suivant
 int getCompteurLignes()
           
private  int getMotSuivant(int startIndex)
           
private  java.lang.String nextLine()
          Récupère la prochaine ligne à afficher
protected  void paint(javax.microedition.lcdui.Graphics arg0)
           
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, hideNotify, isDoubleBuffered, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, serviceRepaints, setCommandListener, setFullScreenMode, showNotify, sizeChanged
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setTicker, setTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

policeTexte

private javax.microedition.lcdui.Font policeTexte

texte

private java.lang.String texte

longeurTexte

private int longeurTexte

largeurAffichageTexte

private int largeurAffichageTexte

positionCurseur

private int positionCurseur

positionDepartTexte

private int positionDepartTexte

compteurLignes

private int compteurLignes
Constructor Detail

AfficherTexteLong

public AfficherTexteLong()
Constructeur sans paramètre

Method Detail

afficher

public void afficher(Stratego stratego,
                     javax.microedition.lcdui.Graphics g,
                     java.lang.String txt,
                     int x,
                     int y,
                     int width,
                     javax.microedition.lcdui.Font font,
                     int couleur,
                     int alignment,
                     int depart)
Affiche le texte en fonction de la taille de l'écran

Parameters:
stratego - : instance de Stratégo
g - élements Graphics
txt - le texte à afficher
x - coordonnées en abscisses
y - coordonnées en ordonnées
width - largeur de l'écran
font - police de caractère
couleur - couleur de la police
alignment - alignement du texte
depart - ligne de départ.

aPlusDeLignes

private boolean aPlusDeLignes()
Vérifie s'il y a encore des lignes à afficher


nextLine

private java.lang.String nextLine()
Récupère la prochaine ligne à afficher

Returns:
la chaine à afficher

caractereSuivant

private int caractereSuivant()
Retourne la position du curseur du caractere suivant

Returns:
position du curseur

getMotSuivant

private int getMotSuivant(int startIndex)
Parameters:
startIndex - position de depart du curseur
Returns:
une nouvelle ligne

paint

protected void paint(javax.microedition.lcdui.Graphics arg0)
Specified by:
paint in class javax.microedition.lcdui.Canvas

getCompteurLignes

public int getCompteurLignes()