944,193 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 337
  • Java RSS
Nov 4th, 2009
0

scroll text with many link

Expand Post »
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
java Syntax (Toggle Plain Text)
  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; Nov 4th, 2009 at 5:23 am. Reason: Correcting code tags
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Sandar Khin is offline Offline
18 posts
since Oct 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Search array for account number
Next Thread in Java Forum Timeline: creating files with "outfile..." (file can't found!)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC