How to remove the border of a JFrame

Assuming that you ‘re developing an application, in which the default look-and-feel doesn’t match, at all.

To be more specific, imagine the following example: I sometime wanted to develop a real-time clock JAVA application. It would be a bit ugly for the application’s purpose to have the annoying border around its JFrame.

Indeed, there is a way to implement this: you just need to set the frame’s undecorated method to true:   frame.setUndecorated(true);

Keep in mind that the above code has to be placed before frame’s setVisible() method. Otherwise, it’s like initializing the frame and then telling it to be undecorated, sth that doesn’t make sense. So, you first customise the frame as you wish (undecorization, etc) and then you enable its visibility.


The full application that supports this post is related here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s