本文整理汇总了Java中javafx.event.Event类的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Event类属于javafx.event包,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showPrefWindow
import javafx.event.Event; //导入依赖的package包/类
/**
* Mostra la finestra per impostare le preferenze dell'animazione.
* @param e evento scatenante.
* @return Void.
*/
public static Void showPrefWindow(Event e) {
try {
Parent root = FXMLLoader.load(Singleton.getInstance().mainViewController.getClass().getResource("applicationSettingsView.fxml"));
Stage stage = new Stage();
stage.setTitle("Animation Settings");
stage.setScene(new Scene(root, 400, 150));
stage.show();
stage.setResizable(false);
} catch (IOException exc) {
exc.printStackTrace();
}
return null;
}
示例2: getAllRelations
import javafx.event.Event; //导入依赖的package包/类
public void getAllRelations(){
log.debug("in get all relations.");
for(Npc n: (List<Npc>)(List<?>)npcRelation.getList()){
log.debug("\t" + n.getID());
}
region.setInteractions(new ArrayList<Interaction>((List<Interaction>)(List<?>)interactionController.getAllInteractions()));
region.setGods(new ArrayList<God>((List<God>)(List<?>)godRelation.getList()));
region.setNpcs(new ArrayList<Npc>((List<Npc>)(List<?>)npcRelation.getList()));
region.setSubRegions(new ArrayList<Region>((List<Region>)(List<?>)regionRelation.getList()));
region.setEvents(new ArrayList<com.forj.fwm.entity.Event>((List<com.forj.fwm.entity.Event>)(List<?>)eventRelation.getList()));
region.setTemplates(new ArrayList<Template>((List<Template>)(List<?>)templateRelation.getList()));
if (!superRelation.getList().isEmpty()){
Region newRegion = (new ArrayList<Region>((List<Region>)(List<?>)superRelation.getList())).get(0);
region.setSuperRegion(newRegion);
log.debug("spitting out super region IDS.");
log.debug(newRegion.getID());
}
log.debug("spitting out sub region IDS.");
for(Region r: region.getSubRegions()){
log.debug(r.getID());
}
}
示例3: addMemberAction
import javafx.event.Event; //导入依赖的package包/类
private void addMemberAction(Event e) {
AddMemberDialog dialog = new AddMemberDialog(organization);
Optional<Member> result = dialog.showAndWait();
if (result.isPresent()) {
try {
organization.addMember(result.get().getId());
forceUpdateMemberList();
} catch (JSONException | WebApiException | IOException | HttpException e1) {
ErrorUtils.getAlertFromException(e1).show();
e1.printStackTrace();
}
}
}
示例4: removeAction
import javafx.event.Event; //导入依赖的package包/类
private void removeAction(Event e) {
Alert conf = new Alert(AlertType.CONFIRMATION, "Do you really want to delete this organization ?\n"
+ "Every server and member association will be lost.");
Optional<ButtonType> result = conf.showAndWait();
if (result.isPresent() && result.get().equals(ButtonType.OK)) {
try {
wsp.removeOrganization(orgas.selectionModelProperty().get().getSelectedItem().getOrganization());
forceOrganizationListRefresh();
App.getCurrentInstance().refreshWSPTabs();
} catch(Exception e1) {
ErrorUtils.getAlertFromException(e1).show();
}
}
}
示例5: searchAction
import javafx.event.Event; //导入依赖的package包/类
private void searchAction(Event e) {
String query = queryField.getText();
searchList.clear();
try {
List<Member> orgaMemberList = organization.getMemberList();
ArrayList<MemberView> result = new ArrayList<>(organization.getWsp().searchMembers(query, 0, RESULT_SIZE).stream().map(m -> new MemberView(m)).collect(Collectors.toList()));
result.forEach(mv -> {
if (!orgaMemberList.stream().anyMatch(m -> m.getId() == mv.getId())) {
searchList.add(mv);
}
});
resultCount.setText(getResultCountText(searchList.size()));
} catch (JSONException | IOException | HttpException | WebApiException e1) {
new Alert(AlertType.ERROR, "Error while fetching member list. " + e1.getClass() + " : " + e1.getMessage()).show();
e1.printStackTrace();
}
}
示例6: editWSPAction
import javafx.event.Event; //导入依赖的package包/类
private void editWSPAction(Event e) {
EditWSPDialog dialog = new EditWSPDialog(wsp);
Optional<WebServiceProvider> result = dialog.showAndWait();
if (result.isPresent()) {
try {
wsp = result.get();
wsp.fetchConfiguration();
writeWSP(wsp);
} catch (JSONException | WebApiException | IOException | HttpException e1) {
Alert a = ErrorUtils.getAlertFromException(e1);
a.show();
e1.printStackTrace();
}
} else {
new Alert(AlertType.ERROR, "Wrong WSP information");
}
}
示例7: handleRequestToCloseEditor
import javafx.event.Event; //导入依赖的package包/类
@FXThread
private void handleRequestToCloseEditor(@NotNull final FileEditor editor, @NotNull final Tab tab,
@NotNull final Event event) {
if (!editor.isDirty()) {
return;
}
final String question = Messages.EDITOR_AREA_SAVE_FILE_QUESTION.replace("%file_name%", editor.getFileName());
final ConfirmDialog dialog = new ConfirmDialog(result -> {
if (result == null) return;
if (result) {
editor.save(fileEditor -> getTabs().remove(tab));
} else {
getTabs().remove(tab);
}
}, question);
dialog.show();
event.consume();
}
示例8: changeHiddenPower
import javafx.event.Event; //导入依赖的package包/类
public void changeHiddenPower(Event event) {
if (event instanceof MouseEvent) {
MouseEvent mouseEvent = (MouseEvent) event;
MouseButton mouseButton = mouseEvent.getButton();
if (mouseEvent.isShiftDown() || mouseButton.equals(MouseButton.SECONDARY)) {
pokemon.setHiddenPower(hiddenPowerCalculator.updateToNext());
} else if (mouseButton.equals(MouseButton.PRIMARY)) {
pokemon.setHiddenPower(hiddenPowerCalculator.updateToPrevious());
} else if (mouseButton.equals(MouseButton.MIDDLE)) {
pokemon.setHiddenPower(hiddenPowerCalculator.setUnknown());
}
} else if (event instanceof ScrollEvent) {
double delta = ((ScrollEvent) event).getDeltaY();
if (delta > 0) {
pokemon.setHiddenPower(hiddenPowerCalculator.updateToNext());
} else if (delta < 0) {
pokemon.setHiddenPower(hiddenPowerCalculator.updateToPrevious());
}
}
}
示例9: presentHelpWindow
import javafx.event.Event; //导入依赖的package包/类
/**
* Öffnet ein Fenster mit einer Hilfe
* @param e Das Event
* @param type Die Hilfe, die angezeigt werden soll
*/
public void presentHelpWindow(Event e, HelpType type) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("helpWindow.fxml"));
AnchorPane root = (AnchorPane)loader.load();
helpController = loader.getController();
helpController.setType(type);
helpStage = new Stage();
helpStage.setResizable(false);
helpStage.setTitle("Vier Gewinnt Hilfe");
helpStage.setScene(new Scene(root));
helpStage.show();
helpController.display();
} catch (IOException exception) {
exception.printStackTrace();
}
}
示例10: presentConnectToServerWindow
import javafx.event.Event; //导入依赖的package包/类
/**
* Zeigt den Connect-Dialog an
* @param e Das Event
*/
public void presentConnectToServerWindow(Event e) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("connectToServer.fxml"));
GridPane root = (GridPane)loader.load();
connectToServerController = loader.getController();
connectToServerController.setCompletedRunnable((run) -> {
/*String ip = connectToServerController.getIpAdressTextField().getText();
String port = connectToServerController.getPortTextField().getText();*/
String ip = (String) UserDefaults.sharedDefaults().valueForKey(UserDefaults.ADRESS_KEY);
int port = (int) UserDefaults.sharedDefaults().valueForKey(UserDefaults.PORT_KEY);
String userID = (String)UserDefaults.sharedDefaults().valueForKey(UserDefaults.NAME_KEY);
this.client = new Client(ip, port, userID);
this.client.setDelegate(this);
this.client.connect();
connectToServerCallback = run;
});
connectToServerStage = new Stage();
connectToServerStage.setResizable(false);
connectToServerStage.setTitle("Connect to server");
connectToServerStage.setScene(new Scene(root));
connectToServerStage.show();
} catch (IOException e1) {
e1.printStackTrace();
}
}
示例11: nextStep
import javafx.event.Event; //导入依赖的package包/类
/**
* Esegue uno step dell'animazione
* @param e evento per cui è stato richiamato il metodo.
* @return Void
*/
public static Void nextStep(Event e) {
if (!Singleton.getInstance().isAnimating)
return null;
// ottengo il thread
GraphVisiter bfs = (GraphVisiter) Singleton.getInstance().getThreadByName(AnimationSettings.THREAD_NAME);
// se il thread esiste ed è ancora in esecuzione, lo riprendo
if (bfs != null && bfs.isAlive()) {
synchronized (bfs) {
bfs.notify();
}
}
return null;
}
示例12: createEditorAreaPane
import javafx.event.Event; //导入依赖的package包/类
/**
* Create editor area pane.
*/
@FXThread
protected void createEditorAreaPane() {
editorAreaPane = new StackPane();
editorAreaPane.setOnDragOver(this::handleDragOverEvent);
editorAreaPane.setOnDragDropped(this::handleDragDroppedEvent);
editor3DArea = new BorderPane();
editor3DArea.setOnMousePressed(event -> editor3DArea.requestFocus());
editor3DArea.setOnKeyReleased(Event::consume);
editor3DArea.setOnKeyPressed(Event::consume);
FXUtils.addToPane(editor3DArea, editorAreaPane);
FXUtils.addClassTo(editorAreaPane, CSSClasses.FILE_EDITOR_EDITOR_AREA);
}
示例13: delete
import javafx.event.Event; //导入依赖的package包/类
@Override public Optional<ButtonType> delete(Optional<ButtonType> option) {
if (!option.isPresent() || option.get() != FXUIUtils.YES_ALL) {
option = FXUIUtils.showConfirmDialog(null, "Do you want to delete the entry `" + entry.getName() + "`?", "Confirm",
AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO, FXUIUtils.YES_ALL, ButtonType.CANCEL);
}
if (option.isPresent() && (option.get() == ButtonType.YES || option.get() == FXUIUtils.YES_ALL)) {
GroupResource parent = (GroupResource) getParent();
parent.deleteEntry(this);
try {
Group.updateFile(parent.getSuite());
Event.fireEvent(parent, new ResourceModificationEvent(ResourceModificationEvent.UPDATE, parent));
} catch (IOException e) {
e.printStackTrace();
return option;
}
}
return option;
}
示例14: buildEvent
import javafx.event.Event; //导入依赖的package包/类
private EventHandler<Event> buildEvent() {
return e -> {
// if((e.getEventType() == MouseEvent.MOUSE_ENTERED_TARGET ||e.getEventType() == MouseEvent.MOUSE_ENTERED ||
// e.getEventType() == MouseEvent.MOUSE_MOVED || e.getEventType() == GazeEvent.GAZE_ENTERED ||
// e.getEventType() == GazeEvent.GAZE_MOVED) && anniOff) {
if (animationStopped
&& (e.getEventType() == MouseEvent.MOUSE_ENTERED || e.getEventType() == GazeEvent.GAZE_ENTERED)) {
animationStopped = false;
enter(e);
}
};
}
示例15: startImport
import javafx.event.Event; //导入依赖的package包/类
@FXML
public void startImport(Event event) {
config.setBlockEnd(blockEnd.getText());
config.setStartBlock(blockStart.getText());
config.setBlockIndex(blockIndex.getText());
config.setTxIndex(txIndex.getText());
config.setBlockImport(importBlocks.isSelected());
config.setTxImport(importTx.isSelected());
config.setIpc(endpoint.getText());
config.setStorage(
ApplicationConfig.StorageType.valueOf(
storageType.getSelectionModel().getSelectedItem()));
config.save();
if (config.isBlockImport() || config.isTxImport()) {
Async.setScene(IMPORTING_FXML);
} else {
Form.showInfoAlert(
"Configuration",
"Nothing selected for import, please select to import blocks or transactions.");
}
}