我需要在窗格上有一个选择侦听器和select方法,以便能够在单击节点时监视并显示突出显示.
我做了以下事情:
public class PaneWithSelectionListener extends Pane {
private ObjectProperty<Annotation> selectedAnnotation = new SimpleObjectProperty<>();
public PaneWithSelectionListener() {
super();
selectedAnnotation.addListener((obs, oldAnno, newAnno) -> {
if (oldAnno != null) {
oldAnno.setStyle("");
}
if (newAnno != null) {
newAnno.setStyle("-fx-border-color: blue;-fx-border-insets: 5;-fx-border-width: 1;-fx-border-style: dashed;");
}
});
setOnMouseClicked(e->selectAnnotation(null));
}
public void selectAnnotation(Annotation ann){
selectedAnnotation.set(ann);
}
}
Run Code Online (Sandbox Code Playgroud)
这很有效 - 但是我不能再使用SceneBuilder了,因为我的FXML引用了这个PaneWithSelectionListener
而不是Pane
.我不确定如何将自定义窗格导入SceneBuilder.我已经看了其他问题,它们都是FXML和控制器的组合 - 这只是一个Pane
.
有没有人知道这样做的方法,或者可能在初始化时交换Pane
a PaneWithSelectionListener
?
谢谢
我正在使用Ant为JavaFX应用程序构建自部署EXE.
目前Inno Setup将EXE置于此处:C:\ Users\username\AppData\Local\application name
我想将它放在不同的位置,并为用户提供覆盖它的选项.但是我似乎无法找到蚂蚁设置来改变它.
这可能吗?
谢谢!
我试图在IntelliJ中启动一个新的JDK 9项目,但是当我尝试运行它时,我在make过程中遇到以下错误:
错误:java:invalid flag:-release
我知道我没有正确设置但似乎无法找到任何与在IntelliJ中使用Jigsaw建立项目有关的内容.
编辑 这是该问题的屏幕截图.无法在任何地方找到与此相关的任何内容.
我在IDE中没有编译器错误.它只是在build/run命令上失败了.这是一个干净的IntelliJ安装,新的项目从JDK 9开始.
我无法成功找到有关如何配置Maven以使用Maven从JavaFX构建EXE的工作解决方案.
使用build.fxbuild使用E(fx)clipse设置的项目工作得很好,但我更喜欢有一个maven项目,使用依赖模块而不是基本的ANT构建.
我看过一些关于ZENJAVA的评论 - 但看起来插件已经失去了所有牵引力并且几乎已经死了.
那里有什么可以捆绑来自Maven的EXE吗?我的项目是一个企业项目,它将有几个项目和许多依赖项 - 所以我希望有一种简单有效的方法来管理所有这些项目.
谢谢
I am trying to change the value of a TextField
for display only. Ie - when users attempt to enter phone number, they only enter the digits and when they leave the field, it displays formatted without changing the data in the field.
Let's say I have a TextField
for a phone number and it should allow digits only, maximum of 10 characters:
2085551212
I can handle that with a TextFormatter
using a UnaryOperator
.
UnaryOperator<TextFormatter.Change> filter = new UnaryOperator<TextFormatter.Change>() …
Run Code Online (Sandbox Code Playgroud) 我想保留一个工作区,然后在用户第二次打开窗口时恢复它。
例如我有以下内容:
//Create the workspace there the panes will live
Pane workspace = new Pane();
//Create the layers - assume there is code to allow these to be dragged and moved
Pane layer1 = new Pane();
Pane layer2 = new Pane();
Pane layer3 = new Pane();
workspace.getChildren().addAll(layer1, layer2, layer3);
Run Code Online (Sandbox Code Playgroud)
我知道我可以通过执行以下操作来选择最上面的层:
layer2.toFront();
Run Code Online (Sandbox Code Playgroud)
然而,我似乎无法找到确定当前哪一层位于顶部的能力。
IE
layer1.setOnToFront(event -> {});
layer1.setOnToBack(event -> {});
Run Code Online (Sandbox Code Playgroud)
甚至
boolean onTop = layer1.isOnTop();
Run Code Online (Sandbox Code Playgroud)
有没有办法确定节点的位置,以便在工作区打开时,前窗格可以再次可见?
谢谢!
我正在寻找创建一个自定义TableColumn,这是一个CheckBox控件,表示是否选择了该行。我们不希望使用标准的SHIFT或CONTROL + CLICK来处理此问题,因为用户倾向于无意间单击并丢失选择。
我想做的是以下几点:
在这种情况下,该列不应成为基础数据模型的一部分,而应仅代表选择或不选择的内容。它不应该以任何方式依赖于数据模型。如果用户选中列标题中的复选框,则应选择表中的所有记录(而不仅是可见记录),如果取消选择,则应取消选择所有记录。
有没有办法以这种方式表示选择模型?
我遇到的第二个问题是,我的第一次尝试将不会在SceneBuilder中显示为可选择项,因为(从我的收集中可以看出)TableColumn不是Node,因此似乎在导入时被忽略了吗?
任何帮助将不胜感激。
谢谢
目前,Modena主题使用系统默认值为12磅的字体大小,除非字体大小已缩放.
基于CSS文件本身的注释:
RESIZING FOR DIFFERENT SCREEN DPI
-------------------------------
When the screen DPI changes Windows will use a different font size by default.
The default is 12px and can change to 15px or 18px depending on user
preference or screen DPI. On Mac the default is 13px and embedded will depend
on hardware. To make UI controls scale and be the right proportions for each of
these font sizes we base the padding (which controls size of control) on the
font …
Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的应用程序中创建一个记事本屏幕。创建注释后,它们将被锁定且无法编辑,但是可以将新页面添加到注释中。
我认为使用 TextFlow 可以很好地控制这一点。我想做的是:
**Note Taker Name**
**Date of Note**
Line of Note Text
Line of Note Text
Line of Note Text
Line of Note Text
------------------------------------------
**Note Taker Name**
**Date of Note**
Line of Note Text
Line of Note Text
Line of Note Text
Line of Note Text
Run Code Online (Sandbox Code Playgroud)
我已经尝试过这种方式:
String s1 = "line of text";
textFlow.getChildren().add(new Text(s1));
textFlow.getChildren().add(new Text(System.lineSeparator()));
textFlow.getChildren().add(new Separator(Orientation.HORIZONTAL));
textFlow.getChildren().add(new Text(System.lineSeparator()));
textFlow.getChildren().add(new Text(s1));
scrollPane.setFitToWidth(true);
Run Code Online (Sandbox Code Playgroud)
这几乎为我提供了我想要的东西,除了分隔符只是一条细线。我希望该线穿过整个 TextFlow,但我不太确定如何去做。
谢谢。
我有一个特殊的情况,我想向可见属性添加一个侦听器,然后在该属性不再可见时将其删除。我只希望听众触发一次然后将其删除。
即
ChangeListener<Boolean> listener= (obs, ov, nv) -> {
if(!nv){
//do my processing
node.visibleProperty().removeListener(listener); }
}
};
node.visibleProperty().addListener(listener);
Run Code Online (Sandbox Code Playgroud)
但是,它告诉我变量侦听器可能尚未初始化。如果我尝试将其设置为null,然后创建它,它会抱怨说它实际上不是最终的
这可能吗?
javafx-8 ×9
inno-setup ×2
build ×1
css ×1
exe ×1
installer ×1
java-9 ×1
javafx ×1
maven ×1
nodes ×1
pane ×1
scenebuilder ×1
tablecolumn ×1
tableview ×1
textflow ×1