Java graphical programming-steps for generating a window

Source: Internet
Author: User

Jframe myframe = new jframe (); // generate a window
Myframe. settitle ("test"); // If the construction parameter called during jframe instantiation is jframe (string), this step can be omitted.
Myframe. setdefaclocloseoperation (jframe. exit_on_close); // set to close the window by default. If not set, closing the window actually hides the window. I haven't figured it out yet: windowsconstants. exit_on_close and jframe. the exit_on_close values are all three of the int type. What is the difference in the specific meaning?
Myframe. setlayout (New gridlayout (3, 3); // you can specify a three-row and three-column grid layout.
Myframe. add (childcomponet); // Add sub-elements such as jlabel and jbutton. this is from Java. AWT. the method integrated by the container. The parameter must be Java. AWT. component instance.
Myframe. setvisible (true); // you can only view the javaw.exe process in the Windows Task Manager.
Myframe. setsize (100,200); // set the width and height in pixels or use myframe. Pack (); to automatically adjust the size of the window to adapt to the internal elements of the window.

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.