What type of Java / Swing Layout can dock and / or bind?

I am new to Java coming from .Net. In Java, there seem to be a lot of layout managers to choose from. Which one can be bound, as in .Net, and which can be docked, as in .Net?

Thanks!

+3
source share
5 answers

I have not used .Net, but if I understand you correctly, the Docking layout manager is provided by BorderLayout.

A BorderLayout has 4 borders (north, south, east, west) and a center panel. A JToolBar that is set to Floatable can float or can be docked to one of the four borders of the border layout.

From what I just read about the layout of the anchor, and how it changes when the screen size changes (i.e., the percentage of space allocated to the component), the Swing equivalent is GridBagLayout . It is extremely customizable and capable, but many people have difficulty coping.

+3
source

JToolBar is one such component as shown in How to do it Use toolbars .

+2
source

You can find a well-described layout manager here. A visual guide for layout managers and choose the one that best suits your needs (I donโ€™t know. I donโ€™t know how the anchor / dock works in .Net). I find the GroupLayout group pretty useful along with the preferred component size and SpringLayout if you need to develop a complex layout (but SpringLayout is usually verbose and a little annoying to maintain).

+1
source

The most similar environment for winforms in Java is GroupLayout (aka Matisse). He works the same way as winforms designer in visual studio. It is not intended for manual encoding, but is intended for use by tools. The most popular IDE using GroupLayout is Netbeans, but there are other implementations for Eclipse and possibly IntelliJ.

0
source

FreeLayout used by Matisse graphic designer in NetBeans IDE: this is what you are looking for.

(You donโ€™t want to code FreeLayout manually: this is a layout designed for WYSIWYG visual designers to create code like Matisse.)

0
source

Source: https://habr.com/ru/post/888327/


All Articles