javafx:gridpane概述

这个...

这个

Serious, focused young man working at laptop GridPaneclass creates a JavaFX

Nodes can be placed in each cell of the grid and can span multiple cells either vertically or horizontally. By default the rows and columns will be sized to fit their content - that is the widest child node defines the column width and the tallest child node the row height. 

Import Statement

import javafx.scene.layout.GridPane;

Constructors

The

GridPane GridPane playerGrid = new GridPane();

Useful Methods

Child nodes are added to the GridPane //Place the Text control in column 1, row 8 Text rank4 = new Text("4"); playerGrid.add(rank4, 0,7); Note: The column and row index starts at 0. So the first cell positioned at column 1, row 1 has an index of 0, 0. Child nodes can also span multiple columns or rows. This can be specified in the add //Here the Text control is spanning 4 columns and 1 row Text title = new Text("Top Scorers in English Premier League"); playerGrid.add(title, 0,0,4,1); Child nodes contained within the GridPane can have their alignment along the horizontal or vertical axis by using the setHalignment and setValignment GridPane.setHalignment(goals4, HPos.CENTER); Note: The VPos enum contains four constant values to define the vertical position: BASELINE , BOTTOM , CENTER and TOP . The HPos enum only contains three values for the horizontal position: CENTER , LEFT and RIGHT The padding of child nodes can also be set by using the setPadding method. This method takes the child node being set and Insets //set the padding for all the cells in the GridPane playerGrid.setPadding(new Insets(0, 10, 0, 10)); The spacing between the columns and rows can be defined by using the setHgap and setVgap playerGrid.setHgap(10);playerGrid.setVgap(10); The setGridLinesVisible playerGrid.setGridLinesVisible(true);

Usage Tips

If two nodes are set to be displayed in the same cell then they will overlap in the JavaFX scene. Columns and rows can be set to a preferred width and height through the use of RowConstraints and ColumnConstraints . These are separate classes that can be used to control the size. Once defined they are added to the GridPane by using the getRowConstraints().addAll and getColumnConstraints().addAll GridPane objects can be styled using JavaFX CSS. All the CSS properties defined under Region To see the GridPane layout in action have a look at the GridPane Example Program. It shows how to place Text
  • 发表于 2021-09-12 23:48
  • 阅读 ( 215 )
  • 分类:IT

你可能感兴趣的文章

泄露的文件概述了俄罗斯到2030年的太空探索计划

...低轨道出租车。俄罗斯航天局(Rosco**os)泄露的一份文件概述了俄罗斯在2030年之前雄心勃勃的太空探索战略。计划包括明年用模块化的安加拉火箭取代联盟号火箭;在国际空间站的资金在2020年结束后,俄罗斯有多个建造空间站...

  • 发布于 2021-04-21 15:48
  • 阅读 ( 140 )

谷歌的网络垃圾邮件团队负责人大致概述了其搜索工作原理

...”。谷歌网络垃圾邮件团队负责人马特·卡茨(Matt Cutts)概述了这家搜索巨头的内部阴谋,包括对他们旧的爬行方法(发现新内容的一种缓慢、低效的方法)和搜索引擎的比较他们的新(er)方法将web分成块,允许增量(因此更...

  • 发布于 2021-04-22 03:10
  • 阅读 ( 165 )

微软概述了清理windows phone市场的计划

...的博客文章中,市场高级主管托德·布里克斯(ToddBrix)概述了一些新的努力,以确保开发者遵循微软的指导方针。 微软正在努力改进四个关键领域。首先是商标问题,微软希望明确指出,应用程序发行商应避免在应...

  • 发布于 2021-04-22 04:32
  • 阅读 ( 122 )

苹果概述三星专利案拟赔偿25亿美元以上

...件专利公司(FOSS Patents)发表了一份部分修改过的声明,概述了苹果对三星涉嫌专利侵权的看法。苹果要求赔偿25.25亿美元,以弥补其估计的5亿美元的利润损失,其中可能有200万美元来自三星的“不当得利”,2500万美元用于其...

  • 发布于 2021-04-23 12:26
  • 阅读 ( 152 )

马克·扎克伯格概述了facebook将如何解决假新闻问题

...做。
 扎克伯格昨晚在Facebook的一篇博文中概述了Facebook为限制虚假信息传播而采取的措施,但重申了他的信念,即Facebook不应成为“真相的仲裁者”
 Facebook目前正在进行的一些项目包括:帮助标记虚假信息的新...

  • 发布于 2021-05-08 18:29
  • 阅读 ( 189 )

这五个步骤概述了设计思维过程的基础

...品,创造公司标志。如果您正为从何处开始而苦恼,此图概述了五个基本步骤。下图来自creativity site Design Taxi,从为公司创建产品的角度描述了设计过程的基础知识。然而,这个框架适用于大多数形式的商业创意。步骤如下:移...

  • 发布于 2021-05-17 05:09
  • 阅读 ( 170 )

本视觉指南概述了男士西装应如何搭配

男士西装可能是很棘手的事情,如果你没有理由经常穿西装,你可能不知道一旦你穿上它会是什么样子。这本来自Real Men Real Style的视觉指南将帮助您确保您的西装从领口到袖口都非常合身。如果你不常穿西装,你可能会认为如...

  • 发布于 2021-05-23 04:07
  • 阅读 ( 133 )

谷歌将于周四发布chrome操作系统概述和发布计划

据科技博客TechCrunch报道,谷歌将于明天举办Chrome操作系统活动,届时他们将全面介绍7月份发布的迄今为止的绝密操作系统。事实上,一些早期版本的操作系统可能会在本周推出。这不是我们第一次听到关于Chrome操作系统事件的...

  • 发布于 2021-07-28 04:54
  • 阅读 ( 138 )

驱动器管理器提供驱动器的详细概述

仅限Windows:有大量工具可用于检查驱动器信息、状态和运行状况,但驱动器管理器可以方便地将大量此类功能集成到单个应用程序中,以满足各种需求。驱动器管理器具有管理硬盘驱动器、光盘驱动器和可移动驱动器的工具。...

  • 发布于 2021-07-28 19:53
  • 阅读 ( 154 )

网络中立性,概述

随着最近网络中立的风潮,你可能会发现很难快速理解这一切的真正含义。关于中立性的问题,谁应该对我们所有人的作品产生怎样的影响。这是一个很好的方法,可以很快地解决一个非常重要的问题。网络中立初级读物[HowtuffW...

  • 发布于 2021-08-02 04:12
  • 阅读 ( 98 )
ouuq3626
ouuq3626

0 篇文章

相关推荐