How to set the width of a Text element in JavaFX?
By: AnderRuiz Printer Friendly Format
Stack {
layoutInfo: LayoutInfo {
width: bind width;
height: bind height;
}
content: [Rectangle {
width: bind width, height: bind height
//fill: bind color;
fill: Color.GREEN
arcHeight: 20; arcWidth: 20;
}
Text {
font: Font {
size: 24
}
textAlignment: TextAlignment.CENTER;
wrappingWidth: width;
boundsType: TextBoundsType.VISUAL;
fill: Color.WHITE;
content: bind text;
}
]
}
wrappingWidth: Sets the maximun width of the text
boundsType: If you put the wrappingWidth var and you want to center a text you MUST set this var to VISUAL
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Subscribe to Tutorials
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java