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

Source: Internet
Author: User

  1. AWT: Abstract window Toolbox, Awt+ifc==swing,swing is a component based on the AWT architecture, but processing events still use AWT

  2. The user interface class that swing uses to be drawn, JavaFX may replace it, and AWT is used for the underlying mechanism.

  3. The user can specify "look and feel", and metal is a "look and feel" specifically for Java

  4. In the Swing library, the JFrame class is used to describe the top-level form, which is one of the few swing components that does not need to be drawn on the canvas, so its "cosmetic part" is drawn by the user's window system, not swing.

  5. Open the code format for the Run Window section: Event.Queue.invokelater (a);----A = = new Runnable () {b}----B = = public void run () {c}----C is the container internal code description

  6. The. Setundecorated (True) method is used to close all frame decorations

  7. The. setvisible (True) method is used to display the control

  8. The. setlocation,. SetBounds method is used to set the position of the frame, and the coordinates used here are relative to the solid screen.

  9. The. Seticonimage method is used to set the form's icon

  10. The. Settitle method is used to set the title of the form

  11. The. Setresizable method is used to set whether the frame size allows changes.

  12. Object----Component----container-----windows-------Frame------jframe Inheritance Relationship

  13. . Setlocationbyplatform (True), there are some mismatches between the new form position and the recently displayed form

  14. The get, set method pair is called a property that contains the property name and type, the property name is Set/get, and the first letter is changed to lowercase to get the property name, GetTitle----title is the property name. Type with Get ... () is the same as the party drawing, with one exception: for properties of type Boolean, the method name that gets the property begins with the is ... Instead of get ...

  15. Determine the appropriate frame Size: Toolkit object, This object is built using the Toolkit.getdefaulttoolkit method, and the Toolkit class contains many ways to deal with the local windowing system, Toolkit object has a method: Getscrensize, returns a dimension object, This object has two public data fields, width,height, to place the local screen size.

  16. About the icon settings: Use new ImageIcon (picture file name). The GetImage () method loads the picture file into an Image object instance, using the Seticonimage (Image object instance) method to set the icon.

  17. Set frame to Maximum: JFrame class instance. Setextendedstate (frame.maximized_both); parameters can also have other options:. NORMAL,. Iconified,. Maximized_vert,. Maximized_horiz

  18. Applications that use multiple display screens, using the Graphicsenvironment and GraphicsDevice classes

  19. In the contents pane, the drawing component needs to define a jcomponent extension class, and in this class the Paintcomponent method is overwritten, notice that it is overwritten, the Paintcomponent method has a graphics type parameter, which is used to draw the pattern, Images and text.

  20. The Paincomponent method is not required for manual invocation, it will automatically invoke the

  21. The Repaint method is used to force the screen to refresh

  22. There is a drawstring method in the graphics class, where the. DrawString (string,x,y) specifically draws the string

  23. The Add (component) method exists in the container class, which uses this method to add components to the frame through the component name

  24. JAVA2D Library, the parametric graphics in paintcomponent, as long as this parameter is coerced into a graphics2d type and passed to this type of variable reference, to draw a graph, The first thing to do is to create an object that implements the shape interface's class (Graphics2D implements the Shape interface), and then uses the object's. Draw method to draw

  25. JAVA2D uses floating-point pixel coordinates, many calculations are float type, but should be the compiler default decimal double type, so you need to add a decimal constant after F, as a single-precision use, the need to force conversion to float type, so it is more troublesome, so each graphics class provides two versions, The parameters are float type (save space) and the parameter is double type (convenient). Detailed and P272

  26. The authors recommend that you use POINT2D as much as possible to represent points, rather than x, Y, which is easy to understand. Detailed and P272

  27. On the line, the ellipse is drawn in detail and P274

  28. Fill Color process: A. Select a color (g2.setpait (color))----B. Draw diagram (g2.drawstring) g2.fill (graphics) fill the graphic color,. Fill After the fill can be drawn without using. Draw, A and B processes can be repeatedly painted in multiple colors, detailed with P278

  29. For font depiction, detailed with P281, set font information through Font class object, new Font ("Font name", font size, font format)

  30. Font.derivefont (a), a if it is a float type, the equivalent of changing the font size, a if the int type changes font style.

  31. To draw an image, an object instance of the image class is used to store the picture, and then a g2.drawimage (Image object instance, X,y,null) is used to draw the picture to the specified area, using G2.copyarea (a,b,c,d,x,y) Use the first four parameters to lock the area that needs to be copied to the location where the last two parameters are locked.

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

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

Related Article

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.