I have a program. Here

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

    class MarqueeTest
    {
        public static void main(String[] args)
        {
            MyFrame frame = new MyFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);

        }   
    }

    class MyFrame extends JFrame implements ActionListener
    {
        private ActionListener listener;
        private Timer t1;

        public MyFrame()
        {
            Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
            setSize(d.width,d.height);
            setTitle("MARQUEE");
            MyPanel panel = new MyPanel();
            add(panel);
            listener = this;
            t1 = new Timer(50,listener);
    t1.start();
        }
        public void actionPerformed(ActionEvent event)
        {   
            repaint();
        }

    }

    class MyPanel extends JPanel
    {
        private int x,y;
        private Dimension d ;

        public MyPanel()
        {
            d= Toolkit.getDefaultToolkit().getScreenSize();
            x = d.width - 100;
            y = 25;

        }

        public void paintComponent(Graphics g)
        {
            x -= 5;
    if ( x < -250)
        x = d.width;
    Graphics2D g2 = (Graphics2D) g;

    Font font = new Font("Comic Sans MS",Font.BOLD,25);
    g2.setFont(font);
    g2.setPaint(Color.BLUE);

    g2.drawString("Go To Web Page",x,y);
        }
    }

When I click "Go To Web Page", I want to open web page.Can I do it?If can do, pls tell me how I will do.Thank in advance.:-/

Next time put your code in tags, it makes it easier to read.

As for the text to open a web page, I would just have it a jLabel of a jButton. I haven't ever done it, but it is possible. An example is located here:

http://stackoverflow.com/questions/527719/how-to-add-hyperlink-in-jlabel

If you need more examples, you could always search google with a phrase like so: java jlabel hyperlink

Hi
Thank a lot for your reply.I am so sorry for my code writing style.Thank in advance.:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.