什么类型的 Java/Swing 布局可以进行停靠和/或锚定? [英] What type of Java / Swing Layout can do Docking and or Anchoring?

查看:34
本文介绍了什么类型的 Java/Swing 布局可以进行停靠和/或锚定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是来自 .Net 的 Java 新手.Java 似乎有很多布局管理器可供选择.哪一个可以像 .Net 一样锚定,哪一个像 .Net 一样可以停靠?

I'm new to Java coming from .Net . Java seems to have lots of Layout Managers to choose from. Which one can anchor like in .Net and which one can dock like in .Net?

谢谢!

推荐答案

我没有用过 .Net,但如果我理解正确的话,Docking 布局管理器是由 BorderLayout 提供的.

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

BorderLayout 有 4 个边界(北、南、东、西)和一个中心面板.已设置为 Floatable、可以浮动或可以停靠到边框布局的 4 个边框之一的 JToolBar.

A BorderLayout has 4 borders (North, South, East, West) and a Center panel. A JToolBar that has been set to Floatable, can float, or can be docked to one of the 4 borders of the border layout.

根据我刚刚读到的关于锚点布局的内容,以及它如何随着屏幕调整大小而调整大小(即分配给组件的空间百分比),那么 Swing 等效项是 GridBagLayout.它具有极强的可配置性和功能,但很多人发现很难掌握.

From what I have just read about the anchor layout, and how it resizes as the screen resizes (i.e. the percentage of space allocated to the component), then the Swing equivalent is the GridBagLayout. It is extremely configurable and capable, but many people find it difficult to get to grips with.

这篇关于什么类型的 Java/Swing 布局可以进行停靠和/或锚定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