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分别设置四个边框的更多相关文章

  1. div四个边框分别设置阴影样式

    对于div边框的阴影一直没有很好地理解,也一直不明白怎么给四个边框分别设置阴影.昨天项目中碰到了这个问题,就认真想了一下,在此总结一二. 首先,还是从官方解释说起. 网上的解释通常都是什么水平阴影长度 ...

  2. box-shadow四个边框设置阴影样式

    其实对于box-shadow,老白我也是一知半解,之前用的时候直接复制已有的,也没有仔细思考过box-shadow的数值分别对应什么,最后导致阴影的边如何自由控制,苦于懒人一个一直没有正式去学习,今天 ...

  3. 从零开始学 Web 之 CSS3(四)边框图片,过渡

    大家好,这里是「 从零开始学 Web 系列教程 」,并在下列地址同步更新...... github:https://github.com/Daotin/Web 微信公众号:Web前端之巅 博客园:ht ...

  4. QT QProgressBar QProgressDialog 模态,位置设置,无边框,进度条样式

    一  关于模态设置 QProgressDialog可以设置模态(需要在new的时候传入parent),QProgressBar设置不好: 只有dialog可以设置模态,widget不能设置模态(QPr ...

  5. SB中设置UITextField 无边框,真机上输入汉字聚焦时,文字 下沉

    解决方案:sb中一定要设置有边框,然后在代码里设置成无边框 然后正常了. 参考:https://segmentfault.com/q/1010000007244564/a-10200000073481 ...

  6. winform设置button的边框颜色,或取消边框颜色,不显示边框

    // winform设置边框颜色不像webform那么简单,可以通过设置FlatAppearance,也可以通过重绘实现. 一.设置按钮本身属性 buttonBubufx.FlatStyle = Fl ...

  7. JavaFX窗体设置无边框

    public void start(Stage stage) throws Exception { longStart(); Parent root = FXMLLoader.load(getClas ...

  8. UIButton设置圆角和边框及边框颜色

    1. 按钮边框颜色 //设置边框颜色 [btn.layer setMasksToBounds:YES]; [btn.layer setCornerRadius:10.0]; //设置矩形四个圆角半径 ...

  9. poi设置excel表格边框、字体等

    POI中可能会用到一些需要设置EXCEL单元格格式的操作小结: 先获取工作薄对象: HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb ...

随机推荐

  1. 关于SpringMVC乱码问题

    关于SpringMVC运行Tomcat控制台出现乱码的情况(在网上找到一种方法亲测有效) 找到tomcat文件夹中的conf包下的logging.properties中找到 java.util.log ...

  2. 抛弃os.path,拥抱pathlib

    基于Python的文件.目录和路径操作,我们一般使用的是os.path模块. pathlib是它的替代品,在os.path上的基础上进行了封装,实现了路径的对象化,api更加通俗,操作更便捷,更符编程 ...

  3. day09作业01用户登录与验证

    import timeLoginTime = time.asctime( time.localtime(time.time()) )print ("time %s" % Login ...

  4. python3.x 基础一:dict字典

    字典,{key,value} help(dict) 定义一个字典: >>> dict1 {', 'name': 'yzw'} >>> dict2=dict1 > ...

  5. Vue刷新页面的三种方式

    我们在写项目的时候,经常会遇到,用户执行完某个动作,改变了某些状态,需要重新刷新页面,以此来重新渲染页面 1.原始方法: location.reload(); 2.vue自带的路由跳转: this.$ ...

  6. codeforce E. Fire背包

    E. Fire time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  7. A+B Coming(hdu1720)

    思考:十六进制的输入->%x,定义时用int.要变成十进制输出,直接在输出时用->%d. #include<stdio.h> int main() { int A,B; cha ...

  8. vue中template的三种写法

    第一种(使用模板字符串)早期字符串拼接年代 <div id="app"></div> new Vue({ el: "#app", tem ...

  9. 转 document.compatMode介绍

    对于document.compatMode,很多朋友可能都根我一样很少接触,知道他的存在却不清楚他的用途.今天在ext中看到 document.compatMode的使用,感觉这个对于我们开发兼容性的 ...

  10. 基于 kubeadm 搭建高可用的kubernetes 1.18.2 (k8s)集群 三 集群可用性测试

    1. 创建nginx ds # 写入配置 $ cat > nginx-ds.yml <<EOF apiVersion: v1 kind: Service metadata: name ...