In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about how to use JavaFX and Jfoenix. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. About form Stage
Stage is the form you see after startup, including the title, minimize, maximize buttons, etc., which is equivalent to a frame.
two。 Introduction to Stage attributes
Title: form title
Width: form width
Height: form height
MaxWidth: maximum width of the form
MaxHeight: maximum height of the form
MinWidth: minimum width of the form
MinHeight: minimum height of the form
Resizable: whether the width and height of the form are allowed to be adjusted
Maximized: whether the form allows maximization
X: the x-axis coordinates of the form on the screen
Y: y-axis coordinates of the form on the screen
3. These properties are set by code, which is implemented as follows
Package com.dengyunshuo.demo
Import javafx.application.Application
Import javafx.scene.Scene
Import javafx.scene.control.Label
Import javafx.stage.Stage
Import sun.tools.java.Constants
Import java.net.URL
/ * *
* @ author dengdashuai
* @ date 2019-09-03
, /
Public class HelloWorld extends Application {
/ * *
* launch the main window
*
* @ param primaryStage
* @ throws Exception
, /
Public void start (Stage primaryStage) throws Exception {
/ / set the title of the main window
PrimaryStage.setTitle ("Hello World")
/ / set the width of main window
PrimaryStage.setWidth (800)
/ / set the height of the main window
PrimaryStage.setHeight (600)
/ / set the minimum width of the main window
PrimaryStage.setMinWidth (400)
/ / set the minimum height of the main window
PrimaryStage.setMinHeight (300)
/ / allow the width and height of the main window to be adjusted
PrimaryStage.setResizable (true)
/ / window is allowed to maximize
PrimaryStage.setMaximized (true)
/ *
* create a label object
* the text on the label is "Hello World"
, /
Label label = new Label ("Hello World")
/ / reference external CSS style, style name hello-world
Label.getStyleClass () .add (hello-world)
/ *
* create a scene object
* the content contained in the scene is a tag
* scene width and height are 500 respectively
, /
Scene scene = new Scene (label, 500500)
/ / load external app.css file
Scene.getStylesheets ()
.add (getClass (). GetClassLoader (). GetResource ("css/app.css")
.toExternalForm ()
/ / put the scene into the main window
PrimaryStage.setScene (scene)
/ / display window
PrimaryStage.show ()
}
/ * *
* main entry of the program
*
* @ param args
* @ throws Exception
, /
Public static void main (String [] args) throws Exception {
/ / start the application
HelloWorld.launch (args)
}
}
4. The screenshot of the operation is as follows
Screenshot after startup
Take screenshots after adjusting the form
Thank you for reading! This is the end of the article on "how to use JavaFX and Jfoenix". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.