GUI setup form/close form

Source: Internet
Author: User

GUI: Graphical user interface, under AWT and swing package

The difference between AWT and swing

java.awt: the need to invoke the Local System method implementation function, the weight of the control is the degree of association with the system

Javax.swing: On the basis of Java, provides more components, fully implemented by Java, portability, is a lightweight control

Frame: Form Object

Method:

1. Frame: Non-parametric construction

2. Frame.setsize (): Set the form size

3. Frame.setlocation (): Set the form position

4. Frame.setbounds (x,y,width,higth): Combine 2 and 3 with this

5. Frame.setvisible (Boolean): Make the form visible

Closed words in code embodied

Code

Package Cn.idcast;import Java.awt.frame;import Java.awt.event.windowadapter;import java.awt.event.WindowEvent; public class Guidemo {public static void main (string[] args) {frame f = new Frame (); F.setbounds (400, 100, 250, 250);
Close Form F.addwindowlistener (new Windowadapter () {///Windowadapter: Adapter windowlistener listening mechanism @overridepublic void Windowclosing (WindowEvent e) {//TODO auto-generated method stubsystem.exit (0);}}); F.setvisible (True);}}

  

GUI setup form/close form

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.