centerscreen - How to have a Center Screen Window in Java - Free Source Code

How to have a Center Screen Window in Java – Free Source Code

Posted on

centerscreen - How to have a Center Screen Window in Java - Free Source Code

Among the applications in java is about to its consumer location utilizing the setLocation methodology of the JFrame or JWindow as a result of they discover it laborious to middle their window display screen. So right here on this tutorial, we’ll create a program that has a middle display screen window in Java.

Now let’s begin this tutorial!

1. Open JCreator or NetBeans and make a java program with a file identify of centerScreen.java.

2. Import the next bundle library:

3. We’ll initialize variables in our Fundamental, variable body as JFrame, package as ToolKit, and wndSize as Dimension.

4. Now, we’ll set the place to display screen middle & dimension to half display screen dimension. We’ll use the setBounds methodology right here of the body after which get in on the Dimension class variable declared above.

Lastly, shut the Operation.


Here is the complete code of this tutorial:

For extra inquiries and wish programmer in your thesis methods in any sort of programming languages, simply contact my quantity under.

Greatest Regards,

Engr. Lyndon R. Bermoy
IT Teacher/System Developer/Android Developer
Cell: 09079373999
Phone: 826-9296
E-mail:[email protected]

Go to my web site at: www.campcodes.com