My program has the piece of code which pop-up the window dialogue box notifying the user about the ongoing process for this I'm using JOptionPane.showOptionDialog()
But when I'm starting the program as a service instead of running a jar file, I'm not able to see the pop-up window
I'm using nssm to create the service from jar/bat file
The following code is responsible to show the pop-up window
private void showWindow(String msg) {
JTextArea textArea = new JTextArea(msg);
textArea.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 18));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setOpaque(false);
textArea.setEditable(false);
textArea.setSize(new Dimension(400, 10));
JOptionPane.showOptionDialog(null, textArea,
"Application",
JOptionPane.DEFAULT_OPTION,
JOptionPane.INFORMATION_MESSAGE,
null, null, null);
}
I want to understand, Does service allow the program to show a window like this on a foreground?