Besoin d'aide pour réaliser une animation text

developvbdebut Messages postés 476 Date d'inscription samedi 14 août 2004 Statut Membre Dernière intervention 2 juin 2012 - 12 avril 2006 à 22:09
developvbdebut Messages postés 476 Date d'inscription samedi 14 août 2004 Statut Membre Dernière intervention 2 juin 2012 - 13 avril 2006 à 11:41
Bonsoir tout le monde

Je suis à la recherche de tutorial pour réalisere un texte qui défile tout le temps que l'application est ouvert.

Je vous signal que que le contenu du textfield varira selon selon une autre class.

J'ai cherché sur le site mai j'ai pas trouvé, à moi que je n'ai cherché au mauvaise endroi.

Excusé moi, d'avoir posté ce message pour si peux, je ne voulais pas le faire, mai c'est urgent..

Merci

Cordialement

A Bientôt

2 réponses

scaryman Messages postés 492 Date d'inscription vendredi 30 janvier 2004 Statut Membre Dernière intervention 16 mai 2007 12
12 avril 2006 à 22:48
Salut
Tu devras utiliser un Thread et suivant la longueur du textfield, tu incluras une certaine portion de ton texte.
Donne nous le bout de code ou tu bloques et on pourra ensuite mieux t'aider.

Voila
A++
0
developvbdebut Messages postés 476 Date d'inscription samedi 14 août 2004 Statut Membre Dernière intervention 2 juin 2012 1
13 avril 2006 à 11:41
Bonjour tout le monde

Voici les code des 3 class concerné.

Voici mon code animation:

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;


public class Animation implements ActionListener
{





public Animation(Monnayeur m)


{


Timer t = null;





private void initMe() {


ActionListener chrono = new ActionListener() {






public void actionPerformed(ActionEvent arg0) {





if (t == null) {
t = new Timer(delay, chrono);
t.start();


}



}


}


}
}

Voici mon code pontAnimation:

import java.awt.*;
import java.awt.event.*;


public class PontAnimation implements ActionListener


{


Monnayeur m;


int choix;


public PontAnimation(int myanim, Monnayeur m)


{


choix=myanim;



this.m=m;



}

public void actionPerformed(ActionEvent e)


{


switch(choix)


{


case 1=2:m.piecedispo();
break;


case 1:m.instruct();
break;


}


}


}

Voici les code où devra intervenir le changement du text.

public void instruct()


{


String cafe="", cafelait="", chocolat="", the="";





if((cafe.equals("café") && sr==0) ||(cafelait.equals("café_au_lait") && sr==0)||(chocolat.equals("chocolat") && sr==0)||(the.equals("the") && sr==0))


{


animation="Somme insuffisante";



}


else
{
sar = sr-cout;


sar = sar*10;

boisson;

}


}

package machine_a_cafe.Monnayeur;





import java.awt.*;
import java.awt.event.*;



public class Monnayeur


{


int sr, sar, cout;


String piece;


String boisson;


String animation="Prenez un momment de détente.";

public void piecedispo()


{


int nb5c, nb10c, nb20c, nb50c, nb1e;


int cinpc=0, dixc=0, vingtc=0, cinquc=0, uneurro=0;


nb5c = 0 ;

String texteDansCinpc = Integer.toString(cinpc);
if ( texteDansCinpc != null && texteDansCinpc.length() > 0 )
{
nb5c = Integer.parseInt( texteDansCinpc );
}



nb10c = 0 ;
String texteDansDixc = Integer.toString(dixc);
if ( texteDansDixc != null && texteDansDixc.length() > 0 )
{
nb10c = Integer.parseInt( texteDansDixc );
}





nb20c = 0 ;
String texteDansvingtc = Integer.toString(vingtc);
if ( texteDansvingtc != null && texteDansvingtc.length() > 0 )
{
nb20c = Integer.parseInt( texteDansvingtc );
}



nb50c = 0 ;
String texteDanscinquc = Integer.toString(cinquc);
if ( texteDanscinquc != null && texteDanscinquc.length() > 0 )
{
nb50c = Integer.parseInt( texteDanscinquc );
}



nb1e = 0 ;
String texteDansuneurro = Integer.toString(uneurro);
if ( texteDansuneurro != null && texteDansuneurro.length() > 0 )
{
nb1e = Integer.parseInt( texteDansuneurro );

}





if(nb5c==0 && nb10c==0 && nb20c==0 && nb50c==0 && nb1e==0)


{


animation="Je ne rend pas la monnaie.";



}
}
}

Ce message devra "Prenez un momment de détente." tant qu'il n'y a aucune action sur les bouton.

Je bloc au niveau de la liaison entre la variable animation de la class Monnayeur et la class Animation en passant par la class PontAnimation.

Car la chaine de caratère va changer selon l'action sur les boutons, donc j'ai fai en sorte que ca change dans la class Monnayeur avec la variable Animation en faisant des conditions.

De plus je ne sais pas comment faire avec le timer.

Pourriez vous me dire ce que je dois modifier.

Merci

Cordialement

A bientôt
0
Rejoignez-nous