是否可以在Scene Builder中包含Controls FX的组件?
如果是的话,你能告诉我,如果没有,你能告诉我是否有其他选择?
ControlsFX类Dialogs标记为已弃用.
用什么代替?
有人可以从ControlFX写一个简短的JavaFX Popover示例吗?我无法让它发挥作用.任何帮助是极大的赞赏!
我正在使用JavaFX项目.我正在使用ControlFx的 Autcomplete TextField .每次我在数据库表中添加新行,它应该更新自动完成,我这样做但我的问题是显示双上下文菜单,我们可以说双重自动完成,因为我调用方法创建自动完成每次添加表中的新元素.
当我单击一个选项卡时,editBill我调用此方法:
public void showEditBill() {
if (!BillPane.getTabs().contains(EditBillTab)) {
BillPane.getTabs().add(EditBillTab);
}
SingleSelectionModel<Tab> selectionModel = BillPane.getSelectionModel();
selectionModel.select(EditBillTab);
/*it should remove the old autocomplete from textfield*/
pushBills(); //Call for cheking new items
}
Run Code Online (Sandbox Code Playgroud)
pushBills方法():
public void pushBills() {
ArrayList list = new ArrayList<>();
bills = new BillHeaderDao().FindAll();
for (int i = 0; i < bills.size(); i++) {
list.add(bills.get(i).getIdClient());
}
//How can i remove the old bind before bind again
autoCompletionBinding = TextFields.bindAutoCompletion(SearchBill, SuggestionProvider.create(list));
} …Run Code Online (Sandbox Code Playgroud) setOrientation设置为时Orientation.HORIZONTAL滑块的运动非常平滑,但setOrientation设置为时Orientation.VERTICAL运动则比较滞后。
以下是最小再现:
package org.example;
import javafx.application.Application;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import org.controlsfx.control.RangeSlider;
public class App extends Application {
@Override
public void start(Stage stage) {
RangeSlider rangeSliderVertical = new RangeSlider();
rangeSliderVertical.setOrientation(Orientation.VERTICAL);
rangeSliderVertical.setMinHeight(500);
rangeSliderVertical.setMax(100);
rangeSliderVertical.setMin(0);
rangeSliderVertical.setHighValue(100);
rangeSliderVertical.setLowValue(0);
RangeSlider rangeSliderHorizontal = new RangeSlider();
rangeSliderHorizontal.setMinWidth(500);
rangeSliderHorizontal.setMax(100);
rangeSliderHorizontal.setMin(0);
rangeSliderHorizontal.setHighValue(100);
rangeSliderHorizontal.setLowValue(0);
rangeSliderHorizontal.setOrientation(Orientation.HORIZONTAL);
FlowPane vBoxWithSliders = new FlowPane();
VBox.setVgrow(vBoxWithSliders, Priority.ALWAYS);
HBox.setHgrow(vBoxWithSliders, Priority.ALWAYS);
vBoxWithSliders.setAlignment(Pos.CENTER);
vBoxWithSliders.getChildren().addAll(rangeSliderVertical, rangeSliderHorizontal);
var scene = …Run Code Online (Sandbox Code Playgroud) 简短问题:使用记录使用数据库中的数据填充 Java FX 表视图的最佳方法是什么?(而不是具有 getter 和 setter 的典型对象类)
完整的问题: 我最近创建了这个 InventoryRecord.java 文件来替换我用来填充表视图的名为“Inventory”的传统对象:
import java.util.List;
public record InventoryRecord(
String make
, String model
, String officialModel
, String upc
, List<String> category
, String type
, String description
,String vendor
, Double cost
, Double price
) {}
Run Code Online (Sandbox Code Playgroud)
我想使用此记录作为我的框架,使用数据库中的数据填充我的 TableView(在本例中为 Neo4j,但这并不重要)
在拥有此 InventoryRecord 记录之前,我使用的是一个名为 Inventory 的典型类,如下所示(当然,为了保持问题的可读性,我已缩短它,假设 Inventory 的每个属性都有 getter/setter。)
public class Inventory {
private String make;
private String model;
private String officialModel;
private List<String> category;
private String type;
private String description; …Run Code Online (Sandbox Code Playgroud) 我是一个Java初学者,试图使用来自ControlsFX的BreadCrumbBar在我正在使用JavaFX 8制作的桌面应用程序中创建一个导航栏.我似乎无法按照我想要的方式工作,并且在线搜索教程没有结果.我找到了API,但它没有多大帮助.
我的代码附在下面:
@FXML
private BreadCrumbBar bread;
private TreeItem<String> tree, tree1, tree2;
@FXML
private void initialize(){
tree = new TreeItem<String>("Log In");
tree1 = new TreeItem<String>("Language Selection");
tree2 = new TreeItem<String>("Patient List");
tree.getChildren().addAll(tree1, tree2);
bread.setSelectedCrumb(tree);
}
public void refresh(){
bread.setSelectedCrumb(tree.nextSibling(bread.getSelectedCrumb()));
}
Run Code Online (Sandbox Code Playgroud)
条形图显示为登录屏幕应该只显示"登录"作为选定的crumb.我每次想要切换到下一个痕迹按钮时都会从主类调用刷新但是当我移动时条形图就会消失从第一个屏幕开始.它不应该将选定的面包屑设置为树的下一个兄弟,即tree1吗?
如果有人知道如何配置自动导航功能,那将是非常有用的.(如果它易于实现,可能比排序我自己的代码更有帮助)
谢谢!
我尝试在 Win 10 机器上使用 InteliJ 和 Maven 运行我的应用程序。如果我跑
mvn clean javafx:run
Run Code Online (Sandbox Code Playgroud)
我的 GUI 启动,但如果我使用 org.controlsfx.control.textfield.TextFields 中的 Textfield,我会遇到问题
Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class org.controlsfx.control.textfield.AutoCompletionBinding (in unnamed module @0x19b440d0) cannot access class com.sun.javafx.event.EventHandlerManager (in module javafx.base) because module javafx.base does not export com.sun.javafx.event to unnamed module @0x19b440d0
Run Code Online (Sandbox Code Playgroud)
我发现这是一个已知问题,您必须按照命令传递给 JVM。
--add-exports=javafx.base/com.sun.javafx.event=org.controlsfx.controls
Run Code Online (Sandbox Code Playgroud)
但是我如何在 Maven 中做到这一点?我尝试了 2 种方法。
方式 1: 使用 .mvn/jvm.config 文件并添加此命令,但这根本不会改变任何东西,即使在那里输入无意义的东西。
方式二:使用 --add-export 命令 添加系统变量MAVEN_OPTS。然后 maven 对这个变化做出反应,但说:
WARNING: Unknown module: org.controlsfx.controls specified to --add-exports
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
编辑:方式 …
我想开发一个使用controlsfx Notifications 在系统托盘模式下显示一些通知的应用程序。在正常模式下,我的应用程序运行良好并且可以成功显示通知。但是当我在系统托盘中隐藏 stage 时,会发生 NullPointerException。我不知道如何解决这个问题。
import java.awt.AWTException;
import java.awt.MenuItem;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.event.ActionListener;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
public class TryIconNotification extends Application {
private boolean firstTime;
private TrayIcon trayIcon;
@Override
public void start(Stage stage) throws Exception {
firstTime = true;
Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
Scene scene = new Scene(root);
createTrayIcon(stage);
firstTime = true;
Platform.setImplicitExit(false);
stage.setScene(scene);
stage.show();
}
public void createTrayIcon(final Stage …Run Code Online (Sandbox Code Playgroud) 嘿那里
所以我有以下问题。我有大约 1500 张扑克牌图像。我想将它们显示在“图库”中,您可以在其中滚动浏览它们。我能够使用 ImageCell 对象创建 GridView,并且还能够向其中添加图像。现在我的问题是,如果我一次添加所有图像,逻辑上Java会因为堆错误而崩溃。我的列表中有图像网址(本地文件)。我怎样才能实现它只加载 15 张图像。如果我滚动它,它会加载接下来的 15 个并卸载旧的。所以它只会加载实际可见图像的图像,而不是全部 1500 个图像。我该怎么做?我完全没有主意了。需要 Platform.runLater() 因为 ControlsFX 存在某种问题
这是我的代码:
public void initialize() {
GridView<Image> gridView = new GridView<>();
gridView.setCellFactory(gridView1 -> new ImageGridCell(true));
Image image = new Image("C:\\Users\\nijog\\Downloads\\cardpictures\\01DE001.png");
gridView.setCellWidth(340);
gridView.setCellHeight(512);
//Platform.runLater(()-> {
// for (int i = 0; i < 5000; i++){
// gridView.getItems().add(image);
// }
//});
Platform.runLater(() -> gridView.getItems().addAll(createImageListFromCardFiles()));
borderPane.setCenter(gridView);
}
protected List<Image> createImageListFromCardFiles(){
List<Image> imageViewList = new ArrayList<>();
App.getCardService().getCardArray().stream()
//.filter(Card::isCollectible)
.sorted(Comparator.comparingInt(Card::getCost))
.sorted(Comparator.comparing(Card::isChampion).reversed())
.skip(0)
//.limit(100)
.forEach(card -> {
try {
String …Run Code Online (Sandbox Code Playgroud) controlsfx ×10
javafx ×9
java ×7
javafx-8 ×3
maven ×2
autocomplete ×1
binding ×1
breadcrumbs ×1
gridview ×1
java-record ×1
javafx-2 ×1
openfx ×1
popover ×1
scenebuilder ×1
system-tray ×1