scroll text with many link

Reply

Join Date: Oct 2009
Posts: 14
Reputation: Sandar Khin is an unknown quantity at this point 
Solved Threads: 1
Sandar Khin Sandar Khin is offline Offline
Newbie Poster

scroll text with many link

 
0
  #1
21 Days Ago
Hi all,
Pls help me .I want to make multile JLabel or JTextField with multiple Link in Marquee.I can do only one.Here is my code
  1. import java.awt.*;
  2. import java.io.IOException;
  3. import java.util.*;
  4. import javax.swing.*;
  5. import java.awt.event.*;
  6.  
  7. public class MovingText extends JFrame implements ActionListener{
  8. JLabel label;
  9. JLabel label2;
  10. JLabel label3;
  11. public MovingText()
  12. {
  13. label = new JLabel( "Hello World,Where there is will there is& nbsp;a way");
  14. //label2 = new JLabel(" ......Testing");
  15. //label3 = new JLabel(label.getText().concat(label2.getText()));
  16. getContentPane().add(label, BorderLayout.NORTH);
  17. /*label.addMouseListener(new java.awt.event.MouseAdapter() {
  18. public void mouseClicked(java.awt.event.MouseEvent evt) {
  19. if(evt.getClickCount() > 0){
  20. try {
  21. Process pc = Runtime.getRuntime().exec("cmd.exe /c start http://www.iwebie.com");
  22. } catch (IOException ex) {
  23. System.out.println(ex.getMessage());
  24. System.out.println();
  25. }
  26. }
  27. }
  28. });
  29. label2.addMouseListener(new java.awt.event.MouseAdapter() {
  30. public void mouseClicked(java.awt.event.MouseEvent evt) {
  31. if(evt.getClickCount() > 0){
  32. try {
  33. Process pc = Runtime.getRuntime().exec("cmd.exe /c start http://www.google.com");
  34. } catch (IOException ex) {
  35. System.out.println(ex.getMessage());
  36. System.out.println();
  37. }
  38. }
  39. }
  40. });*/
  41. javax.swing.Timer timer = new javax.swing.Timer(100, this);
  42. timer.start();
  43. //System.out.println("Label 3 "+label3.getText());
  44. }
  45. public void actionPerformed(ActionEvent e) {
  46. String oldText = label.getText();
  47. String newText = oldText.substring(1) + oldText.substring(0, 1);
  48. label.setText( newText );
  49. }
  50. public static void main(String[] args) {
  51. MovingText frame = new MovingText();
  52. frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
  53. frame.setSize(300,100);
  54. frame.setVisible(true);
  55. }
  56. }

I takes the times for many weeks about that.So Pls help me.Thank in advance.
Last edited by peter_budo; 20 Days Ago at 5:23 am. Reason: Correcting code tags
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC