我实现了 JavaFX 教程中的拖放示例。
当我将标签拖到目标 TabPane 上时,我设法添加了效果:
tabPane.setOnDragEntered(new EventHandler<DragEvent>() {
@Override
public void handle(DragEvent event) {
/* the drag-and-drop gesture entered the target */
/* show to the user that it is an actual gesture target */
if (event.getGestureSource() != tabPane
&& event.getDragboard().hasString()) {
tabPane.setCursor(Cursor.MOVE);
tabPane.setEffect(new Glow());
}
event.consume();
}
});
tabPane.setOnDragExited(new EventHandler<DragEvent>() {
@Override
public void handle(DragEvent event) {
/* mouse moved away, remove the graphical cues */
tabPane.setCursor(Cursor.DEFAULT);
tabPane.setEffect(null);
event.consume();
}
});
但我想将目标 TabPane 的边框设为绿色,而不是添加 Glow 效果。这可能吗?