我有一个垂直框,我称之为父母。我添加一个JLable,然后添加一个JTextArea。Next接下来,我将创建两个分别称为right和left的垂直Box容器。Next我向它们添加2个JLable,并将这两个Box容器放入一个称为Bot的水平Box中。Bot被添加到我首先创建的父框中
这两个标签在中心彼此相邻绘制。第一个是左对齐的,第二个是右对齐的。
我希望他们两个都说对了,所以他们不会彼此相邻
Box boxParent = Box.createVerticalBox();
String indName="test";
String indDescription="Description";
Box boxTitle = Box.createHorizontalBox();
boxTitle.add(new JLabel(" Indicater:"));
boxTitle.add(new JLabel(in dName));
boxParent.add(boxTitle);
JTextArea description = new JTextArea(indDescription,5,2);
boxParent.add(description);
Box bot= Box.createHorizontalBox();
Box right = Box.createVerticalBox();
right.add(new JLabel("right"));
right.setAlignmentX(Component.LEFT_ALIGNMENT);
Box left = Box.createVerticalBox();
left.setAlignmentX(Component.LEFT_ALIGNMENT);
left.add(new JLabel("left"));
bot.add(right);
bot.add(left);
boxParent.add(bot);
HUH函数
相关分类