201671010116.2016-2017-14 "Java Programming" 14th Week study Summary

Source: Internet
Author: User

This week we learned about event handling technology, and Java events are nothing more than keyboard events, mouse events, buttons, and so on.

1. Mouse Event: Click the mouse button thing it will call three listener methods: mousepressed,mousereleased,mouseclicked.

2. Keyboard Events: If we want to use the keyboard to get input information, we must handle keyboard events. We can use it in Conponent's keydown to achieve

3. Ammonium button and other events: This aspect is more content. The user can choose different menu, interface effect and so on by the button.

The event adapter classes defined in the Java.awt.event package include the following, as shown in the check data:
1>. Componentadapter (Component adapter)
2>. Containeradapter (Container adapter)
3>. Focusadapter (Focus adapter)
4>. Keyadapter (keyboard adapter)
5>. Mouseadapter (Mouse adapter)
6>. Mousemotionadapter (Mouse motion adapter)
7>. Windowadapter (Window adapter)

This week we also taught ourselves the swing user interface components. Java uses a very good concept for dynamic layouts: all components within a container are positioned by a layout manager. The only learning is:

The button is placed in a JPanel object and managed with the Flow Layout manager (the default layout manager), the component is placed in the container, and the layout manager determines the location and size of the component in the container;

Text fields and text area components are used to get text input, but there is a difference, that is, the Text field (JTextField) can only be entered in a single line of text, and the text area (JTextArea) can be entered in multiple lines of text. A password field is a special type of text field. Jpassword can only be entered in single-line text, but will not display content. In addition, there are many points of knowledge not listed here.

The user interface has a lot of knowledge, and by reading the program you just know a part of the code. There is no good part, read a lot of code do not understand. In the learning process of the Color dialog box is interested in, feel the code is magical.

201671010116.2016-2017-14 "Java Programming" 14th Week study Summary

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.