Results 1 to 2 of 2
  1. #1
    gradon is offline Member
    Join Date
    Jul 2007
    Posts
    4
    Rep Power
    0

    Default mouse over on JButton

    JButton b2 = new JButton ("Joke Break", new ImageIcon ("joke.gif"));
    pane.add (b2);
    b2.setBounds (25, 40, 125, 25);


    b2.addActionListener (new ActionListener ()
    {
    public void actionPerformed (ActionEvent e)
    {



    //JokeTxt.setText ();
    Joke ();
    generateJoke ();



    }

    }


    );

    there is the code now i want to make it that when the person wants to click on the Button , when the mouse moves over teh button a message must appear can some1 help me with this
    thanks

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    You can set a rolloverIcon (AbstractButton class) for the button and you also have available the JComponent method setToolTipText.

Similar Threads

  1. Mouse dragg not working
    By Preethi in forum AWT / Swing
    Replies: 1
    Last Post: 02-08-2008, 05:51 AM
  2. The mouse and the cheese
    By Don Quixote in forum Java 2D
    Replies: 4
    Last Post: 08-15-2007, 11:55 PM
  3. How to mouse-drag a JWindow?
    By cruxblack in forum New To Java
    Replies: 3
    Last Post: 08-06-2007, 10:52 AM
  4. Use the mouse position
    By susan in forum Java Applets
    Replies: 1
    Last Post: 07-29-2007, 12:10 AM
  5. Mouse over JButton
    By sandor in forum AWT / Swing
    Replies: 1
    Last Post: 05-17-2007, 10:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •