如何将 jFoenix 添加到 IntelliJ
How to add jFoenix to IntelliJ
我尝试了很多将 jFoenix 添加到 IntelliJ,但我没有成功。我看了很多 youtube 视频并阅读了各种网站上的帖子,但都没有用。
我经常在我的 Scene Builder 8.0.5 版中使用 jFoenix,但是当我尝试在 IntelliJ 中激活它时它仍然根本不起作用。这是我的 XML 代码:
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXPasswordField?>
<?import com.jfoenix.controls.JFXTextField?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.effect.Bloom?>
<?import javafx.scene.effect.InnerShadow?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane prefHeight="576.0" prefWidth="1050.0" style="-fx-background-color: #20120F;" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Controller.SignInController">
<children>
<AnchorPane layoutX="639.0" layoutY="88.0" prefHeight="400.0" prefWidth="350.0" style="-fx-background-color: #9C2B27;">
<children>
<JFXTextField focusColor="#d4af37" layoutX="50.0" layoutY="135.0" prefWidth="250.0" promptText="Username / E-mail" unFocusColor="#c3b7b7" />
<JFXPasswordField focusColor="#d4af37" layoutX="50.0" layoutY="222.0" prefWidth="250.0" promptText="Password" unFocusColor="#c3b7b7" />
<JFXButton layoutX="50.0" layoutY="312.0" prefWidth="250.0" style="-fx-background-color: #E45652;" text="Sign In" textFill="#dad6d6">
<effect>
<Bloom threshold="0.0" />
</effect>
<font>
<Font name="System Bold" size="12.0" />
</font>
</JFXButton>
<Label layoutX="122.0" layoutY="52.0" text="Sign In" textFill="WHITE">
<font>
<Font name="Cambria" size="36.0" />
</font>
<effect>
<InnerShadow />
</effect>
</Label>
</children>
</AnchorPane>
<ImageView fitHeight="576.0" fitWidth="576.0" opacity="0.2" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../Image/TG_Background.jpg" />
</image>
</ImageView>
<Label layoutX="55.0" layoutY="131.0" text="Don't Have An Account? No Problem Sign Up Now And Enjoy Our Variety Of Features" textAlignment="CENTER" textFill="WHITE">
<font>
<Font name="Cambria" size="30.0" />
</font>
<effect>
<Bloom threshold="0.0" />
</effect>
</Label>
<JFXButton layoutX="212.0" layoutY="266.0" prefHeight="44.0" prefWidth="153.0" style="-fx-background-color: #E45652;" text="Sign Up" textFill="#dad6d6">
<effect>
<Bloom threshold="0.0" />
</effect>
<font>
<Font name="System Bold" size="18.0" />
</font>
</JFXButton>
</children>
</AnchorPane>
此外,我尝试使用 JAR 或 Maven 依赖项导入 jFoenix,当我这样做时,jFoenix 库被 IntelliJ 识别但仍然无法 运行:
如果有人能帮助我,我将不胜感激。
使用 Mavan
创建您的项目
然后在 pom.xml
文件
中添加 jfoenix
dependency
喜欢这里:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>prjname</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx</artifactId>
<version>11</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.jfoenix/jfoenix -->
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>9.0.1</version>
</dependency>
</dependencies>
</project>
在此 pom.xml
文件中添加 com.jfoenix
、org.openjfx
和 junit
dependency
我尝试了很多将 jFoenix 添加到 IntelliJ,但我没有成功。我看了很多 youtube 视频并阅读了各种网站上的帖子,但都没有用。
我经常在我的 Scene Builder 8.0.5 版中使用 jFoenix,但是当我尝试在 IntelliJ 中激活它时它仍然根本不起作用。这是我的 XML 代码:
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXPasswordField?>
<?import com.jfoenix.controls.JFXTextField?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.effect.Bloom?>
<?import javafx.scene.effect.InnerShadow?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane prefHeight="576.0" prefWidth="1050.0" style="-fx-background-color: #20120F;" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="Controller.SignInController">
<children>
<AnchorPane layoutX="639.0" layoutY="88.0" prefHeight="400.0" prefWidth="350.0" style="-fx-background-color: #9C2B27;">
<children>
<JFXTextField focusColor="#d4af37" layoutX="50.0" layoutY="135.0" prefWidth="250.0" promptText="Username / E-mail" unFocusColor="#c3b7b7" />
<JFXPasswordField focusColor="#d4af37" layoutX="50.0" layoutY="222.0" prefWidth="250.0" promptText="Password" unFocusColor="#c3b7b7" />
<JFXButton layoutX="50.0" layoutY="312.0" prefWidth="250.0" style="-fx-background-color: #E45652;" text="Sign In" textFill="#dad6d6">
<effect>
<Bloom threshold="0.0" />
</effect>
<font>
<Font name="System Bold" size="12.0" />
</font>
</JFXButton>
<Label layoutX="122.0" layoutY="52.0" text="Sign In" textFill="WHITE">
<font>
<Font name="Cambria" size="36.0" />
</font>
<effect>
<InnerShadow />
</effect>
</Label>
</children>
</AnchorPane>
<ImageView fitHeight="576.0" fitWidth="576.0" opacity="0.2" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../../Image/TG_Background.jpg" />
</image>
</ImageView>
<Label layoutX="55.0" layoutY="131.0" text="Don't Have An Account? No Problem Sign Up Now And Enjoy Our Variety Of Features" textAlignment="CENTER" textFill="WHITE">
<font>
<Font name="Cambria" size="30.0" />
</font>
<effect>
<Bloom threshold="0.0" />
</effect>
</Label>
<JFXButton layoutX="212.0" layoutY="266.0" prefHeight="44.0" prefWidth="153.0" style="-fx-background-color: #E45652;" text="Sign Up" textFill="#dad6d6">
<effect>
<Bloom threshold="0.0" />
</effect>
<font>
<Font name="System Bold" size="18.0" />
</font>
</JFXButton>
</children>
</AnchorPane>
此外,我尝试使用 JAR 或 Maven 依赖项导入 jFoenix,当我这样做时,jFoenix 库被 IntelliJ 识别但仍然无法 运行:
如果有人能帮助我,我将不胜感激。
使用 Mavan
创建您的项目
然后在 pom.xml
文件
中添加 jfoenix
dependency
喜欢这里:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>prjname</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx</artifactId>
<version>11</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.jfoenix/jfoenix -->
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>9.0.1</version>
</dependency>
</dependencies>
</project>
在此 pom.xml
文件中添加 com.jfoenix
、org.openjfx
和 junit
dependency