JFrame does not show top bar after it is exported as application

Hi, my program displays an interface inside a JFrame and this JFrame has a top bar as what an usual JFrame has. When I used Processing 3, this top bar can be seen either when i run the program inside Processing or export it as application. Now I use Processing 4. I find that this top bar can only be seen when i run it inside Processing but when i export and run it as application the interface is displayed full screen. Thus there is no top bar can be seen and then I lose the ‘close’ button and ‘minimize’ button and become inconvenience. This image shows the difference.

frame bar problem

I am sure I did not run any code like frame.setUndecorated(false/true) in my original program. Now, as i lose the top bar, when i add the above code frame.setUndecorated(false) i got the error ‘IllegalComponentStateException: The window is displayable.’

Right now what i can do is to add the following three codes at the moment when the launching page just finishes and before the interface starts executing
frame.dispose();
frame.setUndecorated(false);
frame.setVisible(true);
Yes, the top bar can be shown again in this way but i suppose this is not a very good approach. There is a short moment that the interface will disappear.

My question is why the top bar shows inconsistent behavior and only disappear when it is run as an exported application by Processing 4? How can i make sure that the top bar can be shown in the exported application?

Is your question answered by this previous thread: https://discourse.processing.org/t/android-please-tell-me-how-to-make-the-title-bar-visible-in-the-processing-app-help-me/40634 ?

Try running this code in Android mode:

void setup() {
  size(width,height);
  background(109);
}

void draw() {  
}

Change manifest.xml file to look like this:
manifest .NoActionBar.FullScreen was deleted from android:theme.

1 Like

i don’t think so. My program does not run on android but on Window as an application software, so i am looking for a solution suitable for Window.

1 Like

I did more tests and found that the above problem happened if I export my program by using my notebook (Samsung, Window 10) but it did not happen if I export it through desktop (Lenovo, Window 10). That Samsung notebook does not only trigger this odd problem. Another problem is that every time when I resize the frame in my interface the program stops running and freeze. Such problem does not exist in my desktop.
What is the reason behind these problems? Is it related with the version of Java in my notebook or else?