Java frame iconified issue





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I am trying to figure out how to modify some existing code so that the console window that launches, starts out minimized as a tray icon instead of the default behavior which is to just open the window. Unfortunately I do not know Java, so I am having to just search Google and guess and check based on what code does make sense to me. I know this is asking a lot. I am trying my best to slowly pickup Java and I really appreciate the help. Could someone please read over this file and tell me if there is an obvious Boolean flip I need to make to change this behavior, or swap out some event handler. The code already has the provision to switch back and forth between tray icon and full window and I have made some progress by reading up on window listeners, specifically windowIconified, but I just don't have enough experience yet to really understand the changes I am making as they are not immediately obvious. The file below is one of many in this project, so if after reading you feel I am mistaken and the applicable code is missing, I can provide it. If I am properly understanding the code though, this is the file that builds out the console window, so I would assume the changes need to be made here. Thank you for any help!



package com.skcraft.launcher.dialog;

import com.skcraft.launcher.Launcher;
import com.skcraft.launcher.swing.LinedBoxPanel;
import com.skcraft.launcher.swing.MessageLog;
import com.skcraft.launcher.swing.SwingHelper;
import com.skcraft.launcher.util.PastebinPoster;
import com.skcraft.launcher.util.SharedLocale;
import lombok.Getter;
import lombok.NonNull;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import static com.skcraft.launcher.util.SharedLocale.tr;

/**
* A frame capable of showing messages.
*/
public class ConsoleFrame extends JFrame {

private static ConsoleFrame globalFrame;

@Getter private final Image trayRunningIcon;
@Getter private final Image trayClosedIcon;

@Getter private final MessageLog messageLog;
@Getter private LinedBoxPanel buttonsPanel;

private boolean registeredGlobalLog = false;

/**
* Construct the frame.
*
* @param numLines number of lines to show at a time
* @param colorEnabled true to enable a colored console
*/
public ConsoleFrame(int numLines, boolean colorEnabled) {
this(SharedLocale.tr("console.title"), numLines, colorEnabled);
}

/**
* Construct the frame.
*
* @param title the title of the window
* @param numLines number of lines to show at a time
* @param colorEnabled true to enable a colored console
*/
public ConsoleFrame(@NonNull String title, int numLines, boolean colorEnabled) {
messageLog = new MessageLog(numLines, colorEnabled);
trayRunningIcon = SwingHelper.createImage(Launcher.class, "tray_ok.png");
trayClosedIcon = SwingHelper.createImage(Launcher.class, "tray_closed.png");

setTitle(title);
setIconImage(trayRunningIcon);

setSize(new Dimension(650, 400));
initComponents();

setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent event) {
performClose();
}
});
}

/**
* Add components to the frame.
*/
private void initComponents() {
JButton pastebinButton = new JButton(SharedLocale.tr("console.uploadLog"));
JButton clearLogButton = new JButton(SharedLocale.tr("console.clearLog"));
buttonsPanel = new LinedBoxPanel(true);

buttonsPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
buttonsPanel.addElement(pastebinButton);
buttonsPanel.addElement(clearLogButton);

add(buttonsPanel, BorderLayout.NORTH);
add(messageLog, BorderLayout.CENTER);
clearLogButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
messageLog.clear();
}
});

pastebinButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
pastebinLog();
}
});

hideMessages();
}

/**
* Register the global logger if it hasn't been registered.
*/
private void registerLoggerHandler() {
if (!registeredGlobalLog) {
getMessageLog().registerLoggerHandler();
registeredGlobalLog = true;
}
}

/**
* Attempt to perform window close.
*/
protected void performClose() {
messageLog.detachGlobalHandler();
messageLog.clear();
registeredGlobalLog = false;
dispose();
}

/**
* Send the contents of the message log to a pastebin.
*/
private void pastebinLog() {
String text = messageLog.getPastableText();
// Not really bytes!
messageLog.log(tr("console.pasteUploading", text.length()), messageLog.asHighlighted());

PastebinPoster.paste(text, new PastebinPoster.PasteCallback() {
@Override
public void handleSuccess(String url) {
messageLog.log(tr("console.pasteUploaded", url), messageLog.asHighlighted());
SwingHelper.openURL(url, messageLog);
}

@Override
public void handleError(String err) {
messageLog.log(tr("console.pasteFailed", err), messageLog.asError());
}
});
}

