當前位置: 首頁>>代碼示例>>Java>>正文


Java Event類代碼示例

本文整理匯總了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;
}
 
開發者ID:steppp,項目名稱:Breadth-First-Search,代碼行數:21,代碼來源:MainController.java

示例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());
	}
}
 
開發者ID:ForJ-Latech,項目名稱:fwm,代碼行數:23,代碼來源:RegionTabController.java

示例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();
		}
	}


}
 
開發者ID:ScreachFr,項目名稱:titanium,代碼行數:18,代碼來源:MemberPane.java

示例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();
		}
	}
}
 
開發者ID:ScreachFr,項目名稱:titanium,代碼行數:17,代碼來源:OrganizationManagerStage.java

示例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();
	}
	
}
 
開發者ID:ScreachFr,項目名稱:titanium,代碼行數:22,代碼來源:AddMemberDialog.java

示例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");
	}
}
 
開發者ID:ScreachFr,項目名稱:titanium,代碼行數:20,代碼來源:MainPane.java

示例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();
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:24,代碼來源:EditorAreaComponent.java

示例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());
        }
    }
}
 
開發者ID:wartab,項目名稱:gen7-iv-calculator,代碼行數:21,代碼來源:OutputPresenter.java

示例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();
	}
}
 
開發者ID:lukasbischof,項目名稱:Orsum-occulendi,代碼行數:24,代碼來源:Controller.java

示例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();
	}
}
 
開發者ID:lukasbischof,項目名稱:Orsum-occulendi,代碼行數:34,代碼來源:Controller.java

示例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;
}
 
開發者ID:steppp,項目名稱:Breadth-First-Search,代碼行數:22,代碼來源:MainController.java

示例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);
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:19,代碼來源:Advanced3DFileEditorWithRightTool.java

示例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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:GroupEntryResource.java

示例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);
            }
        };
    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:17,代碼來源:Target.java

示例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.");
    }
}
 
開發者ID:codingchili,項目名稱:ethereum-ingest,代碼行數:23,代碼來源:Settings.java


注:本文中的javafx.event.Event類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。