问题标签 [gridbaglayout]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - GridBagLayout 中的 JScrollPanes 随机调整大小
这对你们来说是一个艰难的过程:)
基本上我有一个 GridBagLayout 有 2 列:一个列表包裹在每个滚动窗格中。滚动窗格在两个方向上拉伸。
如果我逐渐降低此面板的高度(通过拖动窗口的边缘),我会看到滚动窗格上发生“随机”调整大小:
当第一个的 Hscroll 条出现时,第二个的宽度会减小
然后,第二个的宽度又无缘无故地缩小了……
如果我不包装我的组件,请不要出现这种行为。
如果你用树
替换右手列表,它的行为会有所不同:将窗口的高度缩小到 380-ich 像素以下,树的大小会被调整......
如果我不包装我的组件,那么如果您继续调整窗口大小,树就会重新调整大小!
你们知道发生了什么吗???
PS:我试图构建的实际布局比这个例子更复杂。与此同时,我使用 SpringLayout 来做我想做的事,但它需要很多(不是那么漂亮)的东西来设置
java - 将 jframe 设置为 gridbaglayout 时,jpanel 无法很好地显示
下面的程序是用 gridbaglayout 将 jpanel 定位在 jframe 的左上角,但在 jframe 的中心显示一个非常小的框。当我将 jframe 的布局设置为 null 时,jpanel 显示正常。有人能告诉我为什么 jpanel 用 gridbaglayout 压缩到框架的中心吗?我真的需要使用gridbag。请帮忙
java - JScrollPane with JList does not scroll in GridBagLayout
I have a couple of Jlist within jscrollpanes in a gridbaglayout. The amount of entries in 1 Jlist is more than fits in the visible area of the Jlist. But the jscrollpane does not provide scrolling functionality.
I used to have the all of the jscrollpanes enclosed in a jpanel, at that time scrollpane provided the correct scrolling functionality.
I have the preferredsize of the Jlist set to [0,0]. The layout of the Jlist is correct. I can set the preferredsize of the JList to an explicit value of for example [80,300]. This causes JList to be scrollable partially. The real size of the JLIst, if it would be visible completely, is much longer.
Somehow I guess the gridbaglayout is resizing my Jlist in a way that the Jlist is not able to provide the correct size it has to the scrollpane.
How do I make the gridbaglayout and Jlist within jscrollpanes work together?
java - GridBagLayout 中的对齐(小程序)
我对 GridBagLayout 有疑问。我的组件不想看起来像我想要的那样;)我想做这样的布局:
我写了一段代码:
结果看起来像这样,“几乎”很好;]
你知道吗,如何定制它?
提前致谢, 马尔辛
// 编辑
嘿,我用 MigLayout 解决了一个问题(感谢 mKorbel)。代码如下所示(要删除跟踪行,请从构造函数中删除调试):
(ps如果你不想设定上限(10000),你可以写hmin x,hmax y ...我不需要它;))
java - 如何使用网格包布局将三个标签添加到框架?
尝试使用 GridBagLayout。
我有一个名为 buildLabel 的方法。这将创建三个标签。另一种方法称为 addComponentsToFrame。这将构建框架并创建一个面板。它还将三个标签添加到面板中。现在我想展示我所做的。如何显示框架。这是我的代码!
java - GridBagLayout 不显示 JTextArea,并在中心显示面板
在下面的代码中,当我将 JTextArea 添加到主面板时,它没有显示出来。当我添加控制面板时,它显示在中心,而不是边缘。我是 GridBagLayout 的新手,所以我假设我缺少一些简单的东西。
编辑:这就是约束如何照顾您的建议。textArea 仍然没有出现。
java - 如何在 GridBagLayout 单元格内左对齐或右对齐?
我看到它GridBagLayout
的位置是在单元格内居中对齐的孩子。如何左对齐或右对齐?
更新
构建代码(我知道我可以重用c
)
java - 如何在 Java 中锁定 gridLayout 的纵横比?
是否有一种简单的方法可以在 Java Swing 中锁定 GridLayout 组件的纵横比?还是应该在包含该布局的 JPanel 上完成?
java - GridBagLayout 中的组件布局不如预期
在此我添加了一些标签、单选按钮、文本字段。单选按钮和标签正在按我想要的方式显示,但文本字段没有正确显示。谁能告诉我如何让文本字段覆盖更多空间?