Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7188827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:10:08+00:00 2026-05-28T19:10:08+00:00

I display thumbnails in a JPanel. When hovering over such a thumbnail, I want

  • 0

I display thumbnails in a JPanel. When hovering over such a thumbnail, I want to display its full version in an overlay over the thumbnail.

Using HTML I would just create a div with the proper positions and a high z-index, so that it overlays everything else.
Is something similiar and lightweight possible with Swing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:10:09+00:00Added an answer on May 28, 2026 at 7:10 pm

    One way is to use a tool-tip.

    ThumbTip

    import javax.swing.*;
    import java.awt.GridLayout;
    
    class ThumbTip {
    
        private static final String HTML = "<html><body>";
    
        ThumbTip(String[] album) {
            JPanel p = new JPanel(new GridLayout(1,0,2,2));
            for (String url : album) {
                String s = HTML + "<img src='" + url.toString() + "'";
                String size = " width=200 height=150";
                JLabel l = new JLabel(s + size + ">");
                l.setToolTipText(s + ">");
                p.add(l);
            }
            JOptionPane.showMessageDialog(null, p);
        }
    
        public static void main(String[] args) {
            final String[] urls = {
                "http://pscode.org/media/stromlo1.jpg",
                "http://pscode.org/media/stromlo2.jpg"
            };
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    new ThumbTip(urls);
                }
            });
        }
    }
    

    Note:

    1. In this demo. the tool-tip image is downloaded from the net each time it is used. Be patient.
    2. I did not bother to ‘thumbnail’ the original images. ‘Batteries not included’. The latest edit of the source use HTML (the width/height specified for the image) to shrink the ‘thumbnails’. I won’t update the screenshot.
    3. Ultimately the suggestion of using a JWindow is better, since it gives you more control of where and for how long the pop-up appears, as well as its exact look. But this hack is significantly shorter. 😉
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some Thumbnail images .I want to display image thumbnails in a Panorama(or
i want to display thumbnails for videos listed on my site, i want to
I want to display a thumbnail image in a cell of tableViewController , this
I am display thumbnails on a div with overflow:hidden as its style attribute. When
I am using a ListView to load and display thumbnails for image files. The
I am building a WPF application in C# and I want to display thumbnails
I want to display some floating boxes (divs containing thumbnails) and the number of
I want to display a page of thumbnails. The thumbnails are user uploaded artwork
i want to display thumbnails or preview panels for videos listed on my site,
I'm using a ListBox to display a horizontal display of 800 thumbnails, but only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.