相关疑难解决方法(0)

使用JSeperator时不寻常的差距 - Java

我一直在研究Swing GUI并在添加后得到一些不寻常和不需要的空白,不JSeperator知道如何删除它们?或任何其他选项如何很好地实现这一目标!

视觉描述

在此输入图像描述

JLabel"速度" 之前和之后,差距是显而易见的JSlider.

相关代码

control.setLayout(new BoxLayout(control, BoxLayout.X_AXIS));

...another code omitted...

control.add(orientation); //JLabel
control.add(norm); //JRadioButton
control.add(back); //JRadioButton
control.add(new JSeparator(SwingConstants.VERTICAL));
control.add(speedLabel); //JLabel
control.add(speed); //JSlider
control.add(new JSeparator(SwingConstants.VERTICAL));
control.add(turnOutLabel); //JLabel
control.add(right); //JRadioButton
control.add(straight); //JRadioButton
control.add(left); //JRadioButton
Run Code Online (Sandbox Code Playgroud)

我想要的是让所有东西都集中在JSeperator中,

视觉描述

在此输入图像描述

谢谢.

java user-interface swing awt layout-manager

6
推荐指数
1
解决办法
3117
查看次数

标签 统计

awt ×1

java ×1

layout-manager ×1

swing ×1

user-interface ×1