Java 12th Day Learning content Review--java White Paper 9th Chapter

Source: Internet
Author: User
Tags gettext

Swing User Interface components

  1. A pattern: Model----View-----Controller

  2. There are many types of patterns, such as: Model----View----Controller (the principle is to limit the number of functions that an object has); combination models-between containers and components; adorner mode----a panel with scroll bars; policy mode-----layout Manager

  3. Content---appearance----behavior----MVC

  4. The relationship between model and view 1:N model is independent of perception, so it is possible to reuse

  5. The model may be the same, but the view and controller may be different

  6. In metal perception, JButton inherits the wrapper class of JComponent, which contains Defaultbuttonmodel (model) objects and Basicbuttonui (view) objects.

  7. Flow Layout Manager: Components are prevented from being placed in the container, the Flow layout manager is fully secure, the container can also be placed in another container, the buttons and text fields are inherited from the component class, and the hierarchy of the component class is detailed with P328

  8. The Add method of the container can pass the component and placement method to the layout manager,. Seglayout (Prevent layout manager for containers)

  9. The layout manager for each of the Jfram's content panes, which allows you to select a drop location for each component. Add (component, in the cardinal); When scaled, the edge component size is unchanged, the size of the intermediate component changes first, and the default is: Medium.

  10. Flow layout Manager: Maintain optimal dimensions for each component----------Border layout Manager: Extend components to fill free space

    Detailed in P330

  11. Text fields can only accept single-line input------JTextField-----New JTextField ("content", limit number), the text area receives multiple lines------jtextarea, password input does not display the correct content--------Jpassword These three classes inherit from the JTextComponent abstract class, which has methods gettext,settext (manipulation of the text), iseditable,seteditable (for editable operations), and can be used by methods SetColumns () Reset the number of columns (the number of words), after using this method need to call the text box container Revalidate method (This method is JComponent class method) This method will recalculate the size and layout of each component within the container, However, if you want to recalculate the size of all components in the JFrame (frame), you should use the name validate method, because JFrame does not inherit from the JComponent class

  12. Using SetText (String), this method is defined in the JTextComponent class, corresponding to the GetText method

  13. GetText (). Trim () to get a string with no spaces

  14. The SetFont method will change the font of the reality in detail in p335

  15. JLabel is a swing class that implements the Jconstants interface with typographic parameter constants such as: Swingconstants.right or Jlabel.right right.

  16. JLabel instances can be built using names, icons, and typography

  17. The line break in the text area is just a visual effect, and the text in the document is not changed (add line breaks), and you can use the. Setlinewrap (True) method to prevent long rows from being cropped

  18. The text area is inserted into the scroll pane to implement the scroll bar, new Jscroolpane (text area component), after joining, the scroll pane is responsible for managing the view of the text area and can add scrolling functionality to any component

  19. The JTextArea component displays only unformatted text, which needs to be detailed with the JEditorPane class when displaying formatted text P338

This article is from the "Developing_rookie" blog, make sure to keep this source http://8942041.blog.51cto.com/8932041/1634794

Java 12th Day Learning content Review--java White Paper 9th Chapter

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.