Basic frame of a flying game: fixed form position, cannot change form size arbitrarily

Source: Internet
Author: User
Package fifth day; import Java.awt.toolkit;import Javax.swing.jframe;public class MainFrame extends JFrame {public MainFrame () {This.settitle ("airplane frame");//title This.setsize (800, 600);//The form size//The following two lines of comment can also be used to control where the form is displayed//toolkit TL = Toolkit.getdefaulttoolkit ();//this.setlocation ((Tl.getscreensize (). width-800)/2, (Tl.getscreensize (). height-600 )/2); This.setlocationrelativeto (null);//center, equivalent to the two lines of code above commented this.setresizable (false);//Make it unable to change the size of the form//the following line of code in parentheses can also be written in 3 , because when you hold down CTRL and click Exit_on_close, you will see//to Jframe.class inside the definition is public    static final int exit_on_close = 3; This.setdefaultcloseoperation (jframe.exit_on_close);//make its true close form this.setvisible (TRUE);//Show Form//this.show (); This is out of date. }public static void Main (string[] args) {new MainFrame (), because it is unsafe, cannot be used again;/}}

Basic frame of a flying game: fixed form position, cannot change form size arbitrarily

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.