Java Note 5

Source: Internet
Author: User

  1. The scope of a variable defined by a Do-while loop statement body is constrained by the body of the statement.

    Do

    {

    Int J = Integer.parseint (Stdin.readline ());

    }while (J! = 6211954)//This is wrong, J can only be used in its defined statement body.

  2. File operations

    BufferedReader Filein = new BufferedReader (new FileReader (filename));

    String currentlinet = Filein.readline (); The first line.

    String nextline = Filein.readline (); The second line.

    Filein.close ();

  3. GI programming based on graphical user interface

    GUI Graphical user interface

    Containers and Components

  4. Typical GUI-based programming in Java is the use of the Swing Application Interface (API). Event-driven programming.

    JFrame represents a window with a name and border

    JTextArea represents a component that can be compiled to enter multiple lines of text

    JLabel represents the display area, which can display one or both lines of text and pictures

    JTextField represents a component that can be compiled to enter a single-line file

    JButton represents a button.

  5. There are at least three ways to use a typical GUI-based programming. One is the main method, main (), where it defines an instance of a GUI. Creating this instance is done by firing the construction method, which creates and initializes the GUI artifacts. The construction method also registers the event listener, which is used to listen to any program's specific responses to user interaction. The third method is an action performer method, which is used to handle events of interest.

  6. The GUI is a real object , and once constructed, the GUI has properties and behaviors. A property is an instance variable of a graphical component, and the behavior is the action taken by the GUI when the event occurs.

  7. class Constants , which are constants that all objects in this class share access to.


Java Note 5

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.