public static void showMessages() {
ConsoleFrame frame = globalFrame;
if (frame == null) {
frame = new ConsoleFrame(10000, false);
globalFrame = frame;
frame.setTitle(SharedLocale.tr("console.launcherConsoleTitle"));
frame.registerLoggerHandler();
frame.setVisible(true);
} else {
frame.setVisible(true);
frame.registerLoggerHandler();
frame.requestFocus();
}
}

public static void hideMessages() {
ConsoleFrame frame = globalFrame;
if (frame != null) {
frame.setVisible(false);
}
}

}


Window










share|improve this question































    0















    I am trying to figure out how to modify some existing code so that the console window that launches, starts out minimized as a tray icon instead of the default behavior which is to just open the window. Unfortunately I do not know Java, so I am having to just search Google and guess and check based on what code does make sense to me. I know this is asking a lot. I am trying my best to slowly pickup Java and I really appreciate the help. Could someone please read over this file and tell me if there is an obvious Boolean flip I need to make to change this behavior, or swap out some event handler. The code already has the provision to switch back and forth between tray icon and full window and I have made some progress by reading up on window listeners, specifically windowIconified, but I just don't have enough experience yet to really understand the changes I am making as they are not immediately obvious. The file below is one of many in this project, so if after reading you feel I am mistaken and the applicable code is missing, I can provide it. If I am properly understanding the code though, this is the file that builds out the console window, so I would assume the changes need to be made here. Thank you for any help!



    package com.skcraft.launcher.dialog;

    import com.skcraft.launcher.Launcher;
    import com.skcraft.launcher.swing.LinedBoxPanel;
    import com.skcraft.launcher.swing.MessageLog;
    import com.skcraft.launcher.swing.SwingHelper;
    import com.skcraft.launcher.util.PastebinPoster;
    import com.skcraft.launcher.util.SharedLocale;
    import lombok.Getter;
    import lombok.NonNull;

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;

    import static com.skcraft.launcher.util.SharedLocale.tr;

    /**
    * A frame capable of showing messages.
    */
    public class ConsoleFrame extends JFrame {

    private static ConsoleFrame globalFrame;

    @Getter private final Image trayRunningIcon;
    @Getter private final Image trayClosedIcon;

    @Getter private final MessageLog messageLog;
    @Getter private LinedBoxPanel buttonsPanel;

    private boolean registeredGlobalLog = false;

    /**
    * Construct the frame.
    *
    * @param numLines number of lines to show at a time
    * @param colorEnabled true to enable a colored console
    */
    public ConsoleFrame(int numLines, boolean colorEnabled) {
    this(SharedLocale.tr("console.title"), numLines, colorEnabled);
    }

    /**
    * Construct the frame.
    *
    * @param title the title of the window
    * @param numLines number of lines to show at a time
    * @param colorEnabled true to enable a colored console
    */
    public ConsoleFrame(@NonNull String title, int numLines, boolean colorEnabled) {
    messageLog = new MessageLog(numLines, colorEnabled);
    trayRunningIcon = SwingHelper.createImage(Launcher.class, "tray_ok.png");
    trayClosedIcon = SwingHelper.createImage(Launcher.class, "tray_closed.png");

    setTitle(title);
    setIconImage(trayRunningIcon);

    setSize(new Dimension(650, 400));
    initComponents();

    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new WindowAdapter() {
    @Override
    public void windowClosing(WindowEvent event) {
    performClose();
    }
    });
    }

    /**
    * Add components to the frame.
    */
    private void initComponents() {
    JButton pastebinButton = new JButton(SharedLocale.tr("console.uploadLog"));
    JButton clearLogButton = new JButton(SharedLocale.tr("console.clearLog"));
    buttonsPanel = new LinedBoxPanel(true);

    buttonsPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    buttonsPanel.addElement(pastebinButton);
    buttonsPanel.addElement(clearLogButton);

    add(buttonsPanel, BorderLayout.NORTH);
    add(messageLog, BorderLayout.CENTER);
    clearLogButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
    messageLog.clear();
    }
    });

    pastebinButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
    pastebinLog();
    }
    });

    hideMessages();
    }

    /**
    * Register the global logger if it hasn't been registered.
    */
    private void registerLoggerHandler() {
    if (!registeredGlobalLog) {
    getMessageLog().registerLoggerHandler();
    registeredGlobalLog = true;
    }
    }

    /**
    * Attempt to perform window close.
    */
    protected void performClose() {
    messageLog.detachGlobalHandler();
    messageLog.clear();
    registeredGlobalLog = false;
    dispose();
    }

    /**
    * Send the contents of the message log to a pastebin.
    */
    private void pastebinLog() {
    String text = messageLog.getPastableText();
    // Not really bytes!
    messageLog.log(tr("console.pasteUploading", text.length()), messageLog.asHighlighted());

    PastebinPoster.paste(text, new PastebinPoster.PasteCallback() {
    @Override
    public void handleSuccess(String url) {
    messageLog.log(tr("console.pasteUploaded", url), messageLog.asHighlighted());
    SwingHelper.openURL(url, messageLog);
    }

    @Override
    public void handleError(String err) {
    messageLog.log(tr("console.pasteFailed", err), messageLog.asError());
    }
    });
    }

    public static void showMessages() {
    ConsoleFrame frame = globalFrame;
    if (frame == null) {
    frame = new ConsoleFrame(10000, false);
    globalFrame = frame;
    frame.setTitle(SharedLocale.tr("console.launcherConsoleTitle"));
    frame.registerLoggerHandler();
    frame.setVisible(true);
    } else {
    frame.setVisible(true);
    frame.registerLoggerHandler();
    frame.requestFocus();
    }
    }

    public static void hideMessages() {
    ConsoleFrame frame = globalFrame;
    if (frame != null) {
    frame.setVisible(false);
    }
    }

    }


    Window










    share|improve this question



























      0












      0








      0








      I am trying to figure out how to modify some existing code so that the console window that launches, starts out minimized as a tray icon instead of the default behavior which is to just open the window. Unfortunately I do not know Java, so I am having to just search Google and guess and check based on what code does make sense to me. I know this is asking a lot. I am trying my best to slowly pickup Java and I really appreciate the help. Could someone please read over this file and tell me if there is an obvious Boolean flip I need to make to change this behavior, or swap out some event handler. The code already has the provision to switch back and forth between tray icon and full window and I have made some progress by reading up on window listeners, specifically windowIconified, but I just don't have enough experience yet to really understand the changes I am making as they are not immediately obvious. The file below is one of many in this project, so if after reading you feel I am mistaken and the applicable code is missing, I can provide it. If I am properly understanding the code though, this is the file that builds out the console window, so I would assume the changes need to be made here. Thank you for any help!



      package com.skcraft.launcher.dialog;

      import com.skcraft.launcher.Launcher;
      import com.skcraft.launcher.swing.LinedBoxPanel;
      import com.skcraft.launcher.swing.MessageLog;
      import com.skcraft.launcher.swing.SwingHelper;
      import com.skcraft.launcher.util.PastebinPoster;
      import com.skcraft.launcher.util.SharedLocale;
      import lombok.Getter;
      import lombok.NonNull;

      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;

      import static com.skcraft.launcher.util.SharedLocale.tr;

      /**
      * A frame capable of showing messages.
      */
      public class ConsoleFrame extends JFrame {

      private static ConsoleFrame globalFrame;

      @Getter private final Image trayRunningIcon;
      @Getter private final Image trayClosedIcon;

      @Getter private final MessageLog messageLog;
      @Getter private LinedBoxPanel buttonsPanel;

      private boolean registeredGlobalLog = false;

      /**
      * Construct the frame.
      *
      * @param numLines number of lines to show at a time
      * @param colorEnabled true to enable a colored console
      */
      public ConsoleFrame(int numLines, boolean colorEnabled) {
      this(SharedLocale.tr("console.title"), numLines, colorEnabled);
      }

      /**
      * Construct the frame.
      *
      * @param title the title of the window
      * @param numLines number of lines to show at a time
      * @param colorEnabled true to enable a colored console
      */
      public ConsoleFrame(@NonNull String title, int numLines, boolean colorEnabled) {
      messageLog = new MessageLog(numLines, colorEnabled);
      trayRunningIcon = SwingHelper.createImage(Launcher.class, "tray_ok.png");
      trayClosedIcon = SwingHelper.createImage(Launcher.class, "tray_closed.png");

      setTitle(title);
      setIconImage(trayRunningIcon);

      setSize(new Dimension(650, 400));
      initComponents();

      setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
      addWindowListener(new WindowAdapter() {
      @Override
      public void windowClosing(WindowEvent event) {
      performClose();
      }
      });
      }

      /**
      * Add components to the frame.
      */
      private void initComponents() {
      JButton pastebinButton = new JButton(SharedLocale.tr("console.uploadLog"));
      JButton clearLogButton = new JButton(SharedLocale.tr("console.clearLog"));
      buttonsPanel = new LinedBoxPanel(true);

      buttonsPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
      buttonsPanel.addElement(pastebinButton);
      buttonsPanel.addElement(clearLogButton);

      add(buttonsPanel, BorderLayout.NORTH);
      add(messageLog, BorderLayout.CENTER);
      clearLogButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
      messageLog.clear();
      }
      });

      pastebinButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
      pastebinLog();
      }
      });

      hideMessages();
      }

      /**
      * Register the global logger if it hasn't been registered.
      */
      private void registerLoggerHandler() {
      if (!registeredGlobalLog) {
      getMessageLog().registerLoggerHandler();
      registeredGlobalLog = true;
      }
      }

      /**
      * Attempt to perform window close.
      */
      protected void performClose() {
      messageLog.detachGlobalHandler();
      messageLog.clear();
      registeredGlobalLog = false;
      dispose();
      }

      /**
      * Send the contents of the message log to a pastebin.
      */
      private void pastebinLog() {
      String text = messageLog.getPastableText();
      // Not really bytes!
      messageLog.log(tr("console.pasteUploading", text.length()), messageLog.asHighlighted());

      PastebinPoster.paste(text, new PastebinPoster.PasteCallback() {
      @Override
      public void handleSuccess(String url) {
      messageLog.log(tr("console.pasteUploaded", url), messageLog.asHighlighted());
      SwingHelper.openURL(url, messageLog);
      }

      @Override
      public void handleError(String err) {
      messageLog.log(tr("console.pasteFailed", err), messageLog.asError());
      }
      });
      }

      public static void showMessages() {
      ConsoleFrame frame = globalFrame;
      if (frame == null) {
      frame = new ConsoleFrame(10000, false);
      globalFrame = frame;
      frame.setTitle(SharedLocale.tr("console.launcherConsoleTitle"));
      frame.registerLoggerHandler();
      frame.setVisible(true);
      } else {
      frame.setVisible(true);
      frame.registerLoggerHandler();
      frame.requestFocus();
      }
      }

      public static void hideMessages() {
      ConsoleFrame frame = globalFrame;
      if (frame != null) {
      frame.setVisible(false);
      }
      }

      }


      Window










      share|improve this question
















      I am trying to figure out how to modify some existing code so that the console window that launches, starts out minimized as a tray icon instead of the default behavior which is to just open the window. Unfortunately I do not know Java, so I am having to just search Google and guess and check based on what code does make sense to me. I know this is asking a lot. I am trying my best to slowly pickup Java and I really appreciate the help. Could someone please read over this file and tell me if there is an obvious Boolean flip I need to make to change this behavior, or swap out some event handler. The code already has the provision to switch back and forth between tray icon and full window and I have made some progress by reading up on window listeners, specifically windowIconified, but I just don't have enough experience yet to really understand the changes I am making as they are not immediately obvious. The file below is one of many in this project, so if after reading you feel I am mistaken and the applicable code is missing, I can provide it. If I am properly understanding the code though, this is the file that builds out the console window, so I would assume the changes need to be made here. Thank you for any help!



      package com.skcraft.launcher.dialog;

      import com.skcraft.launcher.Launcher;
      import com.skcraft.launcher.swing.LinedBoxPanel;
      import com.skcraft.launcher.swing.MessageLog;
      import com.skcraft.launcher.swing.SwingHelper;
      import com.skcraft.launcher.util.PastebinPoster;
      import com.skcraft.launcher.util.SharedLocale;
      import lombok.Getter;
      import lombok.NonNull;

      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;

      import static com.skcraft.launcher.util.SharedLocale.tr;

      /**
      * A frame capable of showing messages.
      */
      public class ConsoleFrame extends JFrame {

      private static ConsoleFrame globalFrame;

      @Getter private final Image trayRunningIcon;
      @Getter private final Image trayClosedIcon;

      @Getter private final MessageLog messageLog;
      @Getter private LinedBoxPanel buttonsPanel;

      private boolean registeredGlobalLog = false;

      /**
      * Construct the frame.
      *
      * @param numLines number of lines to show at a time
      * @param colorEnabled true to enable a colored console
      */
      public ConsoleFrame(int numLines, boolean colorEnabled) {
      this(SharedLocale.tr("console.title"), numLines, colorEnabled);
      }

      /**
      * Construct the frame.
      *
      * @param title the title of the window
      * @param numLines number of lines to show at a time
      * @param colorEnabled true to enable a colored console
      */
      public ConsoleFrame(@NonNull String title, int numLines, boolean colorEnabled) {
      messageLog = new MessageLog(numLines, colorEnabled);
      trayRunningIcon = SwingHelper.createImage(Launcher.class, "tray_ok.png");
      trayClosedIcon = SwingHelper.createImage(Launcher.class, "tray_closed.png");

      setTitle(title);
      setIconImage(trayRunningIcon);

      setSize(new Dimension(650, 400));
      initComponents();

      setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
      addWindowListener(new WindowAdapter() {
      @Override
      public void windowClosing(WindowEvent event) {
      performClose();
      }
      });
      }

      /**
      * Add components to the frame.
      */
      private void initComponents() {
      JButton pastebinButton = new JButton(SharedLocale.tr("console.uploadLog"));
      JButton clearLogButton = new JButton(SharedLocale.tr("console.clearLog"));
      buttonsPanel = new LinedBoxPanel(true);

      buttonsPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
      buttonsPanel.addElement(pastebinButton);
      buttonsPanel.addElement(clearLogButton);

      add(buttonsPanel, BorderLayout.NORTH);
      add(messageLog, BorderLayout.CENTER);
      clearLogButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
      messageLog.clear();
      }
      });

      pastebinButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
      pastebinLog();
      }
      });

      hideMessages();
      }

      /**
      * Register the global logger if it hasn't been registered.
      */
      private void registerLoggerHandler() {
      if (!registeredGlobalLog) {
      getMessageLog().registerLoggerHandler();
      registeredGlobalLog = true;
      }
      }

      /**
      * Attempt to perform window close.
      */
      protected void performClose() {
      messageLog.detachGlobalHandler();
      messageLog.clear();
      registeredGlobalLog = false;
      dispose();
      }

      /**
      * Send the contents of the message log to a pastebin.
      */
      private void pastebinLog() {
      String text = messageLog.getPastableText();
      // Not really bytes!
      messageLog.log(tr("console.pasteUploading", text.length()), messageLog.asHighlighted());

      PastebinPoster.paste(text, new PastebinPoster.PasteCallback() {
      @Override
      public void handleSuccess(String url) {
      messageLog.log(tr("console.pasteUploaded", url), messageLog.asHighlighted());
      SwingHelper.openURL(url, messageLog);
      }

      @Override
      public void handleError(String err) {
      messageLog.log(tr("console.pasteFailed", err), messageLog.asError());
      }
      });
      }

      public static void showMessages() {
      ConsoleFrame frame = globalFrame;
      if (frame == null) {
      frame = new ConsoleFrame(10000, false);
      globalFrame = frame;
      frame.setTitle(SharedLocale.tr("console.launcherConsoleTitle"));
      frame.registerLoggerHandler();
      frame.setVisible(true);
      } else {
      frame.setVisible(true);
      frame.registerLoggerHandler();
      frame.requestFocus();
      }
      }

      public static void hideMessages() {
      ConsoleFrame frame = globalFrame;
      if (frame != null) {
      frame.setVisible(false);
      }
      }

      }


      Window







      java swing windowlistener






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 4:38









      camickr

      277k16130242




      277k16130242










      asked Nov 23 '18 at 4:33









      AtomiklanAtomiklan

      1,24642642




      1,24642642
























          1 Answer
          1






          active

          oldest

          votes


















          1















          starts out minimized as a tray icon




          You need to use:



          setExtendedState(JFrame.ICONIFIED);


          when you set the other frame properties.






          share|improve this answer
























          • Wonderful! Can you show me a specific example as I am not sure where to make that change? I'll start reading up on that now though.

            – Atomiklan
            Nov 23 '18 at 4:40











          • Going to guess this is under public ConsoleFrame() since this is where the other properties are defined.

            – Atomiklan
            Nov 23 '18 at 4:41











          • Wow, super fast working answer! Thank you!

            – Atomiklan
            Nov 23 '18 at 4:43











          • Only thing I am noticing is, the window is not closing itself out when the main program shuts down. This is a separate question obviously, but the window and or tray icon does not close upon main program closing.

            – Atomiklan
            Nov 23 '18 at 4:44












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440690%2fjava-frame-iconified-issue%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1















          starts out minimized as a tray icon




          You need to use:



          setExtendedState(JFrame.ICONIFIED);


          when you set the other frame properties.






          share|improve this answer
























          • Wonderful! Can you show me a specific example as I am not sure where to make that change? I'll start reading up on that now though.

            – Atomiklan
            Nov 23 '18 at 4:40











          • Going to guess this is under public ConsoleFrame() since this is where the other properties are defined.

            – Atomiklan
            Nov 23 '18 at 4:41











          • Wow, super fast working answer! Thank you!

            – Atomiklan
            Nov 23 '18 at 4:43











          • Only thing I am noticing is, the window is not closing itself out when the main program shuts down. This is a separate question obviously, but the window and or tray icon does not close upon main program closing.

            – Atomiklan
            Nov 23 '18 at 4:44
















          1















          starts out minimized as a tray icon




          You need to use:



          setExtendedState(JFrame.ICONIFIED);


          when you set the other frame properties.






          share|improve this answer
























          • Wonderful! Can you show me a specific example as I am not sure where to make that change? I'll start reading up on that now though.

            – Atomiklan
            Nov 23 '18 at 4:40











          • Going to guess this is under public ConsoleFrame() since this is where the other properties are defined.

            – Atomiklan
            Nov 23 '18 at 4:41











          • Wow, super fast working answer! Thank you!

            – Atomiklan
            Nov 23 '18 at 4:43











          • Only thing I am noticing is, the window is not closing itself out when the main program shuts down. This is a separate question obviously, but the window and or tray icon does not close upon main program closing.

            – Atomiklan
            Nov 23 '18 at 4:44














          1












          1








          1








          starts out minimized as a tray icon




          You need to use:



          setExtendedState(JFrame.ICONIFIED);


          when you set the other frame properties.






          share|improve this answer














          starts out minimized as a tray icon




          You need to use:



          setExtendedState(JFrame.ICONIFIED);


          when you set the other frame properties.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 4:38









          camickrcamickr

          277k16130242




          277k16130242













          • Wonderful! Can you show me a specific example as I am not sure where to make that change? I'll start reading up on that now though.

            – Atomiklan
            Nov 23 '18 at 4:40











          • Going to guess this is under public ConsoleFrame() since this is where the other properties are defined.

            – Atomiklan
            Nov 23 '18 at 4:41











          • Wow, super fast working answer! Thank you!

            – Atomiklan
            Nov 23 '18 at 4:43











          • Only thing I am noticing is, the window is not closing itself out when the main program shuts down. This is a separate question obviously, but the window and or tray icon does not close upon main program closing.

            – Atomiklan
            Nov 23 '18 at 4:44



















          • Wonderful! Can you show me a specific example as I am not sure where to make that change? I'll start reading up on that now though.

            – Atomiklan
            Nov 23 '18 at 4:40











          • Going to guess this is under public ConsoleFrame() since this is where the other properties are defined.

            – Atomiklan
            Nov 23 '18 at 4:41











          • Wow, super fast working answer! Thank you!

            – Atomiklan
            Nov 23 '18 at 4:43











          • Only thing I am noticing is, the window is not closing itself out when the main program shuts down. This is a separate question obviously, but the window and or tray icon does not close upon main program closing.

            – Atomiklan
            Nov 23 '18 at 4:44

















          Wonderful! Can you show me a specific example as I am not sure where to make that change? I'll start reading up on that now though.

          – Atomiklan
          Nov 23 '18 at 4:40





          Wonderful! Can you show me a specific example as I am not sure where to make that change? I'll start reading up on that now though.

          – Atomiklan
          Nov 23 '18 at 4:40













          Going to guess this is under public ConsoleFrame() since this is where the other properties are defined.

          – Atomiklan
          Nov 23 '18 at 4:41





          Going to guess this is under public ConsoleFrame() since this is where the other properties are defined.

          – Atomiklan
          Nov 23 '18 at 4:41













          Wow, super fast working answer! Thank you!

          – Atomiklan
          Nov 23 '18 at 4:43





          Wow, super fast working answer! Thank you!

          – Atomiklan
          Nov 23 '18 at 4:43













          Only thing I am noticing is, the window is not closing itself out when the main program shuts down. This is a separate question obviously, but the window and or tray icon does not close upon main program closing.

          – Atomiklan
          Nov 23 '18 at 4:44





          Only thing I am noticing is, the window is not closing itself out when the main program shuts down. This is a separate question obviously, but the window and or tray icon does not close upon main program closing.

          – Atomiklan
          Nov 23 '18 at 4:44




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53440690%2fjava-frame-iconified-issue%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents