In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to use Fx-Label of Java". In daily operation, I believe many people have doubts about how to use Fx-Label of Java. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use Fx-Label of Java". Next, please follow the editor to study!
Effect.
Import javafx.application.Application;import javafx.scene.Group;import javafx.scene.Scene;import javafx.scene.control.Label;import javafx.scene.input.MouseEvent;import javafx.scene.layout.HBox;import javafx.scene.text.Font;import javafx.stage.Stage;public class LabelSample1 extends Application {Label label3 = new Label ("A label that needs to be wrapped"); public static void main (String [] args) {launch (args) } @ Overridepublic void start (Stage stage) {Scene scene = new Scene (new Group ()); stage.setTitle ("Label Sample"); stage.setWidth (200,180); Label label2 = new Label ("Values"); label2.setFont (Font.font ("Cambria", 32)) / / rotation angle label2.setRotate (270,270); / / Vertical movement position label2.setTranslateY (50); / / whether to wrap label3.setWrapText (true) if the label width is exceeded; label3.setTranslateY (50); label3.setPrefWidth (100) / / Mouse arrival label3.setOnMouseEntered ((MouseEvent e)-> {/ / label3.setText ("); label3.setScaleX (1.5); label3.setScaleY (1.5) / / visible but invisible is no longer controlled by label3.setVisible (true) such as mouse and keyboard; System.out.println ("22222");}); label3.setOnMouseExited ((MouseEvent e)-> {label3.setScaleX (1); label3.setScaleY (1)) / / label3.setText ("A label that needs to be wrapped"); / / label3.setVisible (false); System.out.println ("111111");}); HBox hbox = new HBox (); hbox.setSpacing (10); hbox.getChildren () .add (label2) Hbox.getChildren () .add (label3); ((Group) scene.getRoot ()) .getChildren () .add (hbox); stage.setScene (scene); stage.show ();}} at this point, the study on "how to use Java's Fx-Label" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.