小编Tri*_*ark的帖子

如何在 IntelliJ IDEA 中将 AwesomeFontFX 图标包添加到 JavaFX 项目?

我正在创建一个 mini-JavaFX 项目并想使用 Awesome Font Icon Pack。我使用 Scenebuilder 加载了 fontawesomefx-8.9 并在其中打开了 FXML 并在其中加载了两个图标,还在 IntelliJ 的外部库中添加了 JAR 文件但是当我运行代码时,它为 de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView 提供了 ClassNotFoundException。我该怎么办?

我删除了两个图标,代码运行良好。我搜索了很多地方,但它只显示将 JAR 文件添加到外部库中,什么也没有。我正在使用 JDK 12、JavaFX 12 和 Scenebuilder 11.0。

FXML 文件

<?xml version="1.0" encoding="UTF-8"?>

<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>

<fx:root alignment="center" hgap="10" type="GridPane" vgap="10" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller">
   <children>
      <Button mnemonicParsing="false" text="Click Me!!!">
         <opaqueInsets>
            <Insets left="5.0" />
         </opaqueInsets></Button>
      <FontAwesomeIconView glyphName="CIRCLE" />
   </children>
   <columnConstraints>
      <ColumnConstraints />
   </columnConstraints>
   <rowConstraints>
      <RowConstraints />
   </rowConstraints>
</fx:root>
Run Code Online (Sandbox Code Playgroud)

控制器类

package sample; …
Run Code Online (Sandbox Code Playgroud)

java icons javafx scenebuilder

2
推荐指数
1
解决办法
5623
查看次数

标签 统计

icons ×1

java ×1

javafx ×1

scenebuilder ×1