我有一个#include <stdio.h>
#define HEIGHT 7
#define WIDTH 7
char zero[HEIGHT][WIDTH] = {
".......",
".00000.",
".0...0.",
".0...0.",
".0...0.",
".00000.",
"......."
};
char one[HEIGHT][WIDTH] = {
"...1...",
"..11...",
".1.1...",
"...1...",
"...1...",
"...1...",
".11111."
};
int main(void){
char ch, input[3];
if(1==scanf("%2[01]", input)){
for(int i = 0; i < HEIGHT; ++i){
for(int j = 0; ch = input[j]; ++j){
if(j)
putchar(' ');//separator
switch(ch){
case '0':
printf("%.*s", WIDTH, zero[i]);
break;
case '1':
printf("%.*s", WIDTH, one[i]);
break;
}
}
puts("");
}
}
return 0;
}
,我动态设置边框宽度为3(没有CSS或FXML)。
然后我尝试使用
获取其边框宽度VBox
但它不起作用!请有人帮帮我吗?
答案 0 :(得分:1)
如果您以编程方式设置边框,请执行以下操作:
VBox vbox = new VBox();
BorderStroke borderStroke = new BorderStroke(Color.RED, BorderStrokeStyle.DASHED,
null, new BorderWidths(5));
// Sets all 4 borders
vbox.setBorder(new Border(borderStroke));
然后你可以得到像:
这样的宽度double left = vbox.getBorder().getStrokes().get(0).getWidths().getLeft();
System.out.println("Left border width " + left);
输出
Left border width 5.0