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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:11:27+00:00 2026-06-18T03:11:27+00:00

I want to develop a client app for website . I want the app

  • 0

I want to develop a client app for website .

I want the app to reside in system tray when minimised.

I dont know how to accomplish this task .

Is their any example for this type of operation.

  • 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-06-18T03:11:29+00:00Added an answer on June 18, 2026 at 3:11 am

    The key here is to set the implicit exit to false Platform.setImplicitExit(false);
    Also is important to show and hide the stage in a new thread.

     Platform.runLater(new Runnable() {
        @Override
        public void run() {
            stage.show();
        }
     });
    
     Platform.runLater(new Runnable() {
        @Override
        public void run() {
            stage.hide();
        }
     });
    

    Next, the whole code:

    import java.awt.AWTException;
    import java.awt.MenuItem;
    import java.awt.PopupMenu;
    import java.awt.SystemTray;
    import java.awt.TrayIcon;
    import java.awt.event.ActionListener;
    import java.io.IOException;
    import java.net.URL;
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    import javafx.stage.WindowEvent;
    import javax.imageio.ImageIO;
    
    /**
     *
     * @author alvaro
     */
    public class TrayTest extends Application {
    
        private boolean firstTime;
        private TrayIcon trayIcon;
    
    
        public static void main(String[] args)
        {
            launch(args);
        }
    
        @Override
        public void start(Stage stage) throws Exception {
            createTrayIcon(stage);
            firstTime = true;
            Platform.setImplicitExit(false);
            Scene scene = new Scene(new Group(), 800, 600);
            stage.setScene(scene);
            stage.show();
    
        }
    
        public void createTrayIcon(final Stage stage) {
            if (SystemTray.isSupported()) {
                // get the SystemTray instance
                SystemTray tray = SystemTray.getSystemTray();
                // load an image
                java.awt.Image image = null;
                try {
                    URL url = new URL("http://www.digitalphotoartistry.com/rose1.jpg");
                    image = ImageIO.read(url);
                } catch (IOException ex) {
                    System.out.println(ex);
                }
    
    
                stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
                    @Override
                    public void handle(WindowEvent t) {
                        hide(stage);
                    }
                });
                // create a action listener to listen for default action executed on the tray icon
                final ActionListener closeListener = new ActionListener() {
                    @Override
                    public void actionPerformed(java.awt.event.ActionEvent e) {
                        System.exit(0);
                    }
                };
    
                ActionListener showListener = new ActionListener() {
                    @Override
                    public void actionPerformed(java.awt.event.ActionEvent e) {
                        Platform.runLater(new Runnable() {
                            @Override
                            public void run() {
                                stage.show();
                            }
                        });
                    }
                };
                // create a popup menu
                PopupMenu popup = new PopupMenu();
    
                MenuItem showItem = new MenuItem("Show");
                showItem.addActionListener(showListener);
                popup.add(showItem);
    
                MenuItem closeItem = new MenuItem("Close");
                closeItem.addActionListener(closeListener);
                popup.add(closeItem);
                /// ... add other items
                // construct a TrayIcon
                trayIcon = new TrayIcon(image, "Title", popup);
                // set the TrayIcon properties
                trayIcon.addActionListener(showListener);
                // ...
                // add the tray image
                try {
                    tray.add(trayIcon);
                } catch (AWTException e) {
                    System.err.println(e);
                }
                // ...
            }
        }
    
        public void showProgramIsMinimizedMsg() {
            if (firstTime) {
                trayIcon.displayMessage("Some message.",
                        "Some other message.",
                        TrayIcon.MessageType.INFO);
                firstTime = false;
            }
        }
    
        private void hide(final Stage stage) {
            Platform.runLater(new Runnable() {
                @Override
                public void run() {
                    if (SystemTray.isSupported()) {
                        stage.hide();
                        showProgramIsMinimizedMsg();
                    } else {
                        System.exit(0);
                    }
                }
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a client that want to have us develop an app that will
I want to confirm a feature, a client asks to me develop an app
I develop Desktop app dropbox client, i want to authorize my app and get
I want to develop one client server App using Multicasting using UDP in c++
I'm about to develop a rich client desktop app. The last thing I want
I want to develop facebook client in android using fbrocket api.but,this api only allows
I want to develop a client-server based desktop application using .Net 4, C# and
I want to develop cross platform mobile app. I have seen frameworks listed below
I want to develop a website where people can find useful informations about other
I want to develop an app to display the programs schedule of a specific

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.