![]() The default layout manager of the container is BoxLayout. Stay java.Swing In the package, a new container Box is provided. *1.BoxLayout based on creating vertical arrangement*/īoxLayout boxLayout = new BoxLayout(frame,BoxLayout.Y_AXIS) Axis has boxlayoutx_ Axis and BoxLayout_ Axis (longitudinal) two directions Code demonstration import įrame frame = new Frame("Test here BoxLayout") To simplify development, Swing introduces a new layout manager, BoxLayout can place GUI components vertically and horizontally Construction methodīoxLayout(Container target,int axis) specifies to create a Box Layout manager based on target container, in which the components are arranged in axis direction. String actionCommand = e.getActionCommand() įtLayout(new BorderLayout(20,20)) *2.Add multiple buttons to the container*/ The unit is pixel, and the default is 5 pixels Code demonstration import įrame frame = new Frame("Test here FlowLayout") įtLayout(new FlowLayout(FlowLayout.LEFT,20,20)) ![]() The middle distance of components in FlowLayout is set by integer. This parameter should use the static constant of flowlayout: FlowLayout.LEFT, FlowLayout.RIGHT, FlowLayout.CENTER, align left by default The arrangement direction of components in flowlayout (from left to right, from right to left, from middle to both sides).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |