Results 1 to 3 of 3
  1. #1
    lightstream is offline Member
    Join Date
    Jan 2009
    Posts
    9
    Rep Power
    0

    Default Best way to do a pop-up 'info bubble'

    this is my first post so hi to everybody :)

    I'm making a Java applet which reads XML data and displays it on a JPanel. There can be several hundred to several thousand points (each point is a GPS position from a cycle ride, I have a screenshot but unfortunately I haven't posted enough to put it in the message). The route is plotted as a graph-like line, and when the mouse is moved over the route, the point underneath is selected and is highlighted in orange.

    My intention is to have a bubble pop up as the mouse selects different points, showing details of that point (speed etc), but I'm not sure what would be the best way to create these 'info-bubbles'.

    I could draw the bubble as 2D geometry directly on the same JPanel as the route, or I could create a child JPanel to hold it. Does anyone know what are the advantages of each approach, or perhaps there's a better method altogether?

    thanks in advance for any suggestions!

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default

    I would go with overriding getToolTipText for the JPanel.

    Recommended reading:
    How to Use Tool Tips (The Java™ Tutorials > Creating a GUI with JFC/Swing > Using Swing Components)

    db

  3. #3
    lightstream is offline Member
    Join Date
    Jan 2009
    Posts
    9
    Rep Power
    0

    Default

    Thanks for the suggestion. Tool tips could work, however I really want to have a bit more control - e.g. multi-line text, images / graphics, and also I want the messages to be 'sticky' i.e. to stay 'popped up' until the mouse moves onto another point.

    I will definitely use that tool tip class, so thanks again for the pointer, but for the info-bubbles - which are to be more like the bubbles on Google maps - I need something a bit more flexible.

Similar Threads

  1. Replies: 3
    Last Post: 01-26-2009, 12:20 AM
  2. Trouble w/ Bubble Sort
    By bri1547 in forum New To Java
    Replies: 4
    Last Post: 08-01-2008, 04:41 PM
  3. How to sort a list using Bubble sort algorithm
    By Java Tip in forum Algorithms
    Replies: 3
    Last Post: 04-29-2008, 08:04 PM
  4. Bubble Sort in Java
    By Java Tip in forum Algorithms
    Replies: 0
    Last Post: 04-15-2008, 07:42 PM
  5. need help with bubble sort
    By lowpro in forum New To Java
    Replies: 3
    Last Post: 12-17-2007, 05:27 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
  •