Pop Up Text in an applet on mouse over event

Can anyone help me to design a pop up text message to be displayed in an applet on moving your mouse over a particular control. Plz. Its urgent

To show a pop-up use javax.swing.Popup. Add a mouse listener to button. When mouse enters the button pop-up shows and when mouse exited the button, pop-up disappears. This pop-up is capable of displaying simple message to any swing component. Sample code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
* @author mrityunjoy_saha
* @version 1.0
public class AppletWithPopup extends JApplet {
    private Popup popup;
    private JButton button;
    private JLabel message;
    @Override
    public void init() {
        setLayout(new FlowLayout());
        button = new JButton("Hello");
        message = new JLabel("This is a JLabel. It can be any swing component.");
        button.addMouseListener(new MyMouseListener());
        add(button);
    private class MyMouseListener extends MouseAdapter {
        @Override
        public void mouseEntered(MouseEvent e) {
            System.out.println("Mouse entered.");
            PopupFactory factory = PopupFactory.getSharedInstance();
            popup = factory.getPopup(AppletWithPopup.this, message, (int) button.getLocationOnScreen().
                    getX() - 20, (int) button.getLocationOnScreen().getY() + 40);
            //popup = factory.getPopup(AppletWithPopup.this, message, 50, 10);
            popup.show();
        @Override
        public void mouseExited(MouseEvent e) {
            System.out.println("Mouse exited.");
            if (popup != null) {
                popup.hide();
}If you are talking about alert box (where some message can be displayed), in above example instead of javax.swing.Popup use javax.swing.JOptionPane. In case you are using JOptionPane, make it visible in mouseEntered() method and hide it in mouseExited() method.
Thanks,
Mrityunjoy

Similar Messages

  • Mouse over event for every word inside a text?

    I want to do a separate mouse over event for every word inside a text.
    or at least get the string below the mouse cursor.
    any hint?
    henry

    There are no events for it but you can use TextField.getCharIndexAtPoint() to determine the character where the mouse is over, and from there you can work out the word where the mouse is over.

  • Mouse Over Event handling - Webdynpro

    Hi,
    We are working on a sample Webdynpro application. We want to show a pop up window on Mouse over of a control. Is this possible in WebDynpro? Do we have a handle for the mouse over event!?
    Kindly help.
    Best Regards,
    Anusha

    hi anusha,
    If it is simply a tooltip that you would like to be displayed then there is a tooltip attribute that can be set when using the HTMLb controls, or the method setTooltip("my tooltip"); when using the APIs. If you need more of a mouse over event, then I would personally use standard HTML instead. You can use the same css classes that are used when creating HTMLb components so that the button would look the same, but it would be more under your own control
    some code snippets are there in this link if you are using bsp.
    Clicking a htmlb:button via Java Script
    thanks
    vishal

  • Mouse Over event not dispatching properly.

    Hi,
    I am working on a scroll for iPhone, in which I'm using touch scrolling, it is working fine with less number of list items, but when I increases the nuber of items in scroll list, the mouse over event not propogates properly, I mean to say those events are overlapping due to some extra memory issue, can any one have any idea about it.
    I'm pasting code for your reference :
    public function IPhoneScroll( pContent:DisplayObjectContainer, pStage:Stage ) {
                                  _stage = pStage;
                                  _myScrollElement = pContent;
                                  _canvasHeight = _myScrollElement.height;
                                  start();
                                  // add handlers
                                  _myScrollElement.addEventListener(MouseEvent.MOUSE_DOWN, on_mouse_down);
                                  _myScrollElement.addEventListener(Event.ENTER_FRAME, on_enter_frame);
                        private function on_enter_frame(e:Event):void {
                                  if ( started )
                                            // decay the velocity
                                            if(_mouseDown) _velocity *= MOUSE_DOWN_DECAY;
                                            else _velocity *= DECAY;
                                            // if not mouse down, then move the element with the velocity
                                            if (!_mouseDown)
                                                      var textHeight:Number = _myScrollElement.height;
                                                      var y:Number = _myScrollElement.y;
                                                      var bouncing:Number = 0;
                                                      // calculate a bouncing when the text moves over the canvas size
                                                      if (y > 0 || textHeight <= _canvasHeight) // textHeight <= _canvasHeight => when the item is smaller than the stage.height, align to the top
                                                                bouncing = -y * BOUNCING_SPRINGESS;
                                                      }else if( y + textHeight < _canvasHeight){
                                                                bouncing = (_canvasHeight - textHeight - y) * BOUNCING_SPRINGESS;
                                                      _myScrollElement.y = y + _velocity + bouncing;
                        // when mouse button up
            private function on_mouse_down(e:MouseEvent):void
                if (!_mouseDown)
                    // get some initial properties
                    _mouseDownPoint = new Point(e.stageX, e.stageY);
                    _lastMouseDownPoint = new Point(e.stageX, e.stageY);
                    _mouseDown = true;
                    _mouseDownY = _myScrollElement.y;
                                            // add some more mouse handlers
                    _stage.addEventListener(MouseEvent.MOUSE_UP, on_mouse_up);
                    _stage.addEventListener(MouseEvent.MOUSE_MOVE, on_mouse_move);
            // when mouse is moving
            private function  on_mouse_move(e:MouseEvent):void
               if (_mouseDown)
                    // update the element position
                    var point:Point = new Point(e.stageX, e.stageY);
                    _myScrollElement.y = _mouseDownY + (point.y - _mouseDownPoint.y);
                    // update the velocity
                    _velocity += ((point.y - _lastMouseDownPoint.y) * SPEED_SPRINGNESS);
                    _lastMouseDownPoint = point;
            // clear everythign when mouse up
            private function  on_mouse_up(e:MouseEvent):void
                if (_mouseDown)
                    _mouseDown = false;
                    _stage.removeEventListener(MouseEvent.MOUSE_UP, on_mouse_up);
                    _stage.removeEventListener(MouseEvent.MOUSE_MOVE, on_mouse_move);
                        public function release():void
                                  _myScrollElement.removeEventListener(MouseEvent.MOUSE_DOWN, on_mouse_down);
                                  _myScrollElement.removeEventListener(Event.ENTER_FRAME, on_enter_frame);
                                  _myScrollElement = null;
    The highlighted part is working properly for less items but not for more number of items, lets say 200 movieclips in scroll lists.
    Please help me on this, thanks in advance.
    Vipul

    Hello.
    Look I have an idea, I donu2019t know if you already try it.
    Please give the format that you want percentage, decimals etc...
    In the Excel where the charts are being directed
    Then redirect de chart to the same cells, these with the porpoise of refreshing
    Now each serie have the format.
    Please let me now what happen with these

  • Mouse over events on alv report?

    Hello,
    i want to make mouse over event for rows of a alv report.When mouse is on a row there will be shown explanations.
    how can i do this?
    thanks inn advance.

    Cem ,
    Please follow the code mentioned in the links below :
    Hotspot in ALV grid
    http://wiki.scn.sap.com/wiki/display/Snippets/Interactive?original_fqdn=wiki.sdn.sap.com
    Thanks
    Ankit

  • How to define mouse-over event for a icon

    Hello,
    I have defined a icon for a panel in my plugin. I want that the icon should be changed on mouse over event.
    The code for icon is given below.
    resource PanelList (kDNDListsPaletteResourceID) {
                        // 1st panel in the list
                        kDNDListsPaletteResourceID,                    // Resource ID for this panel (use SDK default rsrc ID)
                        kIBPluginPluginID,                                             // ID of plug-in that owns this panel
              #if CSVER >= 4
                        kIsResizable,
              #else
                        isResizable,
              #endif
                        kIBClientPluginDNDPanelWidgetActionID,          // Action ID to show/hide the panel
                        kIBClientPluginDNDPanelTitleKey,               // Shows up in the Window list.
                        "",                                                           // Alternate menu path of the form "Main:Foo" if you want your palette menu item in a second place
                        0.0,                                                                                     // Alternate Menu position Alternate Menu position for determining menu order
                        kPlusIconPNGIconRsrcID, kIBPluginPluginID,                                                            // Rsrc ID, Plugin ID for a PNG icon resource to use for this palette
                        c_Panel
    Where should I give the resourceID of the other icon?

    Hi
    First change the name from kPlusIconPNGIconRsrcID to kPlusIconPNGIconIRsrcID
    so "I" will indicate that your icon is inactive
    Create another resource id like:
    #define kPlusIconPNGIconIRsrcID 15
    #define kPlusIconPNGIconARsrcID 15
    Define paths to the icons
    resource PNGA(kPlusIconPNGIconIRsrcID) "../res/icons/PLUS_ICO_23_I.png" // Inactive icon
    resource PNGR(kPlusIconPNGIconARsrcID) "../res/icons/PLUS_ICO_23_A.png" // Active icon
    Regards
    Bartek

  • Does Flash Engine supports "Mouse Over" events on an Android device with a mouse?

    We built our custome Android on a Beagle Board. When we play a Flash content on WebKit, the flash does not respond to mouse over events.
    When mouse pointer comes on an object with mouse over effect, nothing happends.
    Can you confirm that there is Mouse Over support in Android 2.2 Flash Engine?
    Thanks in Advance

    Thanks for the link. Im just stuck on one issue right now. I
    quickly noticed that the samples make use of mx.transitions.easing
    as seen in the script below. How does Flash 8 address this?
    myButton_btn.onRelease = function() {
    tweenBall(mx.transitions.easing.Bounce.easeOut);
    function tweenBall(easeType) {
    var begin = 20;
    var end = 380;
    var time = 20;
    var mc = ball_mc;
    ballTween = new mx.transitions.Tween(mc, "_x", easeType,
    begin, end, time);

  • Mouse over event

    Hello,
    I have two objects. First object (1) has event listener
    MOUSE_OVER. On this object is another object (2) without listener.
    When I move with the mouse on second object, mouse over event on
    object 1 is not dispatched. I don't know why. How can I do it ??
    thanks

    If both objects are in a VBox, with the second object (no
    listener) overlapping the first object (has listener), when you
    hover over second object, if you have a listener on the container
    you should be able to see if the target for the event is the second
    object and then take action.
    This is because events first "cascade" down from the top of
    the display list, through all containers until they reach the
    target (targetting phase), and then they bubble back up to the top
    of the display list (bubling phase).

  • Bookmarks and tab titles display garbled text or text from another bookmark until moused over

    I just upgraded to Windows 8 and loaded Firefox 18 - I imported my bookmarks HTML file and the bookmarks on the left display either garbage or the wrong title until I mouse over them. They then display correctly unless I mouse over them again. My tabs display bookmark titles until I mouse over them.

    Could you try version 18.0.1? Also, please provide us with screen shots? And, you can check if your add-ons are causing this as well.
    '''Try the Firefox Safe Mode''' to see how it works there. The Safe Mode is a troubleshooting mode, which disables most add-ons.''
    ''(If you're not using it, switch to the Default theme.)''
    * You can open the Firefox 4.0+ Safe Mode by holding the '''Shift''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    ''Don't select anything right now, just use "'Start in Safe Mode"''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shift key) to open it again.''
    '''''If it is good in the Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one.
    Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''

  • Tabnavigator  mouse over event

    Hi Guys,
    I'm new to Flex and have a dumb question.
    How do I get some text to display in a text area (in a
    separate panel) when I mouse over a tab in a Tabnavigator
    component?
    Can anyone help me?

    I write the code addEventListener(MouseEvent.MOUSE_OUT, outEventHandler); in the overEventHandler
    The problem is the event will be trigger ceaselessly.
    Can I send you the flv file? Please help me to solve this trouble.

  • Mouse over event listener? in Flash CS4 (AS3)

    Hi,
    I was wondering if there is such a thing as a mouse over listener.
    So that it would execute code when the mouse rolls over(and maybe also execute code when the mouse moves away again)
    Thank you for any help.

    yes, there are mouseover and rollover events, as well as, their "out" events:
    MouseEvent.MOUSE_OVER
    MouseEvent.ROLL_OVER

  • Please assist me with the mouse over event on this clip

    I'm trying to make a notices box in flash that slides over to the right and opens on mouse over.
    I've done the necessary actionscripting I feel, yet the clip doesnt quite behave the way it should
    Can someone please help me
    I'm including a link to download the .fla file as it won't let me attach it here with this post saying " The content type of this attachment is not allowed. "
    http://rapidshare.com/files/258224416/slider.fla.html
    Thanks in advance,
    ELBEE.

    You're a life saver pal
    Thanks a lot
    Cheers !

  • Mouse over events have just stopped working

    My mouse over effects have stopped working.
    1/ Dock does not longer show tips and does not magify
    2/ Drop downs don't highlight with the blue bar
    I've trashed the preferences file and also reset/shutdown the mac but it's still not working.
    Can anybody help
    Thanks.

    I'm logging this fix myself in-case anybody else searches this problem.
    Basically:
    1/ Shutdown the Mac
    2/ Hold down the "Apple" Key, The "alt" key, The "R" key and the "P" key all together that's 4 keys!
    3/ Turn on your mac
    4/ The mac will make the boot sound, make sure it does it at least two time then let go of the keys.
    5/ Once the mac has booted up this should fix the problem.
    Disclaimer: This worked for me and the information was given to me by Mac support. If your un-sure about anything phone mac support if you don't want to risk anything.
    Just trying to help others

  • Tooltips when placing mouse over event

    First thing - I LOVE iMac, it's an incredible design of what real computer should be. I wish somebody told me that 10 years ago or more.
    I just switched from PC. On PC I used an excellent piece of calendar software, "UK Kalender". It's better than anything else.
    iCal is excellent too, I like it. But it seems to me, it's not polished.
    For example, font is too small. I'm not suggesting to have an option of all the fonts there are, and adjusting them, it will slow down the calendar. But at least to have 2 sizes: a small font(the current one) and a larger(like on Safari).
    Another thing. it's a question: is it possible to have toolltips when placing a mouse over an event ?
    In other words, when placing a mouse over an event, a tool tip shows up with all the info about this day's events.
    This would be extremely helpful, saving from double clicking and opening another window.

    If both objects are in a VBox, with the second object (no
    listener) overlapping the first object (has listener), when you
    hover over second object, if you have a listener on the container
    you should be able to see if the target for the event is the second
    object and then take action.
    This is because events first "cascade" down from the top of
    the display list, through all containers until they reach the
    target (targetting phase), and then they bubble back up to the top
    of the display list (bubling phase).

  • How to stop IE from displaying alt text as tool tip when mouse over image.

    I have random images being [B]echo[/B] by a PHP script on a page.
    [CODE]<img src="<?php echo $randomImage; ?>" alt="This is alt text" />[/CODE]
    The problem is every time you scroll over the image, IE spits out the alt text.
    I understand the alt text are meant for accessibility.
    So how can I stop this IE behavior with out compromising accessibilty?
    Thanks everyone.
    Patrick

    E. Michael Brandt wrote:
    Screen readers whould still read the alt attribute despite the presence of a title attribute.  In fact most apparently do not read the Title on an image:
    http://www.paciellogroup.com/resources/articles/WE05/forms.html
    As always some Screen Reader users can reconfigure the software:
    http://www.isolani.co.uk/blog/access/ConfiguringLinksInScreenReaders
    So in general I think you are safe doing this, but perhaps others can weigh in here.
    E. Michael Brandt
    www.divahtml.com
    www.divahtml.com/products/scripts_dreamweaver_extensions.php
    Standards-compliant scripts and Dreamweaver Extensions
    www.valleywebdesigns.com/vwd_Vdw.asp
    JustSo PictureWindow
    JustSo PhotoAlbum, et alia
    Thanks very much,
    I saw several scripts where Javascript were used.
    But your solution is very simple and it works perfectly in IE7, don't know if it works in IE 8.
    Thanks again,
    Patrick

Maybe you are looking for

  • When or How does the time stamp on Report Manager / Data Collection change

    Hi, I have been waiting since 10am waiting for data to be available. Unfortunately, the Sun MC has not updated the time stamp. I am unable to create graphs for the machines I setup this morning? Any ideas on how to post data faster than waiting forev

  • Windows Server 2003 and problem with SSL connection (TLS)

    Hi, We are forcing a problem with SLL/TLS connection on a machine Windows Server 2003 SP2. We spent hours trying to solve it without any result.  SYMPTOMS No SSL connection can be established in any application since last year, e.g.: we cannot do any

  • Acrobat retains plug-ins after deletion

    I have installed Acrobat Pro 8.1 and added upgrades for 8.1.1 and 8.1.2. This is with Vista Home Premium. I added some plug-ins eg pitstop and then uninstalled them. They are not in the plug-ins directory or on any drive, however Acrobat still has th

  • Turning off backlight?

    I have a Video iPod. The backlight is set to turn off after 5 seconds, which it does. However, for some time, there is a very faint backlight that remains on. I can still see all of the menu items. It's very dim but visible. Is there a way to turn th

  • Is anyone else having issues with Lion?

    I have been a loyal apple user for years.  I have recommended apple hardware and software to my students.  I use and develop software on Mac (for OS X and iOS).  Since Lion I have experenced more crashes that all of my previous years using Macs.  App