Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use JavaFX and Jfoenix

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to use JavaFX and Jfoenix, the article is very detailed, has a certain reference value, interested friends must read it!

1. Local environment building

To install JDK1.8, please refer to the website for installation tutorials

To install IntelliJ IDEA, please refer to the website for installation tutorials

two。 When the environment is ready, create the project

Select Maven for project type

For information on how to create a Maven project, please refer to the website.

3. After the project is created, add pom dependencies

Add the following dependencies to the pom.xml file in the project

Com.jfoenix

Jfoenix

8.0.8

De.jensd

Fontawesomefx

8.9

Com.alibaba

Fastjson

1.2.58

Junit

Junit

3.8.1

Test

4. Write the Hello World code as follows

Package com.dengyunshuo.demo

Import javafx.application.Application

Import javafx.geometry.Pos

Import javafx.scene.Scene

Import javafx.scene.control.Label

Import javafx.stage.Stage

/ * *

* @ 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 {

/ *

* create a label object

* the text on the label is "Hello World"

, /

Label label = new Label ("Hello World")

/ / set the location of the label in the parent container-on the right

Label.setAlignment (Pos.CENTER_RIGHT)

/ *

* 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)

/ / 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)

}

}

5. After launching the application, the screenshot is as follows

The above is all the content of the article "how to use JavaFX and Jfoenix". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report