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 6176363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:05:21+00:00 2026-05-24T00:05:21+00:00

I am working on a Java Swing application. I need to create a dialog

  • 0

I am working on a Java Swing application. I need to create a dialog like that shown in the figure. I do not know the name for this; I can not explain, so I am attaching a picture.
Please tell what this is called and how I can create it in my GUI application.

Image is like this

  • 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-24T00:05:22+00:00Added an answer on May 24, 2026 at 12:05 am

    There’s more than one way to skin a cat.


    public final class JDialogDemo {
        private static BufferedImage bi;
        
        public static void main(String[] args){
            try {
                loadImage();
                
                SwingUtilities.invokeLater(new Runnable(){
                    @Override
                    public void run() {
                        createAndShowGUI();
                    }
                });
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        
        private static void loadImage() throws IOException{
            bi = ImageIO.read(JDialogDemo.class.getResource("../resource/close-icon.png"));
        }
        
        private static void createAndShowGUI(){
            final JDialog dialog = new JDialog();
            dialog.setUndecorated(true);
            
            final JPanel panel = new JPanel(){
                @Override
                public Dimension getPreferredSize(){
                    return new Dimension(400, 40);
                }
            };
            panel.setBorder(BorderFactory.createLineBorder(Color.GRAY));
            panel.setBackground(new Color(238, 221, 130));
            panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
            
            final JLabel closeLabel = new JLabel();
            closeLabel.setIcon(new ImageIcon(bi));
            closeLabel.addMouseListener(new MouseAdapter(){
                @Override
                public void mouseClicked(MouseEvent e){
                    dialog.dispose();
                }
            });
            
            panel.add(new JLabel("There are deleted items that used to be in this folder."));
            panel.add(Box.createHorizontalGlue());
            panel.add(closeLabel);
            dialog.add(panel);
            dialog.pack();
            dialog.setLocationRelativeTo(null);
            dialog.setVisible(true);
        }
    }
    

    enter image description here


    This is simply a demonstration. Feel free to tailor this however you like.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a Java Swing application. I have a button whose action runs
I'm working on a java SE 1.5+ swing application, in conjunction with others. I'm
I am programming in Java, using Swing. I am currently working with an application
I have to create a desktop application in java. I have experience in working
I am a new to programming with Java and I would like to know
I am writing an application in java (1.6) using swing. I currently have a
I am making an application with Java Swing and i have a problem. I
I need help. I am struggling to get my Observers working in java. Can
I am working on a swing application which primarily includes a JTree and some
I am trying to convert a working simple Java application to an applet. The

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.