Programming Tutorials

(追記) (追記ここまで)

How to set the width of a Text element in JavaFX?

By: AnderRuiz in Java Tutorials on 2010年07月31日 [フレーム]

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




(追記) (追記ここまで)


Add Comment

JavaScript must be enabled for certain features to work
* Required information
1000

Comments

No comments yet. Be the first!
(追記) (追記ここまで)
(追記) (追記ここまで)

AltStyle によって変換されたページ (->オリジナル) /