Java swing component BoxLayout layout usage example

This article describes the Java swing component @ r as an example_ 516_ 2419@Layout Layout usage. Share with you for your reference, as follows:

@R_ 516_ 2419@Layout The controls can be arranged horizontally or vertically in turn through the parameter X_ AXIS、Y_ Axis. X_ Axis stands for horizontal arrangement and Y stands for horizontal arrangement_ Axis stands for vertical arrangement@ R_ 516_ 2419@Layout The constructor of has two parameters, and one parameter definition uses this @ R_ 516_ 2419@Layout Another parameter is to specify @ R_ 516_ 2419@Layout Whether to arrange horizontally or vertically. Here is an example using @ r_ 516_ 2419@Layout Examples of arranging controls:

In practical applications, we often need separators to add intervals directly to controls. They have the following types:

① Rigid area is a transparent component that users can define horizontal and vertical dimensions; ② Struts is similar to rigid area, but you can only define dimensions in one direction, i.e. horizontal or vertical. You cannot define horizontal and vertical dimensions at the same time; ③ When glue is between two controls, it will occupy the excess space between the two controls as much as possible, so as to squeeze the two controls to both sides; ④ Filler is @ r_ 516_ The inner class of 2419 @ is similar to the rigid area. It can specify horizontal or vertical dimensions, but it can set the minimum, maximum and priority dimensions.

Here is a test case:

@R_ 516_ 2419@LayoutDemo.java

Operation effect diagram:

More readers interested in Java related content can view the special topics of this site: Java data structure and algorithm tutorial, summary of Java character and string operation skills, summary of Java DOM node operation skills, summary of java file and directory operation skills, and summary of Java cache operation skills

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>