javafx分别设置四个边框
package border;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class BorderDemo extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        Text text = new Text("test");
        HBox root = new HBox();
        root.getChildren().add(text);
        root.setPadding(new Insets(50));
//        root.setStyle("-fx-border-color: red orange black green;-fx-border-width: 50 40 20 10;-fx-border-style: solid dashed dotted dotted;");
//        root.setStyle("-fx-border-width: 0 0 10 0;-fx-border-style: solid;-fx-border-color: red");
        BorderStroke borderStroke = new BorderStroke(null,null, Color.BLACK,null, null,null,BorderStrokeStyle.SOLID,null,null, BorderWidths.DEFAULT,new Insets(50));
        root.setBorder(new Border(borderStroke));
        Scene scene = new Scene(root, 500, 300);
        primaryStage.setScene(scene);
        primaryStage.show();
    }
    public static void main(String[] args) {
        launch(args);
    }
}
效果图

如果把style中的空格改为逗号,即root.setStyle("-fx-border-color: red,orange,black,green;...")
效果图

看下官方文档,如果四个边框分开设置,就是要用逗号,实际却是用空格隔开
-fx-border-color
A series of paint values or sets of four paint values, separated by commas. For each item in the series, if a single paint value is specified, then that paint is used as the border for all sides of the region; and if a set of four paints is specified, they are used for the top, right, bottom, and left borders of the region, in that order. If the border is not rectangular, only the first paint value in the set is used.
javafx分别设置四个边框的更多相关文章
- div四个边框分别设置阴影样式
		
对于div边框的阴影一直没有很好地理解,也一直不明白怎么给四个边框分别设置阴影.昨天项目中碰到了这个问题,就认真想了一下,在此总结一二. 首先,还是从官方解释说起. 网上的解释通常都是什么水平阴影长度 ...
 - box-shadow四个边框设置阴影样式
		
其实对于box-shadow,老白我也是一知半解,之前用的时候直接复制已有的,也没有仔细思考过box-shadow的数值分别对应什么,最后导致阴影的边如何自由控制,苦于懒人一个一直没有正式去学习,今天 ...
 - 从零开始学 Web 之 CSS3(四)边框图片,过渡
		
大家好,这里是「 从零开始学 Web 系列教程 」,并在下列地址同步更新...... github:https://github.com/Daotin/Web 微信公众号:Web前端之巅 博客园:ht ...
 - QT QProgressBar QProgressDialog 模态,位置设置,无边框,进度条样式
		
一 关于模态设置 QProgressDialog可以设置模态(需要在new的时候传入parent),QProgressBar设置不好: 只有dialog可以设置模态,widget不能设置模态(QPr ...
 - SB中设置UITextField 无边框,真机上输入汉字聚焦时,文字 下沉
		
解决方案:sb中一定要设置有边框,然后在代码里设置成无边框 然后正常了. 参考:https://segmentfault.com/q/1010000007244564/a-10200000073481 ...
 - winform设置button的边框颜色,或取消边框颜色,不显示边框
		
// winform设置边框颜色不像webform那么简单,可以通过设置FlatAppearance,也可以通过重绘实现. 一.设置按钮本身属性 buttonBubufx.FlatStyle = Fl ...
 - JavaFX窗体设置无边框
		
public void start(Stage stage) throws Exception { longStart(); Parent root = FXMLLoader.load(getClas ...
 - UIButton设置圆角和边框及边框颜色
		
1. 按钮边框颜色 //设置边框颜色 [btn.layer setMasksToBounds:YES]; [btn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径 ...
 - poi设置excel表格边框、字体等
		
POI中可能会用到一些需要设置EXCEL单元格格式的操作小结: 先获取工作薄对象: HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb ...
 
随机推荐
- ql的python学习之路-day7
			
函数与函数式编程 一.编程模式分为三种: 1.面向对象编程:类----->关键字class 2.面向过程编程:过程----->关键字def,没有return 3.函数式编程:函数----- ...
 - 整理今天js留下的作业(点击换图片换首页背景图)
			
<div class="buttons"> <button id="katong">卡通</button> <b ...
 - bash leetcode
			
拓展:grep 193. ref: https://blog.csdn.net/yanglingwell/article/details/82343407 Given a text file fil ...
 - RN概述
			
一.RN概述 中文网:http://reactnative.cn/ ReactNative:使用JS语法编写移动APP应用,RN会把JS转换为底层Java或OC, 最终运行于手机-------完全不依 ...
 - Jenkins-Sonar集成配置及注意点
			
首先说说关于Jenkins集成Sonar的相关配置:我jenkins与Sonar不在同一个服务器上! 先现在 SonarQube Scanner 插件. SonarQube Servers:系统配置 ...
 - IE8/IE9/IE10打开网页后,自动设置浏览器模式为“IE8/IE9/IE10兼容性视图”
			
http://blog.snsgou.com/post-16.html 作者:SNSGOU 发布于:2013-07-17 22:23:05 分类:CSS/HTML 评论(0) 浏览(132 ...
 - Null passed to a callee that requires a non-null argument
			
OC中定义的方法参数默认是不为空的,如果能够为空需要手动指定__nullable ,我想这个警告是提示开发者警惕可能空参数
 - 最优化之凸优化之Bregman算法
			
本文介绍了Bregman迭代算法,Linearized Bregman算法(及在求解Basis Pursuit问题中的应用)和Split Bregman算法(及在求解图像TV滤波问题中的应用). 由于 ...
 - Java——去除字符串中的中文
			
import java.util.regex.Matcher; import java.util.regex.Pattern; public class RemoveStrChinese { priv ...
 - mysql 的大文本存储TEXT & BLOB
			
TEXT & BLOB 一般在保存少量字符串的时候,我们会选择 CHAR 或者 VARCHAR:而在保存较大文本时,通常会选择使用 TEXT 或者 BLOB,二者之间的主要差别是 BLOB 能 ...