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

  • Home
  • SEARCH
  • 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 3394850
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:13:10+00:00 2026-05-18T04:13:10+00:00

I am writing a Java Swing-based program using and JFrame that is able to

  • 0

I am writing a Java Swing-based program using and JFrame that is able to display a system tray icon for quick access to most-used features. Now I want to add an option for the user to choose whether or not the normal (Windows) taskbar icon should be displayed when the program window is minimized.

A search in Google told me that I can use JDialog instead of JFrame. Unfortunately that is not a good solution in my case, because I want to dynamically enable or disable the task bar icon based on the user’s decision.

Is that possible somehow?

Thanks and kind regards, Matthias

  • 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-18T04:13:10+00:00Added an answer on May 18, 2026 at 4:13 am

    Something to try, though I am not entirely sure this will work becase it is late here and I may be thinking about this the wrong way.

    When you minimize a window, an event is triggered, what you want to do is catch it by adding a WindowStateListener to the JFrame that watches for WINDOW_ICONIFIED and WINDOW_DEICONIFIED. When WINDOW_ICONIFIED occurs, set the visible property of the JFrame to false; when WINDOW_DEICONIFIED set it to true. A quick test of setting a frames visibility to false seemed to remove it from the task bar, all you have to do is figure out if it does actually work and then implement a state listner.

    Here is the code I used to test

    import java.awt.*;
    
    public class FrameTest
    {
        public static void main (String args[]) throws Exception
        {
            // Create a test frame
            Frame frame = new Frame("Hello");
            frame.add ( new Label("Minimize demo") );
            frame.pack();
    
            // Show the frame
            frame.setVisible (true);
    
            // Sleep for 5 seconds, then minimize
            Thread.sleep (5000);
            frame.setState ( Frame.ICONIFIED );
            frame.setVisible(false);
            // Sleep for 5 seconds, then restore
            Thread.sleep (5000);
            frame.setState ( Frame.NORMAL );
            frame.setVisible(true);
    
            // Sleep for 5 seconds, then kill window
            Thread.sleep (5000);
            frame.setVisible (false);
            frame.dispose();
    
            // Terminate test
            System.exit(0);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Java Swing application using the Metal look-and-feel. Every time there is
I am writing an application in Java using Swing. I am trying to implement
I am writing a desktop application written in Swing developed using Java 1.5. Some
I'm writing a Java application that runs on Linux (using Sun's JDK). It keeps
The naive way of writing building a menu in a Java Swing app is
I am writing a client-side Swing application (graphical font designer) on Java 5 .
For various reasons calling System.exit is frowned upon when writing Java Applications , so
I am writing a Java utility that helps me to generate loads of data
I'm in Eclipse writing Java. I come from Visual Studio with Resharper writing C#.
Please suggest some good resources to start writing Java Web services.

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.