How do I can "slide" the text in a label to the left side? I want to place a "News text" in one line , with short sentences, almost like in news channels in the bottom of screen.
Haven't tried anything, I really don't know where start to try it.
How do I can "slide" the text in a label to the left side? I want to place a "News text" in one line , with short sentences, almost like in news channels in the bottom of screen.
Haven't tried anything, I really don't know where start to try it.
Thanks to "camickr", answered in comments.
I've used a funcion mentioned in one of these links, following:
String horaCorrenteSistema = ""; SimpleDateFormat horaFormatada = new SimpleDateFormat("HH:mm:ss"); Date horaAtual = new Date(); horaCorrenteSistema = horaFormatada.format(horaAtual); ActionListener action = new ActionListener() { public void actionPerformed(ActionEvent e) { String oldText = lblNoticia.getText(); // Scroll right to left String newText = oldText.substring(1) + oldText.substring(0, 1); // Scroll left to right //int length = oldText.length(); //String newText = oldText.substring(length-1, length) + oldText.substring(0, length-1); lblNoticia.setText( newText ); } }; Timer timer = new Timer(500, action); timer.start();
Start by sharing exact code or at least framework or classes you are using.
Click into them, what methods they have.
Is it Swing, SWT or Android?
There is no universal answer.
BTW, you can also can change text of you text label, removing left char every nnn miliseconds.
Good luck